https://github.com/lmfit/lmfit-py
Raw File
Tip revision: 9f9af6f36c0928767ea8b004ea8cb5a16aba6b04 authored by Matt Newville on 14 October 2021, 19:34:30 UTC
Merge pull request #759 from reneeotten/last_changes_before_release
Tip revision: 9f9af6f
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