Skip to content

Commit

Permalink
Rename variable
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnoe committed Dec 18, 2024
1 parent 81654b1 commit 16b6e2f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pyirf/cut_optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,10 @@ def optimize_cuts(
background['reco_energy'], reco_energy_bins,
)

gh_cut_grid = []
theta_cut_grid = []

with tqdm(total=n_cuts, disable=not progress) as bar:
all_the_gh_cuts = []
all_the_theta_cuts = []
for multiplicity_index, multiplicity_cut in enumerate(multiplicity_cuts):

signal_mask_multiplicity = signal['multiplicity'] >= multiplicity_cut
Expand All @@ -100,7 +101,7 @@ def optimize_cuts(
fill_value=fill_value,
percentile=gh_cut_percentiles,
)
all_the_gh_cuts.append(gh_cuts)
gh_cut_grid.append(gh_cuts)

theta_cuts = calculate_percentile_cut(
signal['theta'][signal_mask_multiplicity],
Expand All @@ -111,7 +112,7 @@ def optimize_cuts(
min_value=0.02 * u.deg,
percentile=100 * theta_cut_efficiencies,
)
all_the_theta_cuts.append(theta_cuts)
theta_cut_grid.append(theta_cuts)


for gh_index, theta_index in product(range(n_gh_cuts), range(n_theta_cuts)):
Expand Down Expand Up @@ -194,9 +195,9 @@ def optimize_cuts(

best_sensitivity[bin_id] = sensitivities[best][bin_id]

best_gh_cut["cut"][bin_id] = all_the_gh_cuts[multiplicity_index]["cut"][bin_id][gh_index]
best_gh_cut["cut"][bin_id] = gh_cut_grid[multiplicity_index]["cut"][bin_id][gh_index]
best_multiplicity_cut["cut"][bin_id] = multiplicity_cuts[multiplicity_index]
best_theta_cut["cut"][bin_id] = all_the_theta_cuts[multiplicity_index]["cut"][bin_id][theta_index]
best_theta_cut["cut"][bin_id] = theta_cut_grid[multiplicity_index]["cut"][bin_id][theta_index]

best_gh_cut["efficiency"][bin_id] = gh_cut_efficiencies[gh_index]
best_theta_cut["efficiency"][bin_id] = theta_cut_efficiencies[theta_index]
Expand Down

0 comments on commit 16b6e2f

Please sign in to comment.