Python Forum
Gaussian Curve Fit using Scipy ODR
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Gaussian Curve Fit using Scipy ODR
#2
Looks like your GaussModelConstant function may not be properly defined. According to the scipy odr documentation (https://docs.scipy.org/doc/scipy/reference/odr.html) the fitting function has the following form:
def f(B, x):
    '''Linear function y = m*x + b'''
    # B is a vector of the parameters.
    # x is an array of the current x values.
    # x is in the same format as the x passed to Data or RealData.
    #
    # Return an array in the same format as y passed to Data or RealData.
    return B[0]*x + B[1]
If you correct that and use init_guess = [1400, 270, 10, 200] it works fine.
Reply


Messages In This Thread
Gaussian Curve Fit using Scipy ODR - by 83dons - Feb-17-2021, 12:03 PM
RE: Gaussian Curve Fit using Scipy ODR - by Tuxedo - Feb-19-2021, 10:24 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  curve fitting matlotlib scipy Cjstarling 2 2,571 Sep-15-2020, 02:56 PM
Last Post: Cjstarling
  How do I create these Kernel functions in Python for Gaussian Process Regression? Shivam18 0 2,301 May-20-2020, 03:04 PM
Last Post: Shivam18
  Stretching a curve and modifying it IlikePi 0 2,016 Feb-01-2020, 03:41 PM
Last Post: IlikePi

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020