Skip to content

Releases: lmfit/lmfit-py

1.3.2

19 Jul 16:09
Compare
Choose a tag to compare

Fixes:

  • fix typo in restoring a _buildmodel dict (PR #957, Issue #956)
  • fixes for Numpy2 support (PR #959, Issue #958)
  • ensure that correct initial params are used when re-fitting a ModeRresult (PR #961, Issue #960)
  • make sure that CompositeModels cannot have a prefix (PR #961, Issue #954)

Build, Maintenance:

  • update pre-commit hooks, adding codespell exceptions
  • update to latest SciPy/NumPy versions, including dependency versions for NumPy 2.
  • now require asteval>=1.0 and uncertainties>=3.2.2

1.3.1

19 Apr 15:59
Compare
Choose a tag to compare

Mostly fixes for bugs introduced in 1.3.0

  • allow Model.eval_uncertainty to be performed with single points for x independent variables (PR #952, Issue #951)

  • allow Model._parse_param to handle older-style passed-in 'argnames' and 'kwargs' as for variadic function, add test (PR #950)

  • better allow (or re-allow) Model function independent variables / keyword argumentss to be given non-default values at model creation time

  • add form as independent variable for builtin Step, Rectangle, Thermal Distribution models.

  • use a copy of sys.modules when iterating over it. (#949)

  • use Model._reprstring(long=True) for model Model.__repr__().

1.3.0

04 Apr 17:30
Compare
Choose a tag to compare

Version 1.3.0 Release Notes (April 4, 2024)

New features:

  • add 'min_rel_change' as optional variable in calculation of confidence intervals with
    Model.conf_interval(). (PR #937).

  • Model.eval_uncertainty now takes an optional dscale parameter (default value of 0.01) to
    set the step size for calculating derivatives (PR #933).

  • add calculation of predicted_interval to Model.eval_uncertainty (PR #933).

Bug fixes/enhancements:

  • restore best-fit parameter values for high accuracy values of constrained values (PR #907)

  • improvement to Model for the difference between Parameter, "independent variable", and
    "option". With this change, keyword arguments to model functions with non-numerice
    default values such as do_thing=True, or form='linear' has those arguments
    become clearly identified as independent variables,and use the provided values as
    default values. (PR #941)

  • better saving/loading saved states of Model now use dill, have several cleanups, and
    are now versioned for future-proofing. Also, propagate funcdets for Parameters when
    loading a Model. (PR #932, PR #934)

  • in the TNC method, maxfun is used instead of maxiter.

  • fix bug calculating r-squared for fits with weights (PR #921, PR #923)

  • fix bug in modelresult.eval_uncertainty() after load_modelresult() (PR #909)

  • use StringIO for pandas.read_json.

  • add test for MinimizerResult.uvars after successful fit (PR #913)

  • adding an example using basinhopping, can take other methods as command-line argument

Maintenance/Deprecations:

  • drop support for Python 3.7 that reached EOL on 2023-06-27 (PR #927)

  • fix tests for Python 3.12 and Python 3.13-dev

  • increase minimum numpy verstio to 1.23 and scipy to 1.8.

  • updates for compatibility with numpy 2.0

  • the dill package is now required. (#940)

  • build switchded to use pyproject.toml (#928)

  • fix broken links in Examples gallery

  • fix intersphinx mapping to scipy docs.

1.2.2

14 Jul 02:52
Compare
Choose a tag to compare

Version 1.2.2 Release Notes (July 14, 2023)

New features:

  • add ModelResult.uvars output to a ModelResult after a successful fit
    that contains ufloats from the uncertainties package which can be
    used for downstream calculations that propagate the uncertainties (and
    correlations) of the variable Parameters. (PR #888)

  • Outputs of residual functions, including Model._residual, are more
    explicitly coerced to 1d-arrays of datatype Float64. This decreases the
    expectation for the user-supplied code to return ndarrays, and increases the
    tolerance for more "array-like" objects or ndarrays that are not Float64 or
    1-dimensional. (PR #899)

  • Model.fit now takes a coerce_farray option, defaulting to True to
    control whether to input data and independent variables that are "array-like"
    are coerced to ndarrays of datatype Float64 or Complex128. If set to
    False then independent data that "array-like" (pandas.Series, int32
    arrays, etc) will be sent to the model function unaltered. The user may then
    use other features of these objects, but may also need to explicitly coerce
    the datatype of the result the change described above about coercing the
    result causes problems. (Discussion #873; PR #899)

Bug fixes/enhancements:

  • fixed bug in Model.make_params() for non-composite models that use a
    prefix (Discussion #892; Issue #893; PR #895)

  • fixed bug with aborted fits for several methods having incorrect or invalid
    fit statistics. (Discussion #894; Issue #896; PR #897)

  • Model.eval_uncertainty now correctly calculates complex (real/imaginary pairs)
    uncertainties for Models that generate complex results. (Issue #900; PR #901)

  • Model.eval now returns and array-like value. This adds to the coercion
    features above and fixes a bug for composite models that return lists (Issue #875; PR #901)

  • the HTML representation for a ModelResult or MinimizerResult are
    improved, and create fewer entries in the Table of Contents for Jupyter lab.
    (Issue #884; PR #883; PR #902)

1.2.2rc1

08 Jul 15:51
Compare
Choose a tag to compare
1.2.2rc1 Pre-release
Pre-release

Version 1.2.2 Release Notes (July 14, 2023)

New features:

  • add ModelResult.uvars output to a ModelResult after a successful fit
    that contains ufloats from the uncertainties package which can be
    used for downstream calculations that propagate the uncertainties (and
    correlations) of the variable Parameters. (PR #888)

  • Outputs of residual functions, including Model._residual, are more
    explicitly coerced to 1d-arrays of dataype Float64. This decreases the
    expectation for the user-supplied code to return ndarrays, and increases the
    tolerance for more "array-like" objects or ndarrays that are not Float64 or
    1-dimensional. (PR #899)

  • Model.fit now takes a coerce_farray option, defaulting to True to
    control whether to input data and independent variables that are "array-like"
    are coerced to ndarrays of datatype Float64 or Complex128. If set to
    False then independent data that "array-like" (pandas.Series, int32
    arrays, etc) will be sent to the model function unaltered. The user may then
    use other features of these objects, but may also need to explicitly coerce
    the datatype of the result the change described above about coercing the
    result causes problems. (Discussion #873; PR #899)

Bug fixes/enhancements:

  • fixed bug in Model.make_params() for non-composite models that use a
    prefix (Discussion #892; Issue #893; PR #895)

  • fixed bug with aborted fits for several methods having incorrect or invalid
    fit statistics. (Discussion #894; Issue #896; PR #897)

  • Model.eval_uncertainty now correctly calculates complex (real/imaginary pairs)
    uncertainties for Models that generate complex results. (Issue #900; PR #901)

  • Model.eval now returns and array-like value. This adds to the coercion
    features above and fixes a bug for composite models that return lists (Issue #875; PR #901)

  • the HTML representation for a ModelResult or MinimizerResult are
    improved, and create fewer entries in the Table of Contents for Jupyter lab.
    (Issue #884; PR #883; PR #902)

1.2.1

02 May 17:52
Compare
Choose a tag to compare

Version 1.2.1 Release Notes (May 02, 2023)

Bug fixes/enhancements:

  • fixed bug in Model.make_params() for initial parameter values that were
    not recognized as floats such as np.Int64. (Issue #871; PR #872)

  • explicitly set maxfun for l-bfgs-b method when setting
    maxiter. (Issue #864; Discussion #865; PR #866)

1.20

08 Apr 19:46
a03ac0f
Compare
Choose a tag to compare

New features:

  • add create_params function (PR #844)
  • add chi2_out and nsigma options to conf_interval2d()
  • add ModelResult.summary() to return many resulting fit statistics and attributes into a JSON-able dict.
  • add correl_table() function to lmfit.printfuncs and correl_mode option to fit_report() and
    ModelResult.fit_report() to optionally display a RST-formatted table of a correlation matrix.

Bug fixes/enhancements:

  • fix bug when setting param.vary=True for a constrained parameter (Issue #859; PR #860)
  • fix bug in reported uncertainties for constrained parameters by better propating uncertainties (Issue #855; PR #856)
  • Coercing of user input data and independent data for Model to float64 ndarrays is somewhat less aggressive and
    will not increase the precision of numpy ndarrays (see :ref:model_data_coercion_section for details). The resulting
    calculation from a model or objective function is more aggressively coerced to float64. (Issue #850; PR #853)
  • the default value of epsfcn is increased to 1.e-10 to allow for handling of data with precision less than float64
    (Issue #850; PR #853)
  • fix conf_interval2d to use "increase chi-square by sigma**2*reduced chi-square" to give the sigma-level
    probabilities (Issue #848; PR #852)
  • fix reading of older ModelResult (Issue #845; included in PR #844)
  • fix deepcopy of Parameters and user data (mguhyo; PR #837)
  • improve Model.make_params and create_params to take optional dict of Parameter attributes (PR #844)
  • fix reporting of nfev from least_squares to better reflect actual number of function calls (Issue #842; PR #844)
  • fix bug in Model.eval when mixing parameters and keyword arguments (PR #844, #839)
  • re-adds residual to saved Model result (PR #844, #830)
  • ConstantModel and ComplexConstantModel will return an ndarray of the same shape as the independent variable
    x (JeppeKlitgaard, Issue #840; PR #841)
  • update tests for latest versions of NumPy and SciPy.
  • many fixes of doc typos and updates of dependencies, pre-commit hooks, and CI.

1.2.0rc1: Merge pull request #858 from lmfit/v120_rc1

04 Apr 03:24
52012fd
Compare
Choose a tag to compare

Version 1.2.0rc1 Release Notes (April 03, 2023)

New features:

  • add create_params function (PR #844)
  • add chi2_out and nsigma options to conf_interval2d()
  • add ModelResult.summary() to return many resulting fit statistics and attributes into a JSON-able dict.
  • add correl_table() function to lmfit.printfuncs and correl_mode option to fit_report() and
    ModelResult.fit_report() to optionally display a RST-formatted table of a correlation matrix.

Bug fixes/enhancements:

  • fix bug in reported uncertainties for constrained parameters by better propating uncertainties (Issue #855; PR #856)
  • Coercing of user input data and independent data for Model to float64 ndarrays is somewhat less aggressive and
    will not increase the precision of numpy ndarrays (see :ref:model_data_coercion_section for details). The resulting
    calculation from a model or objective function is more aggressively coerced to float64. (Issue #850; PR #853)
  • the default value of epsfcn is increased to 1.e-10 to allow for handling of data with precision less than float64
    (Issue #850; PR #853)
  • fix conf_interval2d to use "increase chi-square by sigma**2*reduced chi-square" to give the sigma-level
    probabilities (Issue #848; PR #852)
  • fix reading of older ModelResult (Issue #845; included in PR #844)
  • fix deepcopy of Parameters and user data (mguhyo; PR #837)
  • improve Model.make_params and create_params to take optional dict of Parameter attributes (PR #844)
  • fix reporting of nfev from least_squares to better reflect actual number of function calls (Issue #842; PR #844)
  • fix bug in Model.eval when mixing parameters and keyword arguments (PR #844, #839)
  • re-adds residual to saved Model result (PR #844, #830)
  • ConstantModel and ComplexConstantModel will return an ndarray of the same shape as the independent variable
    x (JeppeKlitgaard, Issue #840; PR #841)
  • update tests for latest versions of NumPy and SciPy.
  • many fixes of doc typos and updates of dependencies, pre-commit hooks, and CI.

1.1.0

28 Nov 04:56
Compare
Choose a tag to compare

Version 1.1.0 Release Notes (November 27, 2022)

Supported Python Versions: 3.7, 3.8, 3.9, 3.10, 3.11
Minimal requirements: numpy>=1.19, scipy>=1.6, uncertainties>=3.1.4, asteval>=0.9.28

New features:

  • add Pearson4Model (@lellid; PR #800)
  • add SplineModel (PR #804)
  • add R^2 rsquared statistic to fit outputs and reports for Model fits (Issue #803; PR #810)
  • add calculation of dely for model components of composite models (Issue #761; PR #826)

Bug fixes/enhancements:

  • make sure variable spercent is always defined in params_html_table functions (reported by @MySlientWind; Issue #768, PR #770)
  • always initialize the variables success and covar the MinimizerResult (reported by Marc W. Pound; PR #771)
  • build package following PEP517/PEP518; use pyproject.toml and setup.cfg; leave setup.py for now (PR #777)
  • components used to create a CompositeModel can now have different independent variables (@Julian-Hochhaus; Discussion #787; PR #788)
  • fixed function definition for StepModel(form='linear'), was not consistent with the other ones (@matpompili; PR #794)
  • fixed height factor for Gaussian2dModel, was not correct (@matpompili; PR #795)
  • for covariances with negative diagonal elements, we set the covariance to None (PR #813)
  • fixed linear mode for RectangleModel (@arunpersaud; Issue #815; PR #816)
  • report correct initial values for parameters with bounds (Issue #820; PR #821)
  • allow recalculation of confidence intervals (@jagerber48; PR #798)
  • include 'residual' in JSON output of ModelResult.dumps (@mac01021; PR #830)
  • supports and is tested against Python 3.11; updated minimum required version of SciPy, NumPy, and asteval (PR #832)

Deprecations:

  • remove support for Python 3.6 which reached EOL on 2021-12-23 (PR #790)

1.0.4rc1: Merge pull request #831 from lmfit/calc_dely_components

21 Nov 21:00
cdd2feb
Compare
Choose a tag to compare

Version 1.0.4rc1

New features:

  • add calculation of dely for model components of composite models (Issue #761; PR #826)
  • add R^2 rsquared statistic to fit outputs and reports for Model fits (Issue #803; PR #810)
  • add SplineModel (PR #804)
  • add Pearson4Model (@lellid; PR #800)

Bug fixes/enhancements:

  • make sure variable spercent is always defined in params_html_table functions (reported by @MySlientWind; Issue #768, PR #770)
  • always initialize the variables success and covar the MinimizerResult (reported by Marc W. Pound; PR #771)
  • build package following PEP517/PEP518; use pyproject.toml and setup.cfg; leave setup.py for now (PR #777)
  • components used to create a CompositeModel can now have different independent variables (@Julian-Hochhaus; Discussion #787; PR #788))
  • fixed function definition for StepModel(form='linear'), was not consistent with the other ones. (@matpompili; PR #794)
  • fixed height factor for Gaussian2dModel, was not correct. (@matpompili; PR #795)
  • for covariances with negative diagonal elements, we set the covariance to None (PR #813)
  • fixed linear mode for RectangleModel (@arunpersaud; Issue #815; PR #816)
  • report correct initial values for parameters with bounds (Issue #820; PR #821)
  • allow recalculation of confidence intervals (@jagerber48; PR #798)

Deprecations:

  • remove support for Python 3.6 which reached EOL on 2021-12-23 (PR #790)