Skip to content

Commit

Permalink
[evt.modules] add xtalk corrector placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
gipert committed Apr 18, 2024
1 parent 567868e commit facde97
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions src/pygama/evt/modules/geds.py
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)
)

0 comments on commit facde97

Please sign in to comment.