[AstroPy] Gaussian with constant background

Taro Sato taro at ap.smu.ca
Wed Jun 27 16:15:11 EDT 2012


On Wed, Jun 27, 2012 at 1:10 PM, Vivienne Baldassare
<vivienne.baldassare at gmail.com> wrote:
> Hello,
>
> I've been trying to figure out how to fit a gaussian with a constant
> (non-zero) background.  Aside from just subtracting off the background, I
> haven't been able to do it, and googling around was not particularly
> helpful.  I'd appreciate any tips!



Why don't you learn how to use some generic non-linear fitting routine
like scipy.optimize.leastsq?  Once you learn how to do this, you can
basically fit any analytical function you like.  A few good examples
in the following page:

http://www.scipy.org/Cookbook/FittingData



-- 
Taro Sato
Department of Astronomy & Physics
Saint Mary's University             email: taro at ap.smu.ca
Halifax, NS B3H 3C3                 phone: (902)420-5018
Canada                                web: http://ap.smu.ca/~taro



More information about the AstroPy mailing list