https://github.com/lmfit/lmfit-py
Raw File
Tip revision: 8781a2dc33288b25fae6f3139595402155e4968b authored by Matthew Newville on 04 April 2024, 15:42:14 UTC
whatsnew for version 1.3.0
Tip revision: 8781a2d
test_default_kws.py
import numpy as np

from lmfit.lineshapes import gaussian
from lmfit.models import GaussianModel


def test_default_inputs_gauss():
    area = 1
    cen = 0
    std = 0.2
    x = np.arange(-3, 3, 0.01)
    y = gaussian(x, area, cen, std)

    g = GaussianModel()

    fit_option1 = {'xtol': 1e-2}
    result1 = g.fit(y, x=x, amplitude=1, center=0, sigma=0.5,
                    max_nfev=5000, fit_kws=fit_option1)

    fit_option2 = {'xtol': 1e-6}
    result2 = g.fit(y, x=x, amplitude=1, center=0, sigma=0.5,
                    max_nfev=5000, fit_kws=fit_option2)

    assert result1.values != result2.values
back to top