reboost 0.2.5__py3-none-any.whl → 0.2.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.
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.6'
21
+ __version_tuple__ = version_tuple = (0, 2, 6)
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
@@ -351,8 +351,11 @@ def build_hit(
351
351
  )
352
352
 
353
353
  wo_mode = utils.get_wo_mode(
354
- [group_idx, out_det_idx, in_det_idx, chunk_idx],
355
- new_hit_file,
354
+ group=group_idx,
355
+ out_det=out_det_idx,
356
+ in_det=in_det_idx,
357
+ chunk=chunk_idx,
358
+ new_hit_file=new_hit_file,
356
359
  overwrite=overwrite,
357
360
  )
358
361
 
@@ -361,12 +364,20 @@ def build_hit(
361
364
  if time_dict is not None:
362
365
  start_time = time.time()
363
366
 
364
- lh5.write(
365
- Struct({out_detector: hit_table}),
366
- out_field,
367
- files.hit[file_idx],
368
- wo_mode=wo_mode,
369
- )
367
+ if wo_mode != "a":
368
+ lh5.write(
369
+ Struct({out_detector: hit_table}),
370
+ out_field,
371
+ files.hit[file_idx],
372
+ wo_mode=wo_mode,
373
+ )
374
+ else:
375
+ lh5.write(
376
+ hit_table,
377
+ f"{out_field}/{out_detector}",
378
+ files.hit[file_idx],
379
+ wo_mode=wo_mode,
380
+ )
370
381
  if time_dict is not None:
371
382
  time_dict[proc_name].update_field("write", start_time)
372
383
 
reboost/iterator.py CHANGED
@@ -129,7 +129,10 @@ class GLMIterator:
129
129
  time_start = time.time()
130
130
 
131
131
  stp_rows, n_steps = self.sto.read(
132
- f"{self.stp_field}/{self.lh5_group}", self.stp_file, start_row=start, n_rows=n
132
+ f"{self.stp_field}/{self.lh5_group}",
133
+ self.stp_file,
134
+ start_row=int(start),
135
+ n_rows=int(n),
133
136
  )
134
137
 
135
138
  # 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.6
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=nObnONsicQ3YX6SG5MVBxmIp5dmRacXDauSqZijWQbY,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=OyXkYdLIpSBmq3MLNXD_kLjVqxeSQcs7RGAOZSy1Bns,14695
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=0KmrekpZwOYZJaP0nmp-SNrr2WmGUKeNUVcqO-OChhY,4757
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.6.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
34
+ reboost-0.2.6.dist-info/METADATA,sha256=Irdm3IrpsoXDPWyqeYSa4QHI6MdACh0ZYAnGMQwofbg,44251
35
+ reboost-0.2.6.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
36
+ reboost-0.2.6.dist-info/entry_points.txt,sha256=DxhD6BidSWNot9BrejHJjQ7RRLmrMaBIl52T75oWTwM,93
37
+ reboost-0.2.6.dist-info/top_level.txt,sha256=q-IBsDepaY_AbzbRmQoW8EZrITXRVawVnNrB-_zyXZs,8
38
+ reboost-0.2.6.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