# How to model and subtract nebular emission lines from stellar spectrum

I have optical stellar spectra from a star forming region with spatially varying nebular background.

I want to subtract the nebular lines from the stellar spectra (which are varying in intensity from spectrum to spectrum because of the varying background). How can I model and subtract individual nebular lines from a stellar spectrum? Are there any known tools for this? Any help or suggestions would be highly appreciated.

• Are you saying the interstellar medium shows optical emission lines? That sounds unlikely , except maybe some H$\alpha$ emisison from HII regions. Sep 15 '19 at 9:35
• @MarkusRoellig of course the ISM can be a source of optical emission lines, especially in star forming regions as stated in the question. And it isn't just H alpha; there are fobidden lines of oxygen, nitrogen, sulphur etc. Sep 16 '19 at 9:16