Questions tagged [lmfit]

lmfit is a Python library for Least-Squares Minimization with Bounds and Constraints.

A library for least-squares minimization and data fitting in Python. Built on top of scipy.optimize, lmfit provides a Parameter object which can be set as fixed or free, can have upper and/or lower bounds, or can be written in terms of algebraic constraints of other Parameters. The user writes a function to be minimized as a function of these Parameters, and the scipy.optimize methods are used to find the optimal values for the Parameters. The Levenberg-Marquardt (leastsq) is the default minimization algorithm, and provides estimated standard errors and correlations between varied Parameters. Other minimization methods, including Nelder-Mead’s downhill simplex, Powell’s method, BFGS, Sequential Least Squares, and others are also supported. Bounds and contraints can be placed on Parameters for all of these methods.

https://pypi.python.org/pypi/lmfit

382 questions
-1
votes
1 answer

Gaussian Fit using lmfit

I am trying to fit a gaussian. I tried to fit using OriginPro and Python. The fit in OriginPro is better than that obtained through Python and I would like to do it using Python. OriginPro: Python: The code I used is: import numpy as np import…
Pranav45
  • 3
  • 3
-1
votes
1 answer

looping over legit parameters

I am iterating over N files and fitting all the data using lmfit Gaussian Model. I would like to obtain an array of all the parameters for the different files so I can plot them against another variable. Any idea how to do so ? this is my code: def…
-1
votes
1 answer

Fitting two variables using lmfit

How can I fit this function with two input variables using lmfit in python? function f(x) =a*(x - b)**2, a and b are variables and they can be a random number.
fsrfyama
  • 325
  • 2
  • 13
-1
votes
1 answer

Using lmfit model to best fit the multiple peaks data

import matplotlib.pyplot as plt import numpy as np from lmfit import Model x=np.array([4698.031, 4698.027, 4698.024, 4698.021, 4698.017, 4698.014,4698.011, 4698.007, 4698.004, 4698.001, 4697.997, 4697.994, 4697.991, 4697.987, 4697.984, 4697.981,…
Zewo
  • 153
  • 1
  • 12
-1
votes
3 answers

printing variable values using lmfit

am trying to print variable values from lmfit minimization algorithm.am using lmfit.printfuncs.report_fit(res.params) am getting [[Variables]] a: 123 (init= 123) b: 456 (init= 456) c: 789 (init= 789) d: 012 (init=…
ch.Joshi elijah
  • 103
  • 2
  • 11
-2
votes
1 answer

how can I fix this ''name is not defined''

I am newbie in python I have this code i want to use subclass lmfit.models and implement a guess method, class DecayingSineModel(): def __init__(self, *args, **kwargs): def decaying_sine(self, x, ampl, offset, freq, x0, tau): …
somaye
  • 3
  • 5
-2
votes
1 answer

Is this numpy error attributable to a difference in Python 2.7 and 3.5?

The following code comes from an example on http://cars9.uchicago.edu/software/python/lmfit/parameters.html. from lmfit import minimize, Minimizer, Parameters, Parameter, report_fit import numpy as np # create data to be fitted x = np.linspace(0,…
kotval
  • 120
  • 2
  • 10
1 2 3
25
26