diff --git a/bowtie.py b/bowtie.py index 97d09374c999685bf495a984fd95009a2f8e3567..ed5860806e4b1f54e7431d560f255795a1034295 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)