Skip to content

Commit

Permalink
only apply transformation to sims data
Browse files Browse the repository at this point in the history
  • Loading branch information
TjarkMiener committed Nov 26, 2024
1 parent ab5255a commit 473f82e
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions dl1_data_handler/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,10 @@ def __init__(
self._construct_stereo_example_identifiers()

# Transform true energy into the log space
self.example_identifiers = self._transform_to_log_energy(
self.example_identifiers
)
if self.process_type == ProcessType.Simulation:
self.example_identifiers = self._transform_to_log_energy(
self.example_identifiers
)

# Handling the class weights calculation.
# Scaling by total/2 helps keep the loss to a similar magnitude.
Expand Down Expand Up @@ -438,23 +439,24 @@ def _construct_mono_example_identifiers(self):

# Construct the example identifiers
events.keep_columns(self.example_ids_keep_columns)
tel_pointing = self._get_tel_pointing(f, self.tel_ids)
events = join(
left=events,
right=tel_pointing,
keys=["obs_id", "tel_id"],
)
events = self._transform_to_spherical_offsets(events)
if self.process_type == ProcessType.Simulation:
tel_pointing = self._get_tel_pointing(f, self.tel_ids)
events = join(
left=events,
right=tel_pointing,
keys=["obs_id", "tel_id"],
)
events = self._transform_to_spherical_offsets(events)
# Add the true shower primary class to the table based on the filename is
# signal or background input file list
true_shower_primary_class = 1 if filename in self.input_url_signal else 0
events.add_column(
true_shower_primary_class, name="true_shower_primary_class"
)
# Add telescope type id which is always 0 in mono mode
# This is needed to share code with stereo reading mode later on
events.add_column(file_idx, name="file_index", index=0)
events.add_column(0, name="tel_type_id", index=3)
# Add the true shower primary class to the table based on the filename is
# signal or background input file list
true_shower_primary_class = 1 if filename in self.input_url_signal else 0
events.add_column(
true_shower_primary_class, name="true_shower_primary_class"
)
# Appending the events to the list of example identifiers
example_identifiers.append(events)

Expand Down Expand Up @@ -584,10 +586,11 @@ def _multiplicity_cut_subarray(table, key_colnames):
events.add_column(file_idx, name="file_index", index=0)
# Add the true shower primary class to the table based on the filename is
# signal or background input file list
true_shower_primary_class = 1 if filename in self.input_url_signal else 0
events.add_column(
true_shower_primary_class, name="true_shower_primary_class"
)
if self.process_type == ProcessType.Simulation:
true_shower_primary_class = 1 if filename in self.input_url_signal else 0
events.add_column(
true_shower_primary_class, name="true_shower_primary_class"
)
# Appending the events to the list of example identifiers
example_identifiers.append(events)

Expand Down

0 comments on commit 473f82e

Please sign in to comment.