diff --git a/invisible_cities/reco/icaro_components.py b/invisible_cities/reco/krmap_functions.py similarity index 100% rename from invisible_cities/reco/icaro_components.py rename to invisible_cities/reco/krmap_functions.py diff --git a/invisible_cities/reco/icaro_components_test.py b/invisible_cities/reco/krmap_functions_test.py similarity index 81% rename from invisible_cities/reco/icaro_components_test.py rename to invisible_cities/reco/krmap_functions_test.py index f2bbfb933..fcb5cbd34 100644 --- a/invisible_cities/reco/icaro_components_test.py +++ b/invisible_cities/reco/krmap_functions_test.py @@ -8,7 +8,7 @@ from hypothesis import given, settings from hypothesis.strategies import floats, integers -from .. reco import icaro_components as icarcomp +from .. reco import krmap_functions as krf from ..types.symbols import KrFitFunction from .. evm.ic_containers import FitFunction from .. core.fit_functions import expo @@ -21,7 +21,7 @@ def test_lin_function_output_values(x_min, x_max, a, b): x = np.array([x_min, x_max]) y = a + b * x - a_test, b_test = icarcomp.lin_seed(x, y) + a_test, b_test = krf.lin_seed(x, y) assert np.isclose(a_test, a) assert np.isclose(b_test, b) @@ -34,7 +34,7 @@ def test_lin_function_output_values(x_min, x_max, a, b): def test_expo_seed_output_values(zmin, zmax, elt, e0): x = np.array([zmin, zmax]) y = e0 * np.exp(-x / elt) - e0_test, elt_test = icarcomp.expo_seed(x, y) + e0_test, elt_test = krf.expo_seed(x, y) assert np.isclose( e0_test, e0, rtol=0.1) assert np.isclose(elt_test, elt, rtol=0.1) @@ -48,9 +48,9 @@ def sample_df(): def test_select_fit_variables(sample_df): - x_linear, y_linear = icarcomp.select_fit_variables(KrFitFunction.linear, sample_df) - x_expo, y_expo = icarcomp.select_fit_variables(KrFitFunction.expo, sample_df) - x_log_lin, y_log_lin = icarcomp.select_fit_variables(KrFitFunction.log_lin, sample_df) + x_linear, y_linear = krf.select_fit_variables(KrFitFunction.linear, sample_df) + x_expo, y_expo = krf.select_fit_variables(KrFitFunction.expo, sample_df) + x_log_lin, y_log_lin = krf.select_fit_variables(KrFitFunction.log_lin, sample_df) # First return the same for the 3 cases assert (x_expo == x_linear).all() @@ -71,9 +71,9 @@ def test_get_function_and_seed_lt_with_data(x_min, x_max, steps, e0, lt): x = np.linspace(x_min, x_max, steps) y = expo(x, e0, lt) - fit_func_lin, seed_func_lin = icarcomp.get_function_and_seed_lt(KrFitFunction.linear) - fit_func_expo, seed_func_expo = icarcomp.get_function_and_seed_lt(KrFitFunction.expo) - fit_func_log_lin, seed_func_log_lin = icarcomp.get_function_and_seed_lt(KrFitFunction.log_lin) + fit_func_lin, seed_func_lin = krf.get_function_and_seed_lt(KrFitFunction.linear) + fit_func_expo, seed_func_expo = krf.get_function_and_seed_lt(KrFitFunction.expo) + fit_func_log_lin, seed_func_log_lin = krf.get_function_and_seed_lt(KrFitFunction.log_lin) popt_lin, _ = so.curve_fit(fit_func_lin, x, y, p0=seed_func_lin (x, y)) popt_expo, _ = so.curve_fit(fit_func_expo, x, y, p0=seed_func_expo (x, y)) @@ -93,7 +93,7 @@ def test_transform_parameters(a, b): fit_output = FitFunction(values=[a, b], errors=errors, cov=np.array([[0.04, 0.02], [0.02, 0.04]]), fn=None, chi2=None, pvalue=None, infodict=None, mesg=None, ier=None) - transformed_par, transformed_err, transformed_cov = icarcomp.transform_parameters(fit_output) + transformed_par, transformed_err, transformed_cov = krf.transform_parameters(fit_output) E0_expected = np.exp(-a) s_E0_expected = np.abs(E0_expected * errors[0])