Skip to content

Commit

Permalink
Refactored based on feedback: cleaner test
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobychev committed Sep 8, 2023
1 parent 6972b08 commit 4c9f681
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions ctapipe/tools/make_irf.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ class IrfTool(Tool):
classes = [CutOptimizer, DataBinning, OutputEnergyBinning, EventPreProcessor]

def make_derived_columns(self, kind, events, spectrum, target_spectrum, obs_conf):

if obs_conf["subarray_pointing_lat"].std() < 1e-3:
assert all(obs_conf["subarray_pointing_frame"] == 0)
# Lets suppose 0 means ALTAZ
Expand Down Expand Up @@ -156,19 +155,11 @@ def get_metadata(self, loader):
sim = loader.read_simulation_configuration()
show = loader.read_shower_distribution()

# These sims better have the same viewcone!
if not np.diff(sim["energy_range_max"]).sum() == 0:
raise NotImplementedError(
"Unsupported: 'energy_range_max' differs across simulation runs"
)
if not np.diff(sim["energy_range_min"]).sum() == 0:
raise NotImplementedError(
"Unsupported: 'energy_range_min' differs across simulation runs"
)
if not np.diff(sim["spectral_index"]).sum() == 0:
raise NotImplementedError(
"Unsupported: 'spectral_index' differs across simulation runs"
)
for itm in ["spectral_index", "energy_range_min", "energy_range_max"]:
if len(np.unique(sim[itm])) > 1:
raise NotImplementedError(
f"Unsupported: '{itm}' differs across simulation runs"
)

assert sim["max_viewcone_radius"].std() == 0
sim_info = SimulatedEventsInfo(
Expand Down

0 comments on commit 4c9f681

Please sign in to comment.