Skip to content

Commit

Permalink
Return nan in case of empty slices in edisp
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnoe committed Oct 27, 2023
1 parent 29bd509 commit 8cf972b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pyirf/benchmarks/energy_bias_resolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,13 @@ def energy_bias_resolution_from_energy_dispersion(

n_energy_bins, _, n_fov_bins = energy_dispersion.shape

bias = np.zeros((n_energy_bins, n_fov_bins))
resolution = np.zeros((n_energy_bins, n_fov_bins))
bias = np.full((n_energy_bins, n_fov_bins), np.nan)
resolution = np.full((n_energy_bins, n_fov_bins), np.nan)

for energy_bin in range(n_energy_bins):
for fov_bin in range(n_fov_bins):
if np.count_nonzero(cdf[energy_bin, :, fov_bin]) == 0:
continue

Check warning on line 145 in pyirf/benchmarks/energy_bias_resolution.py

View check run for this annotation

Codecov / codecov/patch

pyirf/benchmarks/energy_bias_resolution.py#L145

Added line #L145 was not covered by tests

low, median, high = np.interp(
[NORM_LOWER_SIGMA, MEDIAN, NORM_UPPER_SIGMA],
Expand Down

0 comments on commit 8cf972b

Please sign in to comment.