[AstroPy] how to flatten an optical spectrum of a star

Pey Lian Lim p3y1i4n at gmail.com
Tue Sep 2 09:40:16 EDT 2014

Hi Hang,

You can probably do it with pysynphot (which is currently not a part
of astropy). It is currently distributed with
but there are long-term plans to port it to astropy and use modeling.

I tried the following and I could recover the Gaussian emission line
by subtracting away the blackbody spectrum that I added at the

>>> import pysynphot as S
>>> bb = S.BlackBody(5000)
>>> gg = S.GaussianSource(0.03, 4500, 100, fluxunits='photlam')
>>> source_with_bg = bb + gg
>>> source_no_bg = source_with_bg - bb

If you have questions about pysynphot, please contact help[at]stsci.edu .

Hope this helps,

More information about the AstroPy mailing list