Skip to content

Commit

Permalink
style: pre-commit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed May 7, 2024
1 parent 516efc2 commit c5b2e25
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/pygama/evt/modules/xtalk.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import numpy as np
from legendmeta.catalog import Props
from lgdo import lh5, types
from lgdo.lh5 import ls

from pygama.hit.build_hit import _remove_uneeded_operations, _reorder_table_operations

Expand Down Expand Up @@ -264,7 +263,7 @@ def calibrate_energy(
par_files: str | list[str],
uncal_energy_var: str = None,
recal_energy_var: str = None,
):
):
"""
Function to recalibrate the energy
Parameters
Expand All @@ -288,21 +287,20 @@ def calibrate_energy(
pars = {
chan: chan_dict["pars"]["operations"] for chan, chan_dict in par_dicts.items()
}

p = uncal_energy_var.split(".")
tier = p[0] if len(p) > 1 else "dsp"

table_fmt = datainfo._asdict()[tier].table_fmt
file = datainfo._asdict()[tier].file


for i, chan in enumerate(xtalk_matrix_rawids):
try:
cfg = pars[f"ch{chan}"]
cfg, chan_inputs = _remove_uneeded_operations(
_reorder_table_operations(cfg), recal_energy_var.split(".")[-1]
)

chan_inputs.remove(uncal_energy_var.split(".")[-1])

# get the event indices
Expand All @@ -311,8 +309,9 @@ def calibrate_energy(

# read the dsp data
outtbl_obj = lh5.read(
f"ch{chan}/dsp/", file,idx=idx_events ,field_mask=chan_inputs)

f"ch{chan}/dsp/", file, idx=idx_events, field_mask=chan_inputs
)

# add the uncalibrated energy to the table
outtbl_obj.add_column(
uncal_energy_var.split(".")[-1],
Expand Down

0 comments on commit c5b2e25

Please sign in to comment.