From c3beb85b0a467226d0c8a3fd962daefac30aaa6e Mon Sep 17 00:00:00 2001 From: Laura Sandoval Date: Mon, 9 Sep 2024 09:17:34 -0600 Subject: [PATCH] pr response --- .../ultra/l1c/ultra_l1c_pset_bins.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/imap_processing/ultra/l1c/ultra_l1c_pset_bins.py b/imap_processing/ultra/l1c/ultra_l1c_pset_bins.py index 228b5b607..f33e7f47c 100644 --- a/imap_processing/ultra/l1c/ultra_l1c_pset_bins.py +++ b/imap_processing/ultra/l1c/ultra_l1c_pset_bins.py @@ -15,20 +15,15 @@ def build_energy_bins() -> tuple[np.ndarray, np.ndarray]: Array of energy bin end values. """ alpha = 0.05 # deltaE/E - energy_bounds = [3.5, 300] # energy bounds for the Ultra grids + energy_start = 3.5 # energy start for the Ultra grids + n_bins = 90 # number of energy bins # Calculate energy step energy_step = (1 + alpha / 2) / (1 - alpha / 2) - # Create bins. - energy_bin_start = np.array([energy_bounds[0]]) - while energy_bin_start[-1] * energy_step <= energy_bounds[-1]: - energy_bin_start = np.append( - energy_bin_start, energy_bin_start[-1] * energy_step - ) - - # Compute the end values for the bins - energy_bin_end = energy_bin_start[1:] * energy_step - energy_bin_end = np.insert(energy_bin_end, 0, energy_bounds[0] * energy_step) + # Create energy bins. + bin_edges = energy_start * energy_step ** np.arange(n_bins + 1) + energy_bin_start = bin_edges[:-1] + energy_bin_end = bin_edges[1:] return energy_bin_start, energy_bin_end