# Re: Three-term gaussian fit to gaussian data using scipy (Otto Ngeke)

 Classic List Threaded
2 messages
Reply | Threaded
Open this post in threaded view
|

## Re: Three-term gaussian fit to gaussian data using scipy (Otto Ngeke)

 ------------------------------ Message: 3 Date: Thu, 6 Apr 2017 08:56:56 +0200 From: Otto Ngeke <[hidden email]> To: SciPy Users List <[hidden email]> Subject: Re: [SciPy-User] Three-term gaussian fit to gaussian data using scipy Message-ID: Content-Type: text/plain; charset="utf-8" I tried to pay more attention to the initial guess as suggested, and found a very nearly close fit! The new initial guess I used is p0=[V.max(), std_dev, V.max(), 2] See attached for new fit. ... ... ------------------- In case a set of gaussians aren't a constraint to your fit, you might want to play a bit with something like, return ps1*np.exp(-(x/ps2)**2)*np.sin(x)**2 + ps2*np.exp(-(x/ps3)**2) + ps3*np.exp(-(x/ps4)**2) and the set of parameters: p0=[V.max(), std_dev, V.min(), 2] Reagrds, Sergio Non-linear fitting stuff: https://www.packtpub.com/big-data-and-business-intelligence/numerical-and-scientific-computing-scipy-video_______________________________________________ SciPy-User mailing list [hidden email] https://mail.python.org/mailman/listinfo/scipy-user out.png (30K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

## Re: Three-term gaussian fit to gaussian data using scipy (Otto Ngeke)

 HI Sergio,Thanks for the new fit. I am in a bit of a difficulty because the set of Gaussians I have chosen is to go as input to another software, and that software only accepts the Gaussians in that specific form. If I modify as you suggested, then I can no longer use the software.On Thu, Apr 6, 2017 at 11:46 PM, Sergio Rojas wrote: ------------------------------ Message: 3 Date: Thu, 6 Apr 2017 08:56:56 +0200 From: Otto Ngeke <[hidden email]> To: SciPy Users List <[hidden email]> Subject: Re: [SciPy-User] Three-term gaussian fit to gaussian data using scipy Message-ID: Content-Type: text/plain; charset="utf-8" I tried to pay more attention to the initial guess as suggested, and found a very nearly close fit! The new initial guess I used is p0=[V.max(), std_dev, V.max(), 2] See attached for new fit. ... ... ------------------- In case a set of gaussians aren't a constraint to your fit, you might want to play a bit with something like, return ps1*np.exp(-(x/ps2)**2)*np.sin(x)**2 + ps2*np.exp(-(x/ps3)**2) + ps3*np.exp(-(x/ps4)**2) and the set of parameters: p0=[V.max(), std_dev, V.min(), 2] Reagrds, Sergio Non-linear fitting stuff: https://www.packtpub.com/big-data-and-business-intelligence/numerical-and-scientific-computing-scipy-video _______________________________________________ SciPy-User mailing list [hidden email] https://mail.python.org/mailman/listinfo/scipy-user _______________________________________________ SciPy-User mailing list [hidden email] https://mail.python.org/mailman/listinfo/scipy-user