diff --git a/invisible_cities/core/fit_functions.py b/invisible_cities/core/fit_functions.py index 500bfaa6b..debdab8b9 100644 --- a/invisible_cities/core/fit_functions.py +++ b/invisible_cities/core/fit_functions.py @@ -158,8 +158,8 @@ def fit(func, x, y, seed=(), fit_range=None, **kwargs): Returns ------- fitted_fun : FitFunction - Extended function containing fit parameters (fitf, vals, errors, chi2, pval, - cov) and full_output from curve_fit and leastsq (infodict, mesg and ier). + Extended function containing fit parameters (fitf, vals, errors, chi2, pval, + cov) and full_output from curve_fit and leastsq (infodict, mesg and ier). Examples diff --git a/invisible_cities/core/fit_functions_test.py b/invisible_cities/core/fit_functions_test.py index e99196b2e..0a9270567 100644 --- a/invisible_cities/core/fit_functions_test.py +++ b/invisible_cities/core/fit_functions_test.py @@ -18,7 +18,6 @@ from hypothesis.strategies import floats from . testing_utils import float_arrays from . testing_utils import random_length_float_arrays -from .. evm.ic_containers import FitFunction from . import core_functions as core from . import fit_functions as fitf diff --git a/invisible_cities/reco/icaro_components.py b/invisible_cities/reco/icaro_components.py index 300ac675f..f396e31e3 100644 --- a/invisible_cities/reco/icaro_components.py +++ b/invisible_cities/reco/icaro_components.py @@ -1,7 +1,6 @@ import numpy as np import pandas as pd -from typing import Optional from ..types.symbols import KrFitFunction from .. evm.ic_containers import FitFunction from .. core.fit_functions import polynom, expo @@ -9,7 +8,6 @@ def lin_seed(x : np.array, y : np.array): - ''' Estimate the seed for a linear fit. @@ -44,7 +42,6 @@ def lin_seed(x : np.array, def expo_seed(x : np.array, y : np.array): - ''' Estimate the seed for an exponential fit. @@ -62,7 +59,6 @@ def expo_seed(x : np.array, ''' x, y = zip(*sorted(zip(x, y))) - const = y[0] if const <= 0 or y[-1] <= 0: @@ -76,16 +72,9 @@ def expo_seed(x : np.array, def select_fit_variables(fittype : KrFitFunction, dst : pd.DataFrame): - ''' Select the data for fitting based on the specified fit type. - NOTES: Since x axis (DT) is never altered, maybe we can just - return the y values. However, when we implement the binned fit, - the profile could be done here (?) so it would make sense to - always provide both x and y. We could rename parameters and have - fittype (binned / unbinned) and fitfunction (lin, expo, log-lin...) - Parameters ---------- fittype : KrFitFunction @@ -133,7 +122,6 @@ def get_function_and_seed_lt(fittype : KrFitFunction): def transform_parameters(fit_output : FitFunction): - ''' Transform the parameters obtained from the fitting output into EO and LT. When using log_lin fit, we need to convert the intermediate variables into diff --git a/invisible_cities/reco/icaro_components_test.py b/invisible_cities/reco/icaro_components_test.py index 3d9472d63..0dc8bae0b 100644 --- a/invisible_cities/reco/icaro_components_test.py +++ b/invisible_cities/reco/icaro_components_test.py @@ -47,6 +47,7 @@ def sample_df(): 'S2e': [50, 45, 42, 41, 41] } return pd.DataFrame(data) + def test_select_fit_variables(sample_df): x_linear, y_linear = icarcomp.select_fit_variables(KrFitFunction.linear, sample_df)