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 Jan 30, 2024
1 parent 2737a8e commit 612d3fb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
24 changes: 17 additions & 7 deletions src/pygama/evt/aggregators.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


def evaluate_to_first_or_last(
cumulengths: NDArray,
cumulengths: NDArray,
idx: NDArray,
ids: NDArray,
f_hit: str,
Expand Down Expand Up @@ -87,8 +87,10 @@ def evaluate_to_first_or_last(
for ch in chns:
# get index list for this channel to be loaded
idx_ch = idx[ids == utils.get_tcm_id_by_pattern(tcm_id_table_pattern, ch)]
evt_ids_ch = np.searchsorted(cumulengths,
np.where(ids == utils.get_tcm_id_by_pattern(tcm_id_table_pattern, ch))[0])
evt_ids_ch = np.searchsorted(
cumulengths,
np.where(ids == utils.get_tcm_id_by_pattern(tcm_id_table_pattern, ch))[0],
)

# evaluate at channel
res = utils.get_data_at_channel(
Expand Down Expand Up @@ -134,12 +136,20 @@ def evaluate_to_first_or_last(
if ch == chns[0]:
outt[:] = np.inf

out[evt_ids_ch] = np.where((t0 < outt[evt_ids_ch]) & (limarr), res, out[evt_ids_ch])
outt[evt_ids_ch] = np.where((t0 < outt[evt_ids_ch]) & (limarr), t0, outt[evt_ids_ch])
out[evt_ids_ch] = np.where(
(t0 < outt[evt_ids_ch]) & (limarr), res, out[evt_ids_ch]
)
outt[evt_ids_ch] = np.where(
(t0 < outt[evt_ids_ch]) & (limarr), t0, outt[evt_ids_ch]
)

else:
out[evt_ids_ch] = np.where((t0 > outt[evt_ids_ch]) & (limarr), res, out[evt_ids_ch])
outt[evt_ids_ch] = np.where((t0 > outt[evt_ids_ch]) & (limarr), t0, outt[evt_ids_ch])
out[evt_ids_ch] = np.where(
(t0 > outt[evt_ids_ch]) & (limarr), res, out[evt_ids_ch]
)
outt[evt_ids_ch] = np.where(
(t0 > outt[evt_ids_ch]) & (limarr), t0, outt[evt_ids_ch]
)

return Array(nda=out)

Expand Down
4 changes: 3 additions & 1 deletion src/pygama/evt/build_evt.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,9 @@ def evaluate_expression(
# load TCM data to define an event
ids = store.read(f"/{tcm_group}/array_id", f_tcm)[0].view_as("np")
idx = store.read(f"/{tcm_group}/array_idx", f_tcm)[0].view_as("np")
cumulength = store.read(f"/{tcm_group}/cumulative_length", f_tcm)[0].view_as("np")
cumulength = store.read(f"/{tcm_group}/cumulative_length", f_tcm)[0].view_as(
"np"
)

# switch through modes
if table and (("keep_at_ch:" == mode[:11]) or ("keep_at_idx:" == mode[:12])):
Expand Down

0 comments on commit 612d3fb

Please sign in to comment.