Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct elife for cs2_wo_timecorr #1260

Merged
merged 1 commit into from
Sep 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions straxen/plugins/events/corrected_areas.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CorrectedAreas(strax.Plugin):
cs2_top and cs2_bottom are corrected by the corresponding maps,
and cs2 is the sum of the two.
"""
__version__ = '0.5.0'
__version__ = '0.5.1'

depends_on = ['event_basics', 'event_positions']

Expand Down Expand Up @@ -104,6 +104,11 @@ def infer_dtype(self):
for i, name in enumerate(names):
if i == len(names) - 1:
description = ''
elif i == 0:
# special treatment for wo_timecorr, apply elife correction
description = ' (before ' + ' + '.join(descriptions[i + 1:-1])
dachengx marked this conversation as resolved.
Show resolved Hide resolved
description += ', after ' + ' + '.join(
descriptions[:i + 1] + descriptions[-1:]) + ')'
else:
description = ' (before ' + ' + '.join(descriptions[i + 1:])
description += ', after ' + ' + '.join(descriptions[:i + 1]) + ')'
Expand Down Expand Up @@ -219,9 +224,9 @@ def compute(self, events):
seg_ee_corr[partition_mask] = seg[partition] / avg_seg[partition] * ee[partition]

# apply S2 xy correction
result[f"{peak_type}cs2_wo_timecorr"] = cs2_top_xycorr + cs2_bottom_xycorr
result[f"{peak_type}cs2_area_fraction_top_wo_timecorr"] = (
cs2_top_xycorr / result[f"{peak_type}cs2_wo_timecorr"])
cs2_xycorr = cs2_top_xycorr + cs2_bottom_xycorr
result[f"{peak_type}cs2_wo_timecorr"] = cs2_xycorr * elife_correction
result[f"{peak_type}cs2_area_fraction_top_wo_timecorr"] = cs2_top_xycorr / cs2_xycorr

# apply SEG and EE correction
cs2_top_wo_picorr = cs2_top_xycorr / seg_ee_corr
Expand Down
Loading