Skip to content

Commit

Permalink
Fixed coordinates to (3,) dim and traces to proper ordering when fill…
Browse files Browse the repository at this point in the history
…ing the trees
  • Loading branch information
lwpiotr committed Sep 19, 2024
1 parent 747e4d8 commit 064fe52
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions grand/grandlib_classes/grandlib_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ def fill_run_tree(self, overwrite=False, filename=None):
self.trun.site = self.site
# self.trun.site_long = self.site_long
# self.trun.site_lat = self.site_lat
self.trun.origin_geoid = self.origin_geoid
self.trun.origin_geoid = self.origin_geoid[:,0]
self.trun.t_bin_size = self._t_bin_size

# Fill the tree with values
Expand Down Expand Up @@ -943,7 +943,8 @@ def fill_voltage_tree(self, overwrite=False, filename=None):
self.tvoltage.du_id = [v.du_id for v in self.voltages]

# Remark: best to set list. Append will append to the previous event, since it is not cleared automatically
self.tvoltage.trace = [[np.array(v.trace.x).astype(np.float32), np.array(v.trace.y).astype(np.float32), np.array(v.trace.z).astype(np.float32)] for v in self.voltages]
# self.tvoltage.trace = [[np.array(v.trace.x).astype(np.float32), np.array(v.trace.y).astype(np.float32), np.array(v.trace.z).astype(np.float32)] for v in self.voltages]
self.tvoltage.trace = [v.trace for v in self.voltages]
# self.tvoltage.trace_x = [np.array(v.trace.y).astype(np.float32) for v in self.voltages]
# self.tvoltage.trace_y = [np.array(v.trace.y).astype(np.float32) for v in self.voltages]
# self.tvoltage.trace_z = [np.array(v.trace.z).astype(np.float32) for v in self.voltages]
Expand Down Expand Up @@ -990,7 +991,8 @@ def fill_efield_tree(self, overwrite=False, filename=None):
self.tefield.du_id = [v.du_id for v in self.voltages]

# Remark: best to set list. Append will append to the previous event, since it is not cleared automatically
self.tefield.trace = [[np.array(v.trace.x).astype(np.float32) for v in self.efields], [np.array(v.trace.y).astype(np.float32) for v in self.efields], [np.array(v.trace.z).astype(np.float32) for v in self.efields]]
# self.tefield.trace = [[np.array(v.trace.x).astype(np.float32) for v in self.efields], [np.array(v.trace.y).astype(np.float32) for v in self.efields], [np.array(v.trace.z).astype(np.float32) for v in self.efields]]
self.tefield.trace = [v.trace for v in self.efields]
# self.tefield.trace_x = [np.array(v.trace.x).astype(np.float32) for v in self.efields]
# self.tefield.trace_y = [np.array(v.trace.y).astype(np.float32) for v in self.efields]
# self.tefield.trace_z = [np.array(v.trace.z).astype(np.float32) for v in self.efields]
Expand Down Expand Up @@ -1029,13 +1031,13 @@ def fill_shower_tree(self, overwrite=False, filename=None, tree_name="tshower"):
## Shower Xmax [g/cm2]
self.tshower.xmax_grams = self.shower.Xmax
## Shower position in the site's reference frame
self.tshower.xmax_pos = self.shower.Xmaxpos
self.tshower.xmax_pos = self.shower.Xmaxpos[:,0]
## Shower azimuth
self.tshower.azimuth = self.shower.azimuth
## Shower zenith
self.tshower.zenith = self.shower.zenith
## Poistion of the core on the ground in the site's reference frame
self.tshower.shower_core_pos = self.shower.core_ground_pos
self.tshower.shower_core_pos = self.shower.core_ground_pos[:,0]

self.tshower.fill()

Expand Down

0 comments on commit 064fe52

Please sign in to comment.