Exemple #1
0
def random_fit_data(request, mocker, random_sigma_mock, random_error_mock):
    params = request.param
    random_array_mock = mocker.patch("eddington.fit_data.random_array")
    if "a" in params:
        random_array_mock.side_effect = [x]
    else:
        random_array_mock.side_effect = [a, x]
    return (
        FitData.random(dummy_func1, **params),
        dict(
            params=params,
            random_array=random_array_mock,
            random_sigma=random_sigma_mock,
            random_error=random_error_mock,
        ),
    )
Exemple #2
0
def function_cases(odr_mock, request):
    func, kwargs, model_extra_kwargs, fit_a0 = (
        request.param["func"],
        request.param.get("kwargs", {}),
        request.param.get("model_extra_kwargs", {}),
        request.param.get("a0", a0),
    )
    data = FitData.random(fit_func=func)
    result = fit_to_data(data=data, func=func, a0=fit_a0, **kwargs)
    return dict(
        func=func,
        data=data,
        result=result,
        model_extra_kwargs=model_extra_kwargs,
        a0=fit_a0,
        mocks=odr_mock,
    )