Skip to content

Commit

Permalink
Merge pull request #840 from cta-observatory/correct_ucts_jumps
Browse files Browse the repository at this point in the history
Correct number of ucts jumps
  • Loading branch information
moralejo authored Jan 3, 2022
2 parents cf5bfe7 + 8e10263 commit 7095079
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lstchain/datachecks/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,15 @@ def fill_event_wise_info(self, subrun_index, table, mask, geom,
self.trigger_type = \
count_trig_types(table['trigger_type'][mask])
if 'ucts_jump' in table.columns:
self.num_ucts_jumps = np.sum(table['ucts_jump'][mask])
# After one (or n) genuine UCTS jumps in a run, the first event (or n events)
# of every subsequent subrun file (if analyzed on its own) will have ucts_jump=True,
# but these are not new jumps, just the ones from previous subruns, so they should
# not be counted.
uj = table['ucts_jump']
# find the first False value, and set to False also all the earlier ones:
first_non_jump = np.where(uj==False)[0][0]
uj[:first_non_jump] = False
self.num_ucts_jumps = np.sum(uj[mask])
self.mean_alt_tel = np.mean(table['alt_tel'])
self.mean_az_tel = np.mean(table['az_tel'])

Expand Down
2 changes: 2 additions & 0 deletions lstchain/scripts/longterm_dl1_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,8 @@ def plot(filename='longterm_dl1_check.h5', batch=False, tel_id=1):
log.info('Attention: UCTS jumps were detected and corrected:')
for run, njumps in zip(runsummary['runnumber'],
runsummary['num_ucts_jumps']):
if njumps == 0:
continue
log.info(f' Run {run}: {njumps} jumps')
log.info('')

Expand Down

0 comments on commit 7095079

Please sign in to comment.