From 69ce566f95dd3c97f8e601f95de073ff5b27e143 Mon Sep 17 00:00:00 2001 From: Philipp Oleynik <pholey@utu.fi> Date: Fri, 4 Oct 2024 14:38:53 +0300 Subject: [PATCH] Fixed error in the grid filtering. --- bowtie.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bowtie.py b/bowtie.py index 97d0937..ed58608 100644 --- a/bowtie.py +++ b/bowtie.py @@ -189,7 +189,9 @@ def calculate_bowtie_gf(response_data, sigma=3, plot=False, gfactor_confidence_level=0.9, - return_gf_stddev=False): + return_gf_stddev=False, + gmin=1E-5, + gmax=10): """ Calculates the bowtie geometric factor for a single channel :param return_gf_box: True if the margin of the channel geometric factor is requested. @@ -237,7 +239,7 @@ def calculate_bowtie_gf(response_data, # Mathematically, this implies normalization of the random variable to its mean. non_zero_gf = np.mean(multi_geometric_factors, axis=0) > 0 multi_geometric_factors_usable = multi_geometric_factors[:, non_zero_gf] - print(len(multi_geometric_factors), len(multi_geometric_factors_usable)) + # print(len(multi_geometric_factors), len(multi_geometric_factors_usable)) means = np.exp(np.mean(np.log(multi_geometric_factors_usable), axis=0)) # logarithmic mean of geometric factor curves by energy bin gf_stddev_abs = np.std(multi_geometric_factors_usable, axis=0) @@ -269,11 +271,11 @@ def calculate_bowtie_gf(response_data, # gf_cross = gf[bowtie_cross_index] # The mean geometric factor for the bowtie crossing point gf_cross = geometric_mean(multi_geometric_factors_usable[:, bowtie_cross_index]) - energy_cross = energy_grid_local[bowtie_cross_index] + energy_cross = energy_grid_local[non_zero_gf][bowtie_cross_index] if plot: plot_multi_geometric(geometric_factors=multi_geometric_factors, response_data=response_data, - emin=emin, emax=emax, gmin=1E-5, gmax=10) + emin=emin, emax=emax, gmin=gmin, gmax=gmax) if return_gf_stddev: gf_upper = np.quantile(multi_geometric_factors_usable[:, bowtie_cross_index], gfactor_confidence_level) -- GitLab