legend-dataflow-scripts 0.1.5__tar.gz → 0.1.7__tar.gz
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.5/src/legend_dataflow_scripts.egg-info → legend_dataflow_scripts-0.1.7}/PKG-INFO +1 -1
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7/src/legend_dataflow_scripts.egg-info}/PKG-INFO +1 -1
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legenddataflowscripts/_version.py +2 -2
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legenddataflowscripts/par/geds/hit/ecal.py +26 -12
- legend_dataflow_scripts-0.1.7/src/legenddataflowscripts/utils/alias_table.py +56 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legenddataflowscripts/workflow/execenv.py +7 -1
- legend_dataflow_scripts-0.1.5/src/legenddataflowscripts/utils/alias_table.py +0 -30
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/LICENSE +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/README.md +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/pyproject.toml +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/setup.cfg +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legend_dataflow_scripts.egg-info/SOURCES.txt +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legend_dataflow_scripts.egg-info/dependency_links.txt +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legend_dataflow_scripts.egg-info/entry_points.txt +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legend_dataflow_scripts.egg-info/not-zip-safe +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legend_dataflow_scripts.egg-info/requires.txt +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legend_dataflow_scripts.egg-info/top_level.txt +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legenddataflowscripts/__init__.py +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legenddataflowscripts/par/__init__.py +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legenddataflowscripts/par/geds/__init__.py +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legenddataflowscripts/par/geds/dsp/__init__.py +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legenddataflowscripts/par/geds/dsp/dplms.py +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legenddataflowscripts/par/geds/dsp/eopt.py +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legenddataflowscripts/par/geds/dsp/evtsel.py +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legenddataflowscripts/par/geds/dsp/nopt.py +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legenddataflowscripts/par/geds/dsp/pz.py +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legenddataflowscripts/par/geds/dsp/svm.py +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legenddataflowscripts/par/geds/dsp/svm_build.py +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legenddataflowscripts/par/geds/hit/__init__.py +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legenddataflowscripts/par/geds/hit/aoe.py +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legenddataflowscripts/par/geds/hit/lq.py +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legenddataflowscripts/par/geds/hit/qc.py +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legenddataflowscripts/tier/__init__.py +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legenddataflowscripts/tier/dsp.py +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legenddataflowscripts/tier/hit.py +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legenddataflowscripts/utils/__init__.py +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legenddataflowscripts/utils/cfgtools.py +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legenddataflowscripts/utils/convert_np.py +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legenddataflowscripts/utils/log.py +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legenddataflowscripts/utils/plot_dict.py +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legenddataflowscripts/utils/pulser_removal.py +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legenddataflowscripts/workflow/__init__.py +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legenddataflowscripts/workflow/filedb.py +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legenddataflowscripts/workflow/pre_compile_catalog.py +0 -0
- {legend_dataflow_scripts-0.1.5 → legend_dataflow_scripts-0.1.7}/src/legenddataflowscripts/workflow/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: legend-dataflow-scripts
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.7
|
|
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,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: legend-dataflow-scripts
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.7
|
|
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
|
|
@@ -680,18 +680,32 @@ def par_geds_hit_ecal() -> None:
|
|
|
680
680
|
hit_dict.update(
|
|
681
681
|
{cal_energy_param: full_object_dict[cal_energy_param].gen_pars_dict()}
|
|
682
682
|
)
|
|
683
|
-
if "
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
683
|
+
if "copy_calibration" in kwarg_dict:
|
|
684
|
+
for copy_cal_param, _copy_to_cal_param in kwarg_dict[
|
|
685
|
+
"copy_calibration"
|
|
686
|
+
].items():
|
|
687
|
+
if copy_cal_param not in full_object_dict:
|
|
688
|
+
msg = f"copy_calibration parameter {copy_cal_param} not found in full_object_dict"
|
|
689
|
+
raise ValueError(msg)
|
|
690
|
+
if isinstance(_copy_to_cal_param, str):
|
|
691
|
+
copy_to_cal_param = [_copy_to_cal_param]
|
|
692
|
+
else:
|
|
693
|
+
copy_to_cal_param = _copy_to_cal_param
|
|
694
|
+
for cal_par in copy_to_cal_param:
|
|
695
|
+
if cal_par in full_object_dict:
|
|
696
|
+
msg = f"copy_calibration parameter {cal_par} already exists in full_object_dict"
|
|
697
|
+
raise ValueError(msg)
|
|
698
|
+
copy_dict = {cal_par: full_object_dict[cal_par].gen_pars_dict()}
|
|
699
|
+
copy_dict["expression"] = copy_dict[cal_par]["expression"].replace(
|
|
700
|
+
copy_cal_param, cal_par
|
|
701
|
+
)
|
|
702
|
+
hit_dict.update({cal_par: copy_dict[cal_par]})
|
|
703
|
+
if "extra_blocks" in kwarg_dict:
|
|
704
|
+
if isinstance(kwarg_dict["extra_blocks"], dict):
|
|
705
|
+
kwarg_dict["extra_blocks"] = [kwarg_dict["extra_blocks"]]
|
|
706
|
+
for extra_block in kwarg_dict["extra_blocks"]:
|
|
707
|
+
hit_dict.update(extra_block)
|
|
708
|
+
|
|
695
709
|
if args.plot_path:
|
|
696
710
|
param_plot_dict = {}
|
|
697
711
|
if ~np.isnan(full_object_dict[cal_energy_param].pars).all():
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
import h5py
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def convert_parents_to_structs(h5group):
|
|
10
|
+
if h5group.parent.name != "/" and len(h5group.parent.attrs) == 0:
|
|
11
|
+
h5group.parent.attrs.update(
|
|
12
|
+
{"datatype": "struct{" + h5group.name.split("/")[-1] + "}"}
|
|
13
|
+
)
|
|
14
|
+
elif (
|
|
15
|
+
len(h5group.parent.attrs) > 0
|
|
16
|
+
and h5group.name.split("/")[-1] not in h5group.parent.attrs["datatype"]
|
|
17
|
+
):
|
|
18
|
+
h5group.parent.attrs.update(
|
|
19
|
+
{
|
|
20
|
+
"datatype": h5group.parent.attrs["datatype"][:-1]
|
|
21
|
+
+ ","
|
|
22
|
+
+ h5group.name.split("/")[-1]
|
|
23
|
+
+ "}"
|
|
24
|
+
}
|
|
25
|
+
)
|
|
26
|
+
else:
|
|
27
|
+
return
|
|
28
|
+
convert_parents_to_structs(h5group.parent)
|
|
29
|
+
return
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def alias_table(file: str | Path, mapping: str):
|
|
33
|
+
"""
|
|
34
|
+
Create an alias table for the given file and mapping.
|
|
35
|
+
|
|
36
|
+
Args:
|
|
37
|
+
file (str): Path to the input file.
|
|
38
|
+
mapping (dict): Mapping of current table name and alias table name.
|
|
39
|
+
|
|
40
|
+
"""
|
|
41
|
+
if isinstance(mapping, str):
|
|
42
|
+
mapping = json.loads(mapping)
|
|
43
|
+
if isinstance(mapping, list):
|
|
44
|
+
for m in mapping:
|
|
45
|
+
alias_table(file, m)
|
|
46
|
+
return
|
|
47
|
+
with h5py.File(file, "a") as f:
|
|
48
|
+
for raw_id, alias in mapping.items():
|
|
49
|
+
if raw_id in f:
|
|
50
|
+
if isinstance(alias, list | tuple):
|
|
51
|
+
for a in alias:
|
|
52
|
+
f[a] = f[raw_id]
|
|
53
|
+
convert_parents_to_structs(f[a])
|
|
54
|
+
else:
|
|
55
|
+
f[alias] = f[raw_id]
|
|
56
|
+
convert_parents_to_structs(f[alias])
|
|
@@ -316,10 +316,16 @@ def cmdexec(args) -> None:
|
|
|
316
316
|
)
|
|
317
317
|
config_dict["execenv"] = config_dict["execenv"][args.system]
|
|
318
318
|
|
|
319
|
+
exe_path = Path(config_dict.paths.install).resolve() / "bin"
|
|
320
|
+
|
|
319
321
|
cmd_prefix, cmd_env = execenv_prefix(config_dict, as_string=False)
|
|
320
322
|
cmd_expr = [*cmd_prefix, *args.command]
|
|
321
323
|
|
|
322
324
|
msg = "running: " + _execenv2str(cmd_expr, cmd_env)
|
|
323
325
|
log.debug(msg)
|
|
324
326
|
|
|
325
|
-
|
|
327
|
+
env_dict = os.environ | cmd_env
|
|
328
|
+
env_dict["PATH"] = (
|
|
329
|
+
f"{exe_path}:{env_dict['PATH']}" # prepend the virtualenv bin dir
|
|
330
|
+
)
|
|
331
|
+
subprocess.run(cmd_expr, env=env_dict, check=True)
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import json
|
|
4
|
-
from pathlib import Path
|
|
5
|
-
|
|
6
|
-
import h5py
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def alias_table(file: str | Path, mapping: str):
|
|
10
|
-
"""
|
|
11
|
-
Create an alias table for the given file and mapping.
|
|
12
|
-
|
|
13
|
-
Args:
|
|
14
|
-
file (str): Path to the input file.
|
|
15
|
-
mapping (dict): Mapping of current table name and alias table name.
|
|
16
|
-
|
|
17
|
-
"""
|
|
18
|
-
if isinstance(mapping, str):
|
|
19
|
-
mapping = json.loads(mapping)
|
|
20
|
-
if isinstance(mapping, list):
|
|
21
|
-
for m in mapping:
|
|
22
|
-
alias_table(file, m)
|
|
23
|
-
with h5py.File(file, "a") as f:
|
|
24
|
-
for raw_id, alias in mapping.items():
|
|
25
|
-
if raw_id in f:
|
|
26
|
-
if isinstance(alias, list | tuple):
|
|
27
|
-
for a in alias:
|
|
28
|
-
f[a] = f[raw_id]
|
|
29
|
-
else:
|
|
30
|
-
f[alias] = f[raw_id]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|