Commit 7a6c70a6 authored by Alessio Berti's avatar Alessio Berti
Browse files

Add some documentation to method finding stereo events.

parent 4c347b7c
Pipeline #90241 failed with stage
in 8 minutes and 21 seconds
......@@ -1357,11 +1357,15 @@ class MarsRun:
stereo_m1_data = self.event_data['M1']['stereo_event_number'][np.where(self.event_data['M1']['trigger_pattern'] == DATA_TRIGGER_PATTERN)]
stereo_m2_data = self.event_data['M2']['stereo_event_number'][np.where(self.event_data['M2']['trigger_pattern'] == DATA_TRIGGER_PATTERN)]
# find common values between M1 and M2 stereo events, see https://numpy.org/doc/stable/reference/generated/numpy.intersect1d.html
stereo_numbers = np.intersect1d(stereo_m1_data, stereo_m2_data)
# find indices of the stereo event numbers in original stereo event numbers arrays, see
# https://stackoverflow.com/questions/12122639/find-indices-of-a-list-of-values-in-a-numpy-array
m1_ids = np.searchsorted(self.event_data['M1']['stereo_event_number'], stereo_numbers)
m2_ids = np.searchsorted(self.event_data['M2']['stereo_event_number'], stereo_numbers)
# make list of tuples, see https://stackoverflow.com/questions/2407398/how-to-merge-lists-into-a-list-of-tuples
stereo_ids = list(zip(m1_ids, m2_ids))
else:
stereo_m1_data = self.event_data['M1']['stereo_event_number'][np.where(self.event_data['M1']['trigger_pattern'] == MC_TRIGGER_PATTERN)]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment