Skip to content

Commit

Permalink
fix stereo reading
Browse files Browse the repository at this point in the history
obs and event ids can be equal for protons and gammas; if they end up in the same batch the code break; this is fixing the issue by grouping also by particle type for simulation
  • Loading branch information
TjarkMiener committed Feb 6, 2025
1 parent ac5e7dd commit dd5f03a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dl1_data_handler/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,10 @@ def generate_stereo_batch(self, batch_indices) -> Table:
# Append the features from child classes to the batch
batch = self._append_features(batch)
# Add blank inputs for missing telescopes in the batch
batch_grouped = batch.group_by(["obs_id", "event_id"])
if self.process_type == ProcessType.Simulation:
batch_grouped = batch.group_by(["obs_id", "event_id", "true_shower_primary_class"])
elif self.process_type == ProcessType.Observation:
batch_grouped = batch.group_by(["obs_id", "event_id"])
for group_element in batch_grouped.groups:
for tel_type_id, tel_type in enumerate(self.selected_telescopes):
if "features" in group_element.colnames:
Expand Down

0 comments on commit dd5f03a

Please sign in to comment.