[SciPy-User] Fitting Gaussian in spectra

Christian K. ckkart@hoc....
Sun Sep 30 07:13:27 CDT 2012

> I have a spectra with multiple gaussian emission lines over a noisy
> continuum.
> My primary objective is to find areas under all the gaussian peaks.
> For that, the following is the algorithm i have in mind.
> 1) fit the continuum and subtract it.
> 2) find the peaks
> 3) do least square fit of gaussian at the peaks to find the area under
> each gaussian peaks.
> I am basically stuck at the first step itself. Simple 2nd or 3rd order
> polynomial fit is not working because the contribution from peaks are
> significant. Any tool exist to fit continuum ignoring the peaks?

Try to fit all at once and subtract only parts of the model which best 
describe the background. In fact, doing so, you do not even need to 
subtract the continuum. If you were using peak-o-mat you could e.g. try 
a model like CB DEC GA GA GA GA (constant background, exponential decay, 
gauss) assuming in this case, that the continuum can be described by an 
exponential function plus a constant offset. Then you would evaluate 
those parts of the model which are related to the continuum and subtract 
them from the original one.
peak-o-mat however cannot find the peaks on its one, as you said, peak 
finding can be quite tricky.
Tell if that helps or if you need more information.
Regards, Christian

More information about the SciPy-User mailing list