reboost 0.6.2__py3-none-any.whl → 0.7.0__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.
reboost/utils.py CHANGED
@@ -9,6 +9,7 @@ from collections.abc import Iterable, Mapping
9
9
  from contextlib import contextmanager
10
10
  from pathlib import Path
11
11
 
12
+ import h5py
12
13
  from dbetto import AttrsDict
13
14
  from lgdo import lh5
14
15
  from lgdo.types import Struct, Table, VectorOfVectors
@@ -164,7 +165,7 @@ def get_file_dict(
164
165
  files = {}
165
166
 
166
167
  for file_type, file_list in zip(
167
- ["stp", "glm", "hit"], [stp_files, glm_files_list, hit_files_list]
168
+ ["stp", "glm", "hit"], [stp_files, glm_files_list, hit_files_list], strict=True
168
169
  ):
169
170
  if isinstance(file_list, str):
170
171
  files[file_type] = [file_list]
@@ -303,7 +304,10 @@ def get_function_string(expr: str, aliases: dict | None = None) -> tuple[str, di
303
304
  globs = globs | {
304
305
  package: importlib.import_module(package_import),
305
306
  }
306
- except Exception:
307
+ except Exception as e:
308
+ # for imports of our own package, raise the error back to the user
309
+ if package_import == "reboost":
310
+ raise e
307
311
  msg = f"Function {package_import} cannot be imported"
308
312
  log.debug(msg)
309
313
  continue
@@ -439,3 +443,61 @@ def write_lh5(
439
443
  )
440
444
  if time_dict is not None:
441
445
  time_dict.update_field("write", start_time)
446
+
447
+
448
+ def get_remage_detector_uids(h5file: str | Path) -> dict:
449
+ """Get mapping of detector names to UIDs from a remage output file.
450
+
451
+ The remage LH5 output files contain a link structure that lets the user
452
+ access detector tables by UID. For example:
453
+
454
+ .. code-block:: text
455
+
456
+ ├── stp · struct{det1,det2,optdet1,optdet2,scint1,scint2}
457
+ └── __by_uid__ · struct{det001,det002,det011,det012,det101,det102}
458
+ ├── det001 -> /stp/scint1
459
+ ├── det002 -> /stp/scint2
460
+ ├── det011 -> /stp/det1
461
+ ├── det012 -> /stp/det2
462
+ ├── det101 -> /stp/optdet1
463
+ └── det102 -> /stp/optdet2
464
+
465
+ This function analyzes this structure and returns:
466
+
467
+ .. code-block:: text
468
+
469
+ {1: 'scint1',
470
+ 2: 'scint2',
471
+ 11: 'det1',
472
+ 12: 'det2',
473
+ 101: 'optdet1',
474
+ 102: 'optdet2'g
475
+
476
+ Parameters
477
+ ----------
478
+ h5file
479
+ path to remage output file.
480
+ """
481
+ if isinstance(h5file, Path):
482
+ h5file = h5file.as_posix()
483
+
484
+ out = {}
485
+ with h5py.File(h5file, "r") as f:
486
+ g = f["/stp/__by_uid__"]
487
+ # loop over links
488
+ for key in g:
489
+ # is this a link?
490
+ link = g.get(key, getlink=True)
491
+ if isinstance(link, h5py.SoftLink):
492
+ m = re.fullmatch(r"det(\d+)", key)
493
+ if m is None:
494
+ msg = rf"'{key}' is not formatted as expected, i.e. 'det(\d+)', skipping"
495
+ log.warning(msg)
496
+ continue
497
+
498
+ # get the name of the link target without trailing groups (to
499
+ # i.e. remove /stp)
500
+ name = link.path.split("/")[-1]
501
+
502
+ out[int(m.group(1))] = name
503
+ return out
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reboost
3
- Version: 0.6.2
3
+ Version: 0.7.0
4
4
  Summary: New LEGEND Monte-Carlo simulation post-processing
5
5
  Author-email: Manuel Huber <info@manuelhu.de>, Toby Dixon <toby.dixon.23@ucl.ac.uk>, Luigi Pertoldi <gipert@pm.me>
6
6
  Maintainer: The LEGEND Collaboration
@@ -693,7 +693,7 @@ Classifier: Programming Language :: Python
693
693
  Classifier: Programming Language :: Python :: 3
694
694
  Classifier: Programming Language :: Python :: 3 :: Only
695
695
  Classifier: Topic :: Scientific/Engineering
696
- Requires-Python: >=3.9
696
+ Requires-Python: >=3.10
697
697
  Description-Content-Type: text/markdown
698
698
  License-File: LICENSE
699
699
  Requires-Dist: hdf5plugin
@@ -701,8 +701,8 @@ Requires-Dist: colorlog
701
701
  Requires-Dist: numpy
702
702
  Requires-Dist: scipy
703
703
  Requires-Dist: numba
704
- Requires-Dist: legend-pydataobj>=1.14
705
- Requires-Dist: legend-pygeom-optics>=0.9.2
704
+ Requires-Dist: legend-pydataobj>=1.15.1
705
+ Requires-Dist: legend-pygeom-optics>=0.12.0
706
706
  Requires-Dist: legend-pygeom-tools>=0.0.11
707
707
  Requires-Dist: hist
708
708
  Requires-Dist: dbetto
@@ -0,0 +1,42 @@
1
+ reboost/__init__.py,sha256=VZz9uo7i2jgAx8Zi15SptLZnE_qcnGuNWwqkD3rYHFA,278
2
+ reboost/_version.py,sha256=uLbRjFSUZAgfl7V7O8zKV5Db36k7tz87ZIVq3l2SWs0,704
3
+ reboost/build_evt.py,sha256=VXIfK_pfe_Cgym6gI8dESwONZi-v_4fll0Pn09vePQY,3767
4
+ reboost/build_glm.py,sha256=IerSLQfe51ZO7CQP2kmfPnOIVaDtcfw3byOM02Vaz6o,9472
5
+ reboost/build_hit.py,sha256=pjEaiPW63Q3MfpjI29uJXx9gtwfiOIgOcADRDrDpRrA,17409
6
+ reboost/cli.py,sha256=68EzKiWTHJ2u1RILUv7IX9HaVq6nTTM80_W_MUnWRe4,6382
7
+ reboost/core.py,sha256=wIIDxaPzEaozZOeKabz4l-29_IyY47RbNy6qS8Bai1Y,15297
8
+ reboost/iterator.py,sha256=qlEqRv5qOh8eIs-dyVOLYTvH-ZpQDx9fLckpcAdtWjs,6975
9
+ reboost/log_utils.py,sha256=VqS_9OC5NeNU3jcowVOBB0NJ6ssYvNWnirEY-JVduEA,766
10
+ reboost/profile.py,sha256=EOTmjmS8Rm_nYgBWNh6Rntl2XDsxdyed7yEdWtsZEeg,2598
11
+ reboost/units.py,sha256=LUwl6swLQoG09Rt9wcDdu6DTrwDsy-C751BNGzX4sz8,3651
12
+ reboost/utils.py,sha256=SfrqWdQZPNXw0x0DVucxHC5OwFXewM43tO-PNnIwjKI,14562
13
+ reboost/daq/__init__.py,sha256=rNPhxx1Yawt3tENYhmOYSum9_TdV57ZU5kjxlWFAGuo,107
14
+ reboost/daq/core.py,sha256=Rs6Q-17fzEod2iX_2WqEmnqKnNRFoWTYURl3wYhFihU,9915
15
+ reboost/daq/utils.py,sha256=KcH6zvlInmD2YiF6V--DSYBTYudJw3G-hp2JGOcES2o,1042
16
+ reboost/hpge/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
+ reboost/hpge/psd.py,sha256=P9lxji4njwFwPBR0vfh6gkvt7GQx2BRajvCsUUmtEqU,24407
18
+ reboost/hpge/surface.py,sha256=ROewOsSoq8zRAaiamWdMDl-UR7ZfsimgH2Lv9k0flKg,8494
19
+ reboost/hpge/utils.py,sha256=AcMS86v8s0SbeC4YA3CfH73GBZcC7Sb_RR3pRPjWAwU,2857
20
+ reboost/math/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
+ reboost/math/functions.py,sha256=OymiYTcA0NXxxm-MBDw5kqyNwHoLCmuv4J48AwnSrbU,5633
22
+ reboost/math/stats.py,sha256=Rq4Wdzv-3aoSK7EsPZCuOEHfnOz3w0moIzCEHbC07xw,3173
23
+ reboost/optmap/__init__.py,sha256=imvuyld-GLw8qdwqW-lXCg2feptcTyQo3wIzPvDHwmY,93
24
+ reboost/optmap/cli.py,sha256=CoH0P_WLEek1T9zxmlsM2TuxxzqobP-W-ym72uhxrO4,10252
25
+ reboost/optmap/convolve.py,sha256=9fM5zVKkwp03a3kqBwWppe1UOGdVm1Q6yF4P0v2I8VQ,22936
26
+ reboost/optmap/create.py,sha256=qwUvYiUotmLCrB6RsfwxRMGI4EYRn7Q4XlwppUTVZTE,18166
27
+ reboost/optmap/evt.py,sha256=UrjjNNeS7Uie4Ah9y_f5PyroFutLGo5aOFcwReOEy7o,5556
28
+ reboost/optmap/mapview.py,sha256=73kpe0_SKDj9bIhEx1ybX1sBP8TyvufiLfps84A_ijA,6798
29
+ reboost/optmap/numba_pdg.py,sha256=y8cXR5PWE2Liprp4ou7vl9do76dl84vXU52ZJD9_I7A,731
30
+ reboost/optmap/optmap.py,sha256=f8Y0zLmXZyOz4-GDUPViIY_vf_shY3ZQG9lSD31J8gc,12820
31
+ reboost/shape/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
+ reboost/shape/cluster.py,sha256=nwR1Dnf00SDICGPqpXeM1Q7_DwTtO9uP3wmuML45c3g,8195
33
+ reboost/shape/group.py,sha256=gOCYgir2gZqmW1JXtbNRPlQqP0gmUcbe7RVb9CbY1pU,5540
34
+ reboost/shape/reduction.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
+ reboost/spms/__init__.py,sha256=ffi0rH-ZFGmpURbFt-HY1ZAHCdady0mLXNsblRNh-JY,207
36
+ reboost/spms/pe.py,sha256=9KWmc4fGW5_bx4imsguLm-xp6rokt89iZcM-WD62Tj4,3090
37
+ reboost-0.7.0.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
38
+ reboost-0.7.0.dist-info/METADATA,sha256=-CFo2D7zHSJXcSsfMQtXIv8T4nx3qoR4OMD6EbaKLU0,44226
39
+ reboost-0.7.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
40
+ reboost-0.7.0.dist-info/entry_points.txt,sha256=DxhD6BidSWNot9BrejHJjQ7RRLmrMaBIl52T75oWTwM,93
41
+ reboost-0.7.0.dist-info/top_level.txt,sha256=q-IBsDepaY_AbzbRmQoW8EZrITXRVawVnNrB-_zyXZs,8
42
+ reboost-0.7.0.dist-info/RECORD,,
@@ -1,37 +0,0 @@
1
- reboost/__init__.py,sha256=VZz9uo7i2jgAx8Zi15SptLZnE_qcnGuNWwqkD3rYHFA,278
2
- reboost/_version.py,sha256=DhO-RAVJdQTjYPaMf0M6q_WAXdD6jcx2tWl_B9FtuhM,511
3
- reboost/build_evt.py,sha256=VXIfK_pfe_Cgym6gI8dESwONZi-v_4fll0Pn09vePQY,3767
4
- reboost/build_glm.py,sha256=IerSLQfe51ZO7CQP2kmfPnOIVaDtcfw3byOM02Vaz6o,9472
5
- reboost/build_hit.py,sha256=BwcAzr7hkhLqQpyULYPqM70VEvENaw-j90fvBYKh-68,15649
6
- reboost/cli.py,sha256=HZgqUZK0tSmnlGqoXjrbmLitW_i001TzibxvDrRxLLg,6324
7
- reboost/core.py,sha256=WGbWe2rcfMDEaehVyw7peqAHoTFWoCu5J6CdWHC5aWA,14974
8
- reboost/iterator.py,sha256=fATFDxu2PUc0e48OdJJujZo2kwykfRLH1oBtcB-s5pM,6905
9
- reboost/log_utils.py,sha256=VqS_9OC5NeNU3jcowVOBB0NJ6ssYvNWnirEY-JVduEA,766
10
- reboost/profile.py,sha256=EOTmjmS8Rm_nYgBWNh6Rntl2XDsxdyed7yEdWtsZEeg,2598
11
- reboost/units.py,sha256=3EH8XlpbsObdu5vLgxhm1600L6UNYD5jng4SjJT_1QE,2202
12
- reboost/utils.py,sha256=dzDiQWwv_snoWoRBDnDNZ27hG0CpCRo8V4jSEG2b82c,12592
13
- reboost/hpge/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- reboost/hpge/psd.py,sha256=jAUAoQ_PMz76wyA1NXYHNKtOwoCnRT3My8_LCFrKi-U,13860
15
- reboost/hpge/surface.py,sha256=lbWcFnFFWKxtFKs755GyM9US_IfyxaoM6MpOIZgIMM0,7478
16
- reboost/hpge/utils.py,sha256=0Rx4HubCOm8JMECjWcAJXfAch9OkSlRpUkdsSlzwZ2E,2830
17
- reboost/math/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
- reboost/math/functions.py,sha256=OymiYTcA0NXxxm-MBDw5kqyNwHoLCmuv4J48AwnSrbU,5633
19
- reboost/math/stats.py,sha256=cG-6mQx33Dzpv3ABkHLEwC104WJ_PMgbWtmjg37SBj4,3164
20
- reboost/optmap/__init__.py,sha256=imvuyld-GLw8qdwqW-lXCg2feptcTyQo3wIzPvDHwmY,93
21
- reboost/optmap/cli.py,sha256=N8J2Hd8m_csYU9CtpAp7Rc3LHy6eNzZ26gWZgHCiUso,10250
22
- reboost/optmap/convolve.py,sha256=x7boLDcBJIsontoB0yemvzHSE2hlRpUomlDXc3jqdr4,14668
23
- reboost/optmap/create.py,sha256=_6GZbdRvmjDFs6DDbWC-THZxaNPUiLAOIDNaigMKJSQ,18139
24
- reboost/optmap/evt.py,sha256=UrjjNNeS7Uie4Ah9y_f5PyroFutLGo5aOFcwReOEy7o,5556
25
- reboost/optmap/mapview.py,sha256=73kpe0_SKDj9bIhEx1ybX1sBP8TyvufiLfps84A_ijA,6798
26
- reboost/optmap/numba_pdg.py,sha256=y8cXR5PWE2Liprp4ou7vl9do76dl84vXU52ZJD9_I7A,731
27
- reboost/optmap/optmap.py,sha256=j4rfbQ84PYSpE-BvP4Rdt96ZjPdwy8P4e4eZz1mATys,12817
28
- reboost/shape/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
- reboost/shape/cluster.py,sha256=RIvBlhHzp88aaUZGofp5SD9bimnoiqIOddhQ84jiwoM,8135
30
- reboost/shape/group.py,sha256=gOCYgir2gZqmW1JXtbNRPlQqP0gmUcbe7RVb9CbY1pU,5540
31
- reboost/shape/reduction.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
- reboost-0.6.2.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
33
- reboost-0.6.2.dist-info/METADATA,sha256=o0DAQXxkMCG68Uf-WHTHeVsIEMKMsj044lWWMJLAx_k,44222
34
- reboost-0.6.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
35
- reboost-0.6.2.dist-info/entry_points.txt,sha256=DxhD6BidSWNot9BrejHJjQ7RRLmrMaBIl52T75oWTwM,93
36
- reboost-0.6.2.dist-info/top_level.txt,sha256=q-IBsDepaY_AbzbRmQoW8EZrITXRVawVnNrB-_zyXZs,8
37
- reboost-0.6.2.dist-info/RECORD,,