Skip to content

Commit

Permalink
Rename get_fit_function_lt to get_function_and_seed_lt
Browse files Browse the repository at this point in the history
  • Loading branch information
carhc committed Oct 14, 2024
1 parent 147bbda commit 0261c26
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions invisible_cities/reco/icaro_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ def select_fit_variables(fittype : KrFitFunction,
elif fittype is KrFitFunction.log_lin: return dst.DT, -np.log(dst.S2e)


def get_fit_function_lt(fittype : KrFitFunction):

def get_function_and_seed_lt(fittype : KrFitFunction):
'''
Retrieve the fitting function and seed function based on the
specified fittype.
Expand Down
8 changes: 4 additions & 4 deletions invisible_cities/reco/icaro_components_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ def test_select_fit_variables(sample_df):
integers(min_value = 10, max_value = 1e3),
floats (min_value = 1e3, max_value = 1e5),
floats (min_value = 5e3, max_value = 1e5))
def test_get_fit_function_lt_with_data(x_min, x_max, steps, e0, lt):
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_fit_function_lt(KrFitFunction.linear)
fit_func_expo, seed_func_expo = icarcomp.get_fit_function_lt(KrFitFunction.expo)
fit_func_log_lin, seed_func_log_lin = icarcomp.get_fit_function_lt(KrFitFunction.log_lin)
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)

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))
Expand Down

0 comments on commit 0261c26

Please sign in to comment.