legend-dataflow-scripts 0.1.5__py3-none-any.whl → 0.1.6__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: legend-dataflow-scripts
3
- Version: 0.1.5
3
+ Version: 0.1.6
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,5 +1,5 @@
1
1
  legenddataflowscripts/__init__.py,sha256=hlpvTxSBjOyXlZUyOyYx3VwT5LS6zNzhAZnTmfT3NjU,303
2
- legenddataflowscripts/_version.py,sha256=Y4jy4bEMmwl_qNPCmiMFnlQ2ofMoqyG37hp8uwI3m10,511
2
+ legenddataflowscripts/_version.py,sha256=ESbJO0YD7TYfOUv_WDIJJgWELGepEWsoyhqVifEcXPA,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
@@ -12,26 +12,26 @@ legenddataflowscripts/par/geds/dsp/svm.py,sha256=eDneRB_PQZp8Q4n2VheTX3kbu4ufZQ-
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
14
  legenddataflowscripts/par/geds/hit/aoe.py,sha256=lkA7cgSRdyDt58AYOIuPoCBxiClVJU-6wwYSImpdVFg,11413
15
- legenddataflowscripts/par/geds/hit/ecal.py,sha256=rSXV6t4olwxW0SVHlBgQDQH9xyndS329XT-0YxmgvZE,27125
15
+ legenddataflowscripts/par/geds/hit/ecal.py,sha256=HogjtX-QUkwogh-jA9F0jTTvEjEfCUK5GY4cHGUBaAw,27854
16
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=JL59O4p1MX4kTb1YVa3Md8Bc6H7GvuWsDOb5I7qb6EA,809
22
+ legenddataflowscripts/utils/alias_table.py,sha256=OfET_-ZG6FfXL9JRqPJiSWUdDrDQlNnz5RsLkH2sk5Y,1605
23
23
  legenddataflowscripts/utils/cfgtools.py,sha256=_1yxw_eJ08AihONhJ9sWet5HQZpOagj8Yg8y9LS3zX4,381
24
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
28
28
  legenddataflowscripts/workflow/__init__.py,sha256=JhudKYhBT8bXtX4LCqxQCHzUiITpugAtFxePWEtphC4,474
29
- legenddataflowscripts/workflow/execenv.py,sha256=O6Z6EH6Yp0JXnwX2wTzduHC9Q9gu-_d1RuuE2pQ5caE,9061
29
+ legenddataflowscripts/workflow/execenv.py,sha256=qTG4N9ovEPxA0QtqG0wWUIuK50BZIcYvpVlpy-XgxPw,9257
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.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,,
33
+ legend_dataflow_scripts-0.1.6.dist-info/METADATA,sha256=PTXbBwFCBHDbdxQamprkPrSTly1YVydK5y0HUb__9Bk,3122
34
+ legend_dataflow_scripts-0.1.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
35
+ legend_dataflow_scripts-0.1.6.dist-info/entry_points.txt,sha256=B197waSm-orA_ZS-9rkxNDsmOHdCn8CbWodnlqXQKRg,1313
36
+ legend_dataflow_scripts-0.1.6.dist-info/top_level.txt,sha256=s8E2chjJNYUbrN6whFG_VCsJKySFp1IOXLcUefA7DB0,22
37
+ legend_dataflow_scripts-0.1.6.dist-info/RECORD,,
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '0.1.5'
21
- __version_tuple__ = version_tuple = (0, 1, 5)
20
+ __version__ = version = '0.1.6'
21
+ __version_tuple__ = version_tuple = (0, 1, 6)
@@ -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 "ctc" in cal_energy_param:
684
- no_ctc_dict = full_object_dict[cal_energy_param].gen_pars_dict()
685
- no_ctc_dict["expression"] = no_ctc_dict["expression"].replace("_ctc", "")
686
- hit_dict.update({cal_energy_param.replace("ctc", "noctc"): no_ctc_dict})
687
- hit_dict.update(
688
- {
689
- cal_energy_param.replace("_ctc", ""): {
690
- "expression": f"where({cal_energy_param.replace('ctc', 'noctc')}>{kwarg_dict.get('dt_theshold_kev', 100)}, {cal_energy_param}, {cal_energy_param.replace('ctc', 'noctc')})",
691
- "parameters": {},
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():
@@ -6,6 +6,29 @@ from pathlib import Path
6
6
  import h5py
7
7
 
8
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
+
9
32
  def alias_table(file: str | Path, mapping: str):
10
33
  """
11
34
  Create an alias table for the given file and mapping.
@@ -26,5 +49,7 @@ def alias_table(file: str | Path, mapping: str):
26
49
  if isinstance(alias, list | tuple):
27
50
  for a in alias:
28
51
  f[a] = f[raw_id]
52
+ convert_parents_to_structs(f[a])
29
53
  else:
30
54
  f[alias] = f[raw_id]
55
+ 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
- subprocess.run(cmd_expr, env=os.environ | cmd_env, check=True)
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)