Skip to content

Commit

Permalink
Merge pull request #5 from sizun/update_cdts_decoding
Browse files Browse the repository at this point in the history
Update decoding of CDTS data to latests CDTS version.
  • Loading branch information
FrancaCassol authored Oct 25, 2019
2 parents 541ca6c + efdab89 commit 8590e05
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions ctapipe_io_nectarcam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,23 @@ def fill_nectarcam_event_container_from_zfile(self, event):
event_container.swat_data = event.lstcam.swat_data

# unpack CDTS data
rec_fmt = '=IIIQQBBB'
is_old_cdts = len(event.nectarcam.cdts_data) < 36
rec_fmt = '=IIIQQBBB' if is_old_cdts else '=QIIIIIBBBBI'
unpacked_cdts = struct.unpack(rec_fmt, event.nectarcam.cdts_data)
event_container.ucts_event_counter = unpacked_cdts[0]
event_container.ucts_pps_counter = unpacked_cdts[1]
event_container.ucts_clock_counter = unpacked_cdts[2]
event_container.ucts_timestamp = unpacked_cdts[3]
event_container.ucts_camera_timestamp = unpacked_cdts[4]
event_container.ucts_trigger_type = unpacked_cdts[5]
event_container.ucts_white_rabbit_status = unpacked_cdts[6]
if is_old_cdts:
event_container.ucts_event_counter = unpacked_cdts[0]
event_container.ucts_pps_counter = unpacked_cdts[1]
event_container.ucts_clock_counter = unpacked_cdts[2]
event_container.ucts_timestamp = unpacked_cdts[3]
event_container.ucts_camera_timestamp = unpacked_cdts[4]
event_container.ucts_trigger_type = unpacked_cdts[5]
event_container.ucts_white_rabbit_status = unpacked_cdts[6]
else:
event_container.ucts_timestamp = unpacked_cdts[0]
event_container.ucts_event_counter = unpacked_cdts[2]
event_container.ucts_pps_counter = unpacked_cdts[4]
event_container.ucts_clock_counter = unpacked_cdts[5]
event_container.ucts_trigger_type = unpacked_cdts[6]

def fill_r0_camera_container_from_zfile(self, container, event):

Expand Down

0 comments on commit 8590e05

Please sign in to comment.