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 Nov 20, 2023
1 parent ab48f47 commit 2807bb5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
12 changes: 7 additions & 5 deletions src/pygama/pargen/energy_optimisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -956,13 +956,15 @@ def event_selection(
guess_keV = 2620 / np.nanpercentile(rough_energy, 99)
Euc_min = threshold / guess_keV
Euc_max = 2620 / guess_keV * 1.1
dEuc = 5 / guess_keV
dEuc = 5 / guess_keV
hist, bins, var = pgh.get_hist(rough_energy, range=(Euc_min, Euc_max), dx=dEuc)
detected_peaks_locs, detected_peaks_keV, roughpars = pgc.hpge_find_E_peaks(
hist,
bins,
var,
np.array([238.632, 583.191, 727.330, 860.564, 1592.5, 1620.5, 2103.53, 2614.553]),
np.array(
[238.632, 583.191, 727.330, 860.564, 1592.5, 1620.5, 2103.53, 2614.553]
),
)
log.debug(f"detected {detected_peaks_keV} keV peaks at {detected_peaks_locs}")

Expand Down Expand Up @@ -997,9 +999,9 @@ def event_selection(
idx_list = get_wf_indexes(sort_index, idx_list_lens)
idxs = np.array(sorted(np.concatenate(masks)))

input_data = sto.read_object(
f"{lh5_path}", raw_files, idx=idxs, n_rows=len(idxs)
)[0]
input_data = sto.read_object(f"{lh5_path}", raw_files, idx=idxs, n_rows=len(idxs))[
0
]

if isinstance(dsp_config, str):
with open(dsp_config) as r:
Expand Down
8 changes: 4 additions & 4 deletions src/pygama/pargen/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,11 @@ def load_data(

out_df = pd.DataFrame(columns=params)


if isinstance(files, dict):

keys = lh5.ls(files[list(files)[0]][0], lh5_path if lh5_path[-1] == "/" else lh5_path + "/")
keys = lh5.ls(
files[list(files)[0]][0],
lh5_path if lh5_path[-1] == "/" else lh5_path + "/",
)
keys = [key.split("/")[-1] for key in keys]
if list(files)[0] in cal_dict:
params = get_params(keys + list(cal_dict[list(files)[0]].keys()), params)
Expand Down Expand Up @@ -90,7 +91,6 @@ def load_data(
df = pd.concat(df)

elif isinstance(files, list):

keys = lh5.ls(files[0], lh5_path if lh5_path[-1] == "/" else lh5_path + "/")
keys = [key.split("/")[-1] for key in keys]
params = get_params(keys + list(cal_dict.keys()), params)
Expand Down

0 comments on commit 2807bb5

Please sign in to comment.