Skip to content

Commit

Permalink
add recovery cut code
Browse files Browse the repository at this point in the history
  • Loading branch information
ggmarshall committed Apr 24, 2024
1 parent 9283a45 commit 0143440
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/pygama/evt/modules/geds.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,30 @@

from .. import utils

import numpy as np

def apply_recovery_cut(
datainfo: utils.DataInfo,
tcm: utils.TCMData,
table_names: Sequence[str],
*,
timestamps: types.Array,
flag: types.Array,
time_window: float,
) -> types.Array:

discharge_timestamps = timestamps.nda[flag.nda == 1]
is_recovering = np.full(len(timestamps.nda), False)
for tstamp in discharge_timestamps:
is_recovering = is_recovering | np.where((((timestamps.nda - tstamp)<time_window) &
((timestamps.nda - tstamp)>0))
, True, False)

# return the result as LGDO
return types.Array(
is_recovering
)


def apply_xtalk_correction(
datainfo: utils.DataInfo,
Expand Down

0 comments on commit 0143440

Please sign in to comment.