legend-dataflow-scripts 0.1.4__py3-none-any.whl → 0.1.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {legend_dataflow_scripts-0.1.4.dist-info → legend_dataflow_scripts-0.1.5.dist-info}/METADATA +1 -1
- {legend_dataflow_scripts-0.1.4.dist-info → legend_dataflow_scripts-0.1.5.dist-info}/RECORD +12 -12
- legenddataflowscripts/_version.py +2 -2
- legenddataflowscripts/par/geds/dsp/eopt.py +4 -1
- legenddataflowscripts/par/geds/hit/aoe.py +1 -0
- legenddataflowscripts/par/geds/hit/ecal.py +36 -11
- legenddataflowscripts/par/geds/hit/lq.py +4 -3
- legenddataflowscripts/utils/alias_table.py +5 -3
- legenddataflowscripts/utils/convert_np.py +1 -1
- {legend_dataflow_scripts-0.1.4.dist-info → legend_dataflow_scripts-0.1.5.dist-info}/WHEEL +0 -0
- {legend_dataflow_scripts-0.1.4.dist-info → legend_dataflow_scripts-0.1.5.dist-info}/entry_points.txt +0 -0
- {legend_dataflow_scripts-0.1.4.dist-info → legend_dataflow_scripts-0.1.5.dist-info}/top_level.txt +0 -0
{legend_dataflow_scripts-0.1.4.dist-info → legend_dataflow_scripts-0.1.5.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: legend-dataflow-scripts
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
4
4
|
Summary: Python package for the processing scripts for LEGEND-200 data
|
|
5
5
|
Author-email: George Marshall <ggmarsh@uw.edu>, Luigi Pertoldi <gipert@pm.me>
|
|
6
6
|
Maintainer: The LEGEND Collaboration
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
legenddataflowscripts/__init__.py,sha256=hlpvTxSBjOyXlZUyOyYx3VwT5LS6zNzhAZnTmfT3NjU,303
|
|
2
|
-
legenddataflowscripts/_version.py,sha256=
|
|
2
|
+
legenddataflowscripts/_version.py,sha256=Y4jy4bEMmwl_qNPCmiMFnlQ2ofMoqyG37hp8uwI3m10,511
|
|
3
3
|
legenddataflowscripts/par/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
legenddataflowscripts/par/geds/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
legenddataflowscripts/par/geds/dsp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
legenddataflowscripts/par/geds/dsp/dplms.py,sha256=OOvnN_OcU046zhuyNTGxcmGYLCZ7YseK4rNyMDaRsC4,5314
|
|
7
|
-
legenddataflowscripts/par/geds/dsp/eopt.py,sha256=
|
|
7
|
+
legenddataflowscripts/par/geds/dsp/eopt.py,sha256=jmljkIPamz-L1lX8kEqSdmRuZJ-a9---9Qj-1ACghNQ,13792
|
|
8
8
|
legenddataflowscripts/par/geds/dsp/evtsel.py,sha256=qheFqGezjRxW9UNf9DV1n8VuZjCLGZT-WaWyhrfgPJ4,16485
|
|
9
9
|
legenddataflowscripts/par/geds/dsp/nopt.py,sha256=K7R4OBfO0wek03VvhBoYXDP7lURi_Xoph9Kb3iMkfx4,4263
|
|
10
10
|
legenddataflowscripts/par/geds/dsp/pz.py,sha256=sucYUtsgWKYtR-GbmRh5b61EYHqNRMWGckD3DJdHUvs,8273
|
|
11
11
|
legenddataflowscripts/par/geds/dsp/svm.py,sha256=eDneRB_PQZp8Q4n2VheTX3kbu4ufZQ-jnuCCjvtwFpk,826
|
|
12
12
|
legenddataflowscripts/par/geds/dsp/svm_build.py,sha256=8K0NUpQqL2HUWRKjMpM5H-TienVPUzIuKED94ZZnIzA,2227
|
|
13
13
|
legenddataflowscripts/par/geds/hit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
-
legenddataflowscripts/par/geds/hit/aoe.py,sha256=
|
|
15
|
-
legenddataflowscripts/par/geds/hit/ecal.py,sha256=
|
|
16
|
-
legenddataflowscripts/par/geds/hit/lq.py,sha256=
|
|
14
|
+
legenddataflowscripts/par/geds/hit/aoe.py,sha256=lkA7cgSRdyDt58AYOIuPoCBxiClVJU-6wwYSImpdVFg,11413
|
|
15
|
+
legenddataflowscripts/par/geds/hit/ecal.py,sha256=rSXV6t4olwxW0SVHlBgQDQH9xyndS329XT-0YxmgvZE,27125
|
|
16
|
+
legenddataflowscripts/par/geds/hit/lq.py,sha256=TW3vu0UFYgQz2-vrb_ic8ghIpe3ukKMF4Kt-iFP7VAQ,11346
|
|
17
17
|
legenddataflowscripts/par/geds/hit/qc.py,sha256=16RWhybvnODv4dUuSkO6EDtPvJJJmeFwFaPTgS9N7cs,12746
|
|
18
18
|
legenddataflowscripts/tier/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
19
|
legenddataflowscripts/tier/dsp.py,sha256=J_ABEqbQurZHJOg8LV2aporNjZQpPg2bDZG6DkmuAL4,8633
|
|
20
20
|
legenddataflowscripts/tier/hit.py,sha256=-LCfsqYAYPAuN2OKbPuh4G2P5B4uA4YmQGcqUtbZxis,4989
|
|
21
21
|
legenddataflowscripts/utils/__init__.py,sha256=NPpxqapio8CeQIbG8gYnz-OPoUbOlDT6tjXV-lJrKWc,426
|
|
22
|
-
legenddataflowscripts/utils/alias_table.py,sha256=
|
|
22
|
+
legenddataflowscripts/utils/alias_table.py,sha256=JL59O4p1MX4kTb1YVa3Md8Bc6H7GvuWsDOb5I7qb6EA,809
|
|
23
23
|
legenddataflowscripts/utils/cfgtools.py,sha256=_1yxw_eJ08AihONhJ9sWet5HQZpOagj8Yg8y9LS3zX4,381
|
|
24
|
-
legenddataflowscripts/utils/convert_np.py,sha256=
|
|
24
|
+
legenddataflowscripts/utils/convert_np.py,sha256=qw-pX9345lhzLAwERLjEJtnikzAWWIeD9lyDre2n9P0,853
|
|
25
25
|
legenddataflowscripts/utils/log.py,sha256=5v8J7PZJHHoSy12w9e9DkYmqdPvYXj6YfVaMbhvX614,2230
|
|
26
26
|
legenddataflowscripts/utils/plot_dict.py,sha256=-wfJC5U9OTE1Asazz64kT5Ta008w6UJmDSsr3YAubRM,449
|
|
27
27
|
legenddataflowscripts/utils/pulser_removal.py,sha256=kuARdp1jf-lsUWcb0_KRDp-ZXzkHNrDCXUc3h7TJm7Q,424
|
|
@@ -30,8 +30,8 @@ legenddataflowscripts/workflow/execenv.py,sha256=O6Z6EH6Yp0JXnwX2wTzduHC9Q9gu-_d
|
|
|
30
30
|
legenddataflowscripts/workflow/filedb.py,sha256=rbvOcXUxLbHz177QuDIDAL3aysz-bZDjHOiMsRHssZo,3434
|
|
31
31
|
legenddataflowscripts/workflow/pre_compile_catalog.py,sha256=cEK0KXh-ClSE2Bo9MK471o79XG22bMY5r-2tIihtCfk,790
|
|
32
32
|
legenddataflowscripts/workflow/utils.py,sha256=eKE8KIG2ffynZt9fTbI1SVQV85i3aW9GFGh1Nio1iDo,3118
|
|
33
|
-
legend_dataflow_scripts-0.1.
|
|
34
|
-
legend_dataflow_scripts-0.1.
|
|
35
|
-
legend_dataflow_scripts-0.1.
|
|
36
|
-
legend_dataflow_scripts-0.1.
|
|
37
|
-
legend_dataflow_scripts-0.1.
|
|
33
|
+
legend_dataflow_scripts-0.1.5.dist-info/METADATA,sha256=UEMkX19Dv7tt9enMDsF0BMFUNdq-3_v8Vsa7IAb2DG4,3122
|
|
34
|
+
legend_dataflow_scripts-0.1.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
35
|
+
legend_dataflow_scripts-0.1.5.dist-info/entry_points.txt,sha256=B197waSm-orA_ZS-9rkxNDsmOHdCn8CbWodnlqXQKRg,1313
|
|
36
|
+
legend_dataflow_scripts-0.1.5.dist-info/top_level.txt,sha256=s8E2chjJNYUbrN6whFG_VCsJKySFp1IOXLcUefA7DB0,22
|
|
37
|
+
legend_dataflow_scripts-0.1.5.dist-info/RECORD,,
|
|
@@ -23,7 +23,10 @@ from pygama.pargen.dsp_optimize import (
|
|
|
23
23
|
from ....utils import build_log
|
|
24
24
|
|
|
25
25
|
warnings.filterwarnings(action="ignore", category=RuntimeWarning)
|
|
26
|
-
|
|
26
|
+
try:
|
|
27
|
+
warnings.filterwarnings(action="ignore", category=np.exceptions.RankWarning)
|
|
28
|
+
except AttributeError: # np < 2
|
|
29
|
+
warnings.filterwarnings(action="ignore", category=np.RankWarning)
|
|
27
30
|
|
|
28
31
|
|
|
29
32
|
def par_geds_dsp_eopt() -> None:
|
|
@@ -33,7 +33,10 @@ mpl.use("agg")
|
|
|
33
33
|
sto = lh5.LH5Store()
|
|
34
34
|
|
|
35
35
|
warnings.filterwarnings(action="ignore", category=RuntimeWarning)
|
|
36
|
-
|
|
36
|
+
try:
|
|
37
|
+
warnings.filterwarnings(action="ignore", category=np.exceptions.RankWarning)
|
|
38
|
+
except AttributeError: # np < 2
|
|
39
|
+
warnings.filterwarnings(action="ignore", category=np.RankWarning)
|
|
37
40
|
|
|
38
41
|
|
|
39
42
|
def plot_2614_timemap(
|
|
@@ -485,7 +488,7 @@ def par_geds_hit_ecal() -> None:
|
|
|
485
488
|
msg = "invalid tier"
|
|
486
489
|
raise ValueError(msg)
|
|
487
490
|
|
|
488
|
-
build_log(config_dict, args.log)
|
|
491
|
+
log = build_log(config_dict, args.log)
|
|
489
492
|
|
|
490
493
|
chmap = LegendMetadata(args.metadata).channelmap(
|
|
491
494
|
args.timestamp, system=args.datatype
|
|
@@ -575,14 +578,23 @@ def par_geds_hit_ecal() -> None:
|
|
|
575
578
|
):
|
|
576
579
|
e_uncal = data.query(selection_string)[energy_param].to_numpy()
|
|
577
580
|
|
|
578
|
-
|
|
579
|
-
e_uncal[
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
581
|
+
if len(e_uncal) > 0:
|
|
582
|
+
if isinstance(e_uncal[0], np.ndarray | list):
|
|
583
|
+
e_uncal = np.concatenate([arr for arr in e_uncal if len(arr) > 0])
|
|
584
|
+
hist, bins, _ = pgh.get_hist(
|
|
585
|
+
e_uncal[
|
|
586
|
+
(e_uncal > np.nanpercentile(e_uncal, 95))
|
|
587
|
+
& (e_uncal < np.nanpercentile(e_uncal, 99.9))
|
|
588
|
+
],
|
|
589
|
+
dx=1,
|
|
590
|
+
range=[
|
|
591
|
+
np.nanpercentile(e_uncal, 95),
|
|
592
|
+
np.nanpercentile(e_uncal, 99.9),
|
|
593
|
+
],
|
|
594
|
+
)
|
|
595
|
+
else:
|
|
596
|
+
msg = f"e_uncal should not be empty! energy_param: {energy_param}"
|
|
597
|
+
raise ValueError(msg)
|
|
586
598
|
|
|
587
599
|
guess = 2614.511 / bins[np.nanargmax(hist)]
|
|
588
600
|
full_object_dict[cal_energy_param] = HPGeCalibration(
|
|
@@ -644,8 +656,21 @@ def par_geds_hit_ecal() -> None:
|
|
|
644
656
|
interp_energy_kev={"Qbb": 2039.0},
|
|
645
657
|
)
|
|
646
658
|
|
|
659
|
+
energy = data[energy_param].to_numpy()
|
|
660
|
+
if isinstance(energy[0], np.ndarray | list):
|
|
661
|
+
energy = np.concatenate(energy)
|
|
662
|
+
|
|
663
|
+
if len(energy) < len(data):
|
|
664
|
+
log.warning("len(energy) and len(data) are not the same")
|
|
665
|
+
energy = np.pad(
|
|
666
|
+
energy, (0, len(data) - len(energy)), constant_values=np.nan
|
|
667
|
+
)
|
|
668
|
+
|
|
669
|
+
if len(data) < len(energy):
|
|
670
|
+
energy = energy[: len(data)]
|
|
671
|
+
|
|
647
672
|
data[cal_energy_param] = nb_poly(
|
|
648
|
-
|
|
673
|
+
energy, full_object_dict[cal_energy_param].pars
|
|
649
674
|
)
|
|
650
675
|
|
|
651
676
|
results_dict[cal_energy_param] = get_results_dict(
|
|
@@ -295,7 +295,7 @@ def par_geds_hit_lq() -> None:
|
|
|
295
295
|
|
|
296
296
|
data["run_timestamp"] = args.timestamp
|
|
297
297
|
|
|
298
|
-
out_dicts,
|
|
298
|
+
out_dicts, results_dicts, plot_dicts, lq_dict = run_lq_calibration(
|
|
299
299
|
data,
|
|
300
300
|
cal_dicts={args.timestamp: cal_dict},
|
|
301
301
|
results_dicts={args.timestamp: eres_dict},
|
|
@@ -305,12 +305,13 @@ def par_geds_hit_lq() -> None:
|
|
|
305
305
|
debug_mode=args.debug,
|
|
306
306
|
)
|
|
307
307
|
cal_dict = out_dicts[args.timestamp]
|
|
308
|
-
|
|
308
|
+
results_dict = results_dicts[args.timestamp]
|
|
309
309
|
plot_dict = plot_dicts[args.timestamp]
|
|
310
310
|
lq = lq_dict[args.timestamp]
|
|
311
311
|
|
|
312
312
|
else:
|
|
313
313
|
lq = None
|
|
314
|
+
results_dict = {}
|
|
314
315
|
|
|
315
316
|
if args.plot_file:
|
|
316
317
|
Path(args.plot_file).parent.mkdir(parents=True, exist_ok=True)
|
|
@@ -320,7 +321,7 @@ def par_geds_hit_lq() -> None:
|
|
|
320
321
|
final_hit_dict = convert_dict_np_to_float(
|
|
321
322
|
{
|
|
322
323
|
"pars": {"operations": cal_dict},
|
|
323
|
-
"results": dict(**ecal_dict["results"], lq=
|
|
324
|
+
"results": dict(**ecal_dict["results"], lq=results_dict),
|
|
324
325
|
}
|
|
325
326
|
)
|
|
326
327
|
Path(args.hit_pars).parent.mkdir(parents=True, exist_ok=True)
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import json
|
|
4
|
+
from pathlib import Path
|
|
4
5
|
|
|
5
6
|
import h5py
|
|
6
7
|
|
|
7
8
|
|
|
8
|
-
def alias_table(file, mapping):
|
|
9
|
+
def alias_table(file: str | Path, mapping: str):
|
|
9
10
|
"""
|
|
10
11
|
Create an alias table for the given file and mapping.
|
|
11
12
|
|
|
@@ -13,11 +14,12 @@ def alias_table(file, mapping):
|
|
|
13
14
|
file (str): Path to the input file.
|
|
14
15
|
mapping (dict): Mapping of current table name and alias table name.
|
|
15
16
|
|
|
16
|
-
Returns:
|
|
17
|
-
dict: A dictionary containing the alias table.
|
|
18
17
|
"""
|
|
19
18
|
if isinstance(mapping, str):
|
|
20
19
|
mapping = json.loads(mapping)
|
|
20
|
+
if isinstance(mapping, list):
|
|
21
|
+
for m in mapping:
|
|
22
|
+
alias_table(file, m)
|
|
21
23
|
with h5py.File(file, "a") as f:
|
|
22
24
|
for raw_id, alias in mapping.items():
|
|
23
25
|
if raw_id in f:
|
|
@@ -24,7 +24,7 @@ def convert_dict_np_to_float(dic: dict) -> dict:
|
|
|
24
24
|
convert_dict_np_to_float(value)
|
|
25
25
|
elif isinstance(value, np.float32 | np.float64):
|
|
26
26
|
dic[key] = float(value)
|
|
27
|
-
elif isinstance(dic[key], Sequence):
|
|
27
|
+
elif isinstance(dic[key], Sequence) and not isinstance(dic[key], str):
|
|
28
28
|
dic[key] = [
|
|
29
29
|
float(x) if isinstance(x, np.float32 | np.float64) else x for x in value
|
|
30
30
|
]
|
|
File without changes
|
{legend_dataflow_scripts-0.1.4.dist-info → legend_dataflow_scripts-0.1.5.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{legend_dataflow_scripts-0.1.4.dist-info → legend_dataflow_scripts-0.1.5.dist-info}/top_level.txt
RENAMED
|
File without changes
|