Deprecation warning added to fit general

This commit is contained in:
Fabian Joswig 2021-10-15 12:15:04 +01:00
parent 4ca6f8ea49
commit c169da5501

View file

@ -379,7 +379,7 @@ def prior_fit(x, y, func, priors, silent=False, **kwargs):
result_dict['fit_function'] = func result_dict['fit_function'] = func
if Obs.e_tag_global < 4: if Obs.e_tag_global < 4:
print('WARNING: e_tag_global is smaller than 4, this can cause problems when calculating errors from fits with priors') warnings.warn("e_tag_global is smaller than 4, this can cause problems when calculating errors from fits with priors", RuntimeWarning)
x = np.asarray(x) x = np.asarray(x)
@ -629,7 +629,6 @@ def error_band(x, func, beta):
def fit_general(x, y, func, silent=False, **kwargs): def fit_general(x, y, func, silent=False, **kwargs):
"""Performs a non-linear fit to y = func(x) and returns a list of Obs corresponding to the fit parameters. """Performs a non-linear fit to y = func(x) and returns a list of Obs corresponding to the fit parameters.
WARNING: In the current version the fits are performed with numerical derivatives.
Plausibility of the results should be checked. To control the numerical differentiation Plausibility of the results should be checked. To control the numerical differentiation
the kwargs of numdifftools.step_generators.MaxStepGenerator can be used. the kwargs of numdifftools.step_generators.MaxStepGenerator can be used.
@ -650,9 +649,7 @@ def fit_general(x, y, func, silent=False, **kwargs):
with many parameters. with many parameters.
""" """
if not silent: warnings.warn("New fit functions with exact error propagation are now available as alternative.", DeprecationWarning)
print('WARNING: This function is deprecated and will be removed in future versions.')
print('New fit functions with exact error propagation are now available as alternative.')
if not callable(func): if not callable(func):
raise TypeError('func has to be a function.') raise TypeError('func has to be a function.')