-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[evt.modules] add xtalk corrector placeholder
- Loading branch information
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
"""Event processors for HPGe data.""" | ||
|
||
from __future__ import annotations | ||
|
||
from collections.abc import Sequence | ||
|
||
from lgdo import lh5, types | ||
|
||
from .. import utils | ||
|
||
|
||
def apply_xtalk_correction( | ||
datainfo: utils.DataInfo, | ||
tcm: utils.TCMData, | ||
table_names: Sequence[str], | ||
*, | ||
energy_observable: types.VectorOfVectors, | ||
rawids: types.VectorOfVectors, | ||
xtalk_matrix_filename: str, | ||
) -> types.VectorOfVectors: | ||
"""Applies the cross-talk correction to the energy observable. | ||
The format of `xtalk_matrix_filename` should be... | ||
Parameters | ||
---------- | ||
datainfo, tcm, table_names | ||
positional arguments automatically supplied by :func:`.build_evt`. | ||
energy_observable | ||
array of energy values to correct, one event per row. The detector | ||
identifier is stored in `rawids`, which has the same layout. | ||
rawids | ||
array of detector identifiers for each energy in `energy_observable`. | ||
xtalk_matrix_filename | ||
name of the file containing the cross-talk matrices. | ||
""" | ||
# read in xtalk matrices | ||
lh5.read_as("", xtalk_matrix_filename, "ak") | ||
|
||
# do the correction | ||
energies_corr = ... | ||
|
||
# return the result as LGDO | ||
return types.VectorOfVectors( | ||
energies_corr, attrs=utils.copy_lgdo_attrs(energy_observable) | ||
) |