reboost 0.2.5__py3-none-any.whl → 0.2.7__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/_version.py CHANGED
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '0.2.5'
21
- __version_tuple__ = version_tuple = (0, 2, 5)
20
+ __version__ = version = '0.2.7'
21
+ __version_tuple__ = version_tuple = (0, 2, 7)
reboost/build_glm.py CHANGED
@@ -153,6 +153,10 @@ def get_stp_evtids(
153
153
  )
154
154
  evtids = lh5_obj.view_as("ak")
155
155
 
156
+ # pick the first evtid
157
+ if evtids.ndim > 1:
158
+ evtids = ak.fill_none(ak.firsts(evtids, axis=-1), -1)
159
+
156
160
  # if the evtids_proc is not set then this is the first valid chunk
157
161
  if evtids_proc is None:
158
162
  evtids_proc = evtids
reboost/build_hit.py CHANGED
@@ -290,7 +290,7 @@ def build_hit(
290
290
  start_row=start_evtid,
291
291
  stp_field=in_field,
292
292
  n_rows=n_evtid,
293
- read_vertices=True,
293
+ read_vertices=False,
294
294
  buffer=buffer,
295
295
  time_dict=time_dict[proc_name],
296
296
  )
@@ -299,8 +299,15 @@ def build_hit(
299
299
  if stps is None:
300
300
  continue
301
301
 
302
+ # convert to awkward
303
+ if time_dict is not None:
304
+ start_time = time.time()
305
+
302
306
  ak_obj = stps.view_as("ak")
303
307
 
308
+ if time_dict is not None:
309
+ time_dict[proc_name].update_field("conv", start_time)
310
+
304
311
  # produce the hit table
305
312
  for out_det_idx, out_detector in enumerate(out_detectors):
306
313
  # loop over the rows
@@ -351,8 +358,11 @@ def build_hit(
351
358
  )
352
359
 
353
360
  wo_mode = utils.get_wo_mode(
354
- [group_idx, out_det_idx, in_det_idx, chunk_idx],
355
- new_hit_file,
361
+ group=group_idx,
362
+ out_det=out_det_idx,
363
+ in_det=in_det_idx,
364
+ chunk=chunk_idx,
365
+ new_hit_file=new_hit_file,
356
366
  overwrite=overwrite,
357
367
  )
358
368
 
@@ -361,12 +371,20 @@ def build_hit(
361
371
  if time_dict is not None:
362
372
  start_time = time.time()
363
373
 
364
- lh5.write(
365
- Struct({out_detector: hit_table}),
366
- out_field,
367
- files.hit[file_idx],
368
- wo_mode=wo_mode,
369
- )
374
+ if wo_mode != "a":
375
+ lh5.write(
376
+ Struct({out_detector: hit_table}),
377
+ out_field,
378
+ files.hit[file_idx],
379
+ wo_mode=wo_mode,
380
+ )
381
+ else:
382
+ lh5.write(
383
+ hit_table,
384
+ f"{out_field}/{out_detector}",
385
+ files.hit[file_idx],
386
+ wo_mode=wo_mode,
387
+ )
370
388
  if time_dict is not None:
371
389
  time_dict[proc_name].update_field("write", start_time)
372
390
 
reboost/iterator.py CHANGED
@@ -4,6 +4,7 @@ import logging
4
4
  import time
5
5
  import typing
6
6
 
7
+ import awkward as ak
7
8
  from lgdo.lh5 import LH5Store
8
9
  from lgdo.types import LGDO, Table
9
10
 
@@ -124,12 +125,16 @@ class GLMIterator:
124
125
  if len(glm_ak) > 0:
125
126
  # extract range of stp rows to read
126
127
  start = glm_ak.start_row[0]
127
- n = sum(glm_ak.n_rows)
128
+ n = ak.sum(glm_ak.n_rows)
129
+
128
130
  if self.time_dict is not None:
129
131
  time_start = time.time()
130
132
 
131
133
  stp_rows, n_steps = self.sto.read(
132
- f"{self.stp_field}/{self.lh5_group}", self.stp_file, start_row=start, n_rows=n
134
+ f"{self.stp_field}/{self.lh5_group}",
135
+ self.stp_file,
136
+ start_row=int(start),
137
+ n_rows=int(n),
133
138
  )
134
139
 
135
140
  # save time
reboost/utils.py CHANGED
@@ -9,17 +9,26 @@ from contextlib import contextmanager
9
9
  from pathlib import Path
10
10
 
11
11
  from dbetto import AttrsDict
12
- from lgdo.types import Table
12
+ from lgdo.types import Table, VectorOfVectors
13
13
 
14
14
  log = logging.getLogger(__name__)
15
15
 
16
16
 
17
- def get_wo_mode(indices: list[int], new_hit_file: bool, overwrite: bool = False):
17
+ def get_wo_mode(
18
+ group: int, out_det: int, in_det: int, chunk: int, new_hit_file: bool, overwrite: bool = False
19
+ ):
18
20
  """Get the mode for lh5 file writing."""
21
+ indices = [group, out_det, in_det, chunk]
22
+
19
23
  good_idx = all(i == 0 for i in indices)
24
+
20
25
  if good_idx and new_hit_file:
21
26
  return "of" if overwrite else "w"
22
- return "ac"
27
+
28
+ # if we have a detector not the first and chunk 0 append column
29
+ if ((in_det > 0) or (out_det > 0)) & (chunk == 0):
30
+ return "ac"
31
+ return "a"
23
32
 
24
33
 
25
34
  def get_file_dict(
@@ -121,7 +130,11 @@ def assign_units(tab: Table, units: Mapping) -> Table:
121
130
  """
122
131
  for field in tab:
123
132
  if field in units:
124
- tab[field].attrs["units"] = units[field]
133
+ if not isinstance(tab[field], VectorOfVectors):
134
+ tab[field].attrs["units"] = units[field]
135
+ else:
136
+ tab[field].flattened_data.attrs["units"] = units[field]
137
+
125
138
  return tab
126
139
 
127
140
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reboost
3
- Version: 0.2.5
3
+ Version: 0.2.7
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
@@ -1,16 +1,16 @@
1
1
  reboost/__init__.py,sha256=RVNl3Qgx_hTUeBGXaWYmiTcmXUDhTfvlAGGC8bo_jP8,316
2
- reboost/_version.py,sha256=N3oBwJUFmS-AwCjqOcSlRW4GvSq-uJJMaBvoGfv1-hM,511
2
+ reboost/_version.py,sha256=Xk20v7uvkFqkpy9aLJzVngs1eKQn0FYUP2oyA1MEQUU,511
3
3
  reboost/build_evt.py,sha256=zj3wG_kaV3EoRMQ33AkCNa_2Fv8cLtRuhyRyRmSrOYQ,4797
4
- reboost/build_glm.py,sha256=LQkM6x6mMOE92-c78uoclOvP9zp3vdMuLQCSP2f2Zk4,9263
5
- reboost/build_hit.py,sha256=yfOUzAaKFGrQ0ENgUvZUh9Q9EVK42kISNcpuRLOjlRg,14167
4
+ reboost/build_glm.py,sha256=kSY9hQjEsOE-0PiblhdBy_SvFIlgXLX6CUlgpxW-_OI,9389
5
+ reboost/build_hit.py,sha256=Zu8WoeFYtFU_xUO3I8OZM5psNaiv1boMJPnBWC58nfQ,14958
6
6
  reboost/build_tcm.py,sha256=-PawBHoHj0zsm4XsZu5bco9d9a09STicZchduefSNfI,2951
7
7
  reboost/cli.py,sha256=swPJcYzvg18rSOMN-mpe0PCMf1-a9V7osIssX7JP7k0,6459
8
8
  reboost/core.py,sha256=7Nclc6RUCOSJ1CWVAX0rFNJGM1LEgqvc4tD04CxEAtg,10766
9
- reboost/iterator.py,sha256=72AyoRTgMpWghZt2UOqRj0RGiNzaiBAwgNIUZdduK2s,4698
9
+ reboost/iterator.py,sha256=uKCZHobfmfzuy6Q4olHgt7m1XtUMM5KUvrk3lJ3XWec,4782
10
10
  reboost/log_utils.py,sha256=VqS_9OC5NeNU3jcowVOBB0NJ6ssYvNWnirEY-JVduEA,766
11
11
  reboost/profile.py,sha256=EOTmjmS8Rm_nYgBWNh6Rntl2XDsxdyed7yEdWtsZEeg,2598
12
12
  reboost/units.py,sha256=3EH8XlpbsObdu5vLgxhm1600L6UNYD5jng4SjJT_1QE,2202
13
- reboost/utils.py,sha256=R9_JUOp_CqEn52iLQCKEs_rj9N_icHmMXf8DGettggs,8050
13
+ reboost/utils.py,sha256=eBw0ZzwhlniTLbjz9tnstCXSYrjSeH4FJ0fkJ9-uqps,8450
14
14
  reboost/hpge/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  reboost/hpge/psd.py,sha256=868OUJzO9TNja0YSrZ3NDGeEAbUtpDZnmvBDm0jCC9E,6856
16
16
  reboost/hpge/surface.py,sha256=SZyTmOCTipf27jYaJhtdInzGF1RZ2wKpbtf6HlOQYwM,3662
@@ -30,9 +30,9 @@ reboost/shape/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
30
  reboost/shape/cluster.py,sha256=RIvBlhHzp88aaUZGofp5SD9bimnoiqIOddhQ84jiwoM,8135
31
31
  reboost/shape/group.py,sha256=Q3DhEPxbhw3p4bwvpswSd0A-p224l5vRZnfQIEkOVJE,4475
32
32
  reboost/shape/reduction.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
- reboost-0.2.5.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
34
- reboost-0.2.5.dist-info/METADATA,sha256=ys5cRQSdNlDrzQW1qxwLuoFq1M8QOhdSC5DKE4meiGQ,44251
35
- reboost-0.2.5.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
36
- reboost-0.2.5.dist-info/entry_points.txt,sha256=DxhD6BidSWNot9BrejHJjQ7RRLmrMaBIl52T75oWTwM,93
37
- reboost-0.2.5.dist-info/top_level.txt,sha256=q-IBsDepaY_AbzbRmQoW8EZrITXRVawVnNrB-_zyXZs,8
38
- reboost-0.2.5.dist-info/RECORD,,
33
+ reboost-0.2.7.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
34
+ reboost-0.2.7.dist-info/METADATA,sha256=91C3mSgN5iDtZLrON4O0iFmLlsdepdW-VX8Rvr_2Kas,44251
35
+ reboost-0.2.7.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
36
+ reboost-0.2.7.dist-info/entry_points.txt,sha256=DxhD6BidSWNot9BrejHJjQ7RRLmrMaBIl52T75oWTwM,93
37
+ reboost-0.2.7.dist-info/top_level.txt,sha256=q-IBsDepaY_AbzbRmQoW8EZrITXRVawVnNrB-_zyXZs,8
38
+ reboost-0.2.7.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.3.1)
2
+ Generator: setuptools (80.7.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5