Skip to content

Commit

Permalink
Generating and using self.event_dus_indices for getting this event's …
Browse files Browse the repository at this point in the history
…DUs data from TRun
  • Loading branch information
lwpiotr committed Feb 6, 2024
1 parent 98bb7bc commit 0dd0917
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions grand/sim/efield2voltage.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,12 @@ def get_event(self, event_idx=None, event_number=None, run_number=None):
# stack efield traces
trace_shape = np.asarray(self.events.trace).shape # (nb_du, 3, tbins of a trace)
self.du_id = np.asarray(self.events.du_id) # used for printing info and saving in voltage tree.
self.event_dus_indices = self.events.get_dus_indices_in_run(self.run)
self.nb_du = trace_shape[0]
self.sig_size = trace_shape[-1]
self.traces = np.asarray(self.events.trace, dtype=np.float32) # x,y,z components are stored in events.trace. shape (nb_du, 3, tbins)
self.du_pos = np.asarray(self.run.du_xyz) # (nb_du, 3) antenna position wrt local grand coordinate
# self.du_pos = np.asarray(self.run.du_xyz) # (nb_du, 3) antenna position wrt local grand coordinate
self.du_pos = np.asarray(self.run.du_xyz)[self.event_dus_indices] # (nb_du, 3) antenna position wrt local grand coordinate

# shower information like theta, phi, xmax etc for one event.
shower = ShowerEvent()
Expand All @@ -129,7 +131,8 @@ def get_event(self, event_idx=None, event_number=None, run_number=None):
self.evt_shower = shower # Note that 'shower' is an instance of 'self.shower' for one event.
logger.info(f"shower origin in Geodetic: {self.run.origin_geoid}")

self.dt_ns = np.asarray(self.run.t_bin_size) # sampling time in ns, sampling freq = 1e9/dt_ns. #MATIAS: Why cast this to an array if it is a constant?
# self.dt_ns = np.asarray(self.run.t_bin_size) # sampling time in ns, sampling freq = 1e9/dt_ns. #MATIAS: Why cast this to an array if it is a constant?
self.dt_ns = np.asarray(self.run.t_bin_size)[self.event_dus_indices] # sampling time in ns, sampling freq = 1e9/dt_ns. #MATIAS: Why cast this to an array if it is a constant?
self.f_samp_mhz = 1e3/self.dt_ns # MHz #MATIAS: this gets casted too!
# comupte time samples in ns for all antennas in event with index event_idx.
self.time_samples = self.get_time_samples() # t_samples.shape = (nb_du, self.sig_size)
Expand Down

0 comments on commit 0dd0917

Please sign in to comment.