reboost 0.3.0__py3-none-any.whl → 0.4.2__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/optmap/cli.py CHANGED
@@ -188,7 +188,7 @@ def optical_cli() -> None:
188
188
 
189
189
  # STEP 1: build evt file from hit tier
190
190
  if args.command == "evt":
191
- from reboost.optmap.evt import build_optmap_evt
191
+ from .evt import build_optmap_evt
192
192
 
193
193
  _check_input_file(parser, args.detectors)
194
194
  _check_input_file(parser, args.input)
@@ -202,7 +202,7 @@ def optical_cli() -> None:
202
202
 
203
203
  # STEP 2a: build map file from evt tier
204
204
  if args.command == "createmap":
205
- from reboost.optmap.create import create_optical_maps
205
+ from .create import create_optical_maps
206
206
 
207
207
  _check_input_file(parser, args.input)
208
208
  _check_output_file(parser, args.output)
@@ -230,7 +230,7 @@ def optical_cli() -> None:
230
230
 
231
231
  # STEP 2b: view maps
232
232
  if args.command == "viewmap":
233
- from reboost.optmap.mapview import view_optmap
233
+ from .mapview import view_optmap
234
234
 
235
235
  _check_input_file(parser, args.input)
236
236
  if args.divide is not None:
@@ -247,7 +247,7 @@ def optical_cli() -> None:
247
247
 
248
248
  # STEP 2c: merge maps
249
249
  if args.command == "mergemap":
250
- from reboost.optmap.create import merge_optical_maps
250
+ from .create import merge_optical_maps
251
251
 
252
252
  # load settings for binning from config file.
253
253
  _check_input_file(parser, args.input, "settings")
@@ -262,14 +262,14 @@ def optical_cli() -> None:
262
262
 
263
263
  # STEP 2d: check maps
264
264
  if args.command == "checkmap":
265
- from reboost.optmap.create import check_optical_map
265
+ from .create import check_optical_map
266
266
 
267
267
  _check_input_file(parser, args.input)
268
268
  check_optical_map(args.input)
269
269
 
270
270
  # STEP 3: convolve with hits from non-optical simulations
271
271
  if args.command == "convolve":
272
- from reboost.optmap.convolve import convolve
272
+ from .convolve import convolve
273
273
 
274
274
  _check_input_file(parser, [args.map, args.edep])
275
275
  _check_output_file(parser, args.output, optional=True)
@@ -285,7 +285,7 @@ def optical_cli() -> None:
285
285
 
286
286
  # STEP X: rebin maps
287
287
  if args.command == "rebin":
288
- from reboost.optmap.create import rebin_optical_maps
288
+ from .create import rebin_optical_maps
289
289
 
290
290
  _check_input_file(parser, args.input)
291
291
  _check_output_file(parser, args.output)
reboost/shape/group.py CHANGED
@@ -122,7 +122,7 @@ def group_by_time(
122
122
 
123
123
  # get difference
124
124
  time_diffs = np.diff(obj[time_name])
125
- index_diffs = np.array(np.diff(obj[evtid_name]), dtype=np.int32)
125
+ index_diffs = np.diff(obj[evtid_name])
126
126
 
127
127
  # index of the last element in each run
128
128
  time_change = (time_diffs > window * 1000) & (index_diffs == 0)
reboost/utils.py CHANGED
@@ -4,12 +4,16 @@ import importlib
4
4
  import itertools
5
5
  import logging
6
6
  import re
7
+ import time
7
8
  from collections.abc import Iterable, Mapping
8
9
  from contextlib import contextmanager
9
10
  from pathlib import Path
10
11
 
11
12
  from dbetto import AttrsDict
12
- from lgdo.types import Table, VectorOfVectors
13
+ from lgdo import lh5
14
+ from lgdo.types import Struct, Table, VectorOfVectors
15
+
16
+ from .profile import ProfileDict
13
17
 
14
18
  log = logging.getLogger(__name__)
15
19
 
@@ -304,3 +308,49 @@ def _check_output_file(parser, file: str | Iterable[str] | None, optional: bool
304
308
  for f in file:
305
309
  if Path(f).exists():
306
310
  parser.error(f"output file {f} already exists")
311
+
312
+
313
+ def write_lh5(
314
+ hit_table: Table,
315
+ file: str,
316
+ time_dict: ProfileDict,
317
+ out_field: str,
318
+ out_detector: str,
319
+ wo_mode: str,
320
+ ):
321
+ """Write the lh5 file. This function handles writing first the data as a struct and then appending to this.
322
+
323
+ Parameters
324
+ ----------
325
+ hit_table
326
+ the table to write
327
+ file
328
+ the file to write to
329
+ time_dict
330
+ the dictionary of timing information to update.
331
+ out_field
332
+ output field
333
+ out_detector
334
+ output detector name
335
+ wo_mode
336
+ the mode to pass to `lh5.write`
337
+ """
338
+ if time_dict is not None:
339
+ start_time = time.time()
340
+
341
+ if wo_mode != "a":
342
+ lh5.write(
343
+ Struct({out_detector: hit_table}),
344
+ out_field,
345
+ file,
346
+ wo_mode=wo_mode,
347
+ )
348
+ else:
349
+ lh5.write(
350
+ hit_table,
351
+ f"{out_field}/{out_detector}",
352
+ file,
353
+ wo_mode=wo_mode,
354
+ )
355
+ if time_dict is not None:
356
+ time_dict.update_field("write", start_time)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reboost
3
- Version: 0.3.0
3
+ Version: 0.4.2
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,25 +1,25 @@
1
- reboost/__init__.py,sha256=RVNl3Qgx_hTUeBGXaWYmiTcmXUDhTfvlAGGC8bo_jP8,316
2
- reboost/_version.py,sha256=AGmG_Lx0-9ztFw_7d9mYbaYuC-2abxE1oXOUNAY29YY,511
1
+ reboost/__init__.py,sha256=2Lc9Idexf1S3IQvHQS1LPD-SCud7Mnmpr2dJ6U-ThvU,303
2
+ reboost/_version.py,sha256=_F8vLxUxrAtC2alXNPGVa9l3P6_vLpQAzemS6QlnPGQ,511
3
3
  reboost/build_evt.py,sha256=zj3wG_kaV3EoRMQ33AkCNa_2Fv8cLtRuhyRyRmSrOYQ,4797
4
- reboost/build_glm.py,sha256=VIzRyCc53FQvcXAVbARszNH5wH5Pr0a9WWlSCZuUY5w,9380
5
- reboost/build_hit.py,sha256=Zu8WoeFYtFU_xUO3I8OZM5psNaiv1boMJPnBWC58nfQ,14958
6
- reboost/build_tcm.py,sha256=-PawBHoHj0zsm4XsZu5bco9d9a09STicZchduefSNfI,2951
7
- reboost/cli.py,sha256=swPJcYzvg18rSOMN-mpe0PCMf1-a9V7osIssX7JP7k0,6459
8
- reboost/core.py,sha256=7Nclc6RUCOSJ1CWVAX0rFNJGM1LEgqvc4tD04CxEAtg,10766
9
- reboost/iterator.py,sha256=D0aDCwtUKeo3_JQQKrmYmFc7jbqcKb5jrpMkUuaJ76s,4762
4
+ reboost/build_glm.py,sha256=zRTXTmlvHePcFDJkJwBbIo5nMjW0ZP4-2CJvqN2QBe8,9525
5
+ reboost/build_hit.py,sha256=tf7KBp8DYuAmT-k6oBF54rjlIu_y9tVuyuGldA2I0Jk,15247
6
+ reboost/build_tcm.py,sha256=Ntf2nrS072SGlZzdTHETtaQdhl0tL3ikvdzrOQvlb-E,2944
7
+ reboost/cli.py,sha256=YZvCaxkU0VA_xMAeyw1PN_x17RUkl8uzv19nkNkz3kE,6509
8
+ reboost/core.py,sha256=B577b5KzAYpGI7c4eCxIRKgt9tq6hwVr2-DtYTml1e8,12826
9
+ reboost/iterator.py,sha256=YFsNjC2Onsyhvkogbs79eD8iqstCdCAfFEaEOMr_ujg,6810
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=VheyCMcaXT5VPXAotiI5YqLKTf45KhTMpwULg2xyB3o,8531
13
+ reboost/utils.py,sha256=CL83IBkddFXdzD83JXGQeZ_N6WxJ8qwj7GgBt1vzmbg,9652
14
14
  reboost/hpge/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
- reboost/hpge/psd.py,sha256=868OUJzO9TNja0YSrZ3NDGeEAbUtpDZnmvBDm0jCC9E,6856
16
- reboost/hpge/surface.py,sha256=SZyTmOCTipf27jYaJhtdInzGF1RZ2wKpbtf6HlOQYwM,3662
15
+ reboost/hpge/psd.py,sha256=jAUAoQ_PMz76wyA1NXYHNKtOwoCnRT3My8_LCFrKi-U,13860
16
+ reboost/hpge/surface.py,sha256=lbWcFnFFWKxtFKs755GyM9US_IfyxaoM6MpOIZgIMM0,7478
17
17
  reboost/hpge/utils.py,sha256=0Rx4HubCOm8JMECjWcAJXfAch9OkSlRpUkdsSlzwZ2E,2830
18
18
  reboost/math/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  reboost/math/functions.py,sha256=OymiYTcA0NXxxm-MBDw5kqyNwHoLCmuv4J48AwnSrbU,5633
20
20
  reboost/math/stats.py,sha256=iiOEi87x93kqPWeSmlRiA5Oe-R8XR-plm6Z532PhC9M,1401
21
21
  reboost/optmap/__init__.py,sha256=imvuyld-GLw8qdwqW-lXCg2feptcTyQo3wIzPvDHwmY,93
22
- reboost/optmap/cli.py,sha256=TszAYZIwHTXwJYQOMKxreCZ6pXlGUb6q6YZ3iW3Bxf4,9670
22
+ reboost/optmap/cli.py,sha256=SzbPRgsbR5Llm3aSJubH02Ym8FQyTH7kvuLjK7faLiY,9572
23
23
  reboost/optmap/convolve.py,sha256=jCH_d04yioB8hsJEPunm0zynA0ne4lx0ldSC1GJG_eY,14129
24
24
  reboost/optmap/create.py,sha256=Nm5-xEe8M9q2GFQnUv8oN8qpAz9nZArIrQcPboqRmCQ,17153
25
25
  reboost/optmap/evt.py,sha256=9rfAdN9MqL6UuUxUcMDGVwpcuqRVc2RwmEmd87jgYww,4698
@@ -28,11 +28,11 @@ reboost/optmap/numba_pdg.py,sha256=y8cXR5PWE2Liprp4ou7vl9do76dl84vXU52ZJD9_I7A,7
28
28
  reboost/optmap/optmap.py,sha256=j4rfbQ84PYSpE-BvP4Rdt96ZjPdwy8P4e4eZz1mATys,12817
29
29
  reboost/shape/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
30
  reboost/shape/cluster.py,sha256=RIvBlhHzp88aaUZGofp5SD9bimnoiqIOddhQ84jiwoM,8135
31
- reboost/shape/group.py,sha256=Q3DhEPxbhw3p4bwvpswSd0A-p224l5vRZnfQIEkOVJE,4475
31
+ reboost/shape/group.py,sha256=_z2qCOret3E-kj-nrp1-J5j2lEwQpgfYdQp2pgpDHR8,4449
32
32
  reboost/shape/reduction.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
- reboost-0.3.0.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
34
- reboost-0.3.0.dist-info/METADATA,sha256=GCn2W1jn_cplxbS1-bJCRjghoEaPgscoTuAhVkizXVY,44251
35
- reboost-0.3.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
36
- reboost-0.3.0.dist-info/entry_points.txt,sha256=DxhD6BidSWNot9BrejHJjQ7RRLmrMaBIl52T75oWTwM,93
37
- reboost-0.3.0.dist-info/top_level.txt,sha256=q-IBsDepaY_AbzbRmQoW8EZrITXRVawVnNrB-_zyXZs,8
38
- reboost-0.3.0.dist-info/RECORD,,
33
+ reboost-0.4.2.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
34
+ reboost-0.4.2.dist-info/METADATA,sha256=TnY5hEIWwoDYIwUEvTW5UeAKpI9t3hU5TCFzl1j8cQM,44251
35
+ reboost-0.4.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
36
+ reboost-0.4.2.dist-info/entry_points.txt,sha256=DxhD6BidSWNot9BrejHJjQ7RRLmrMaBIl52T75oWTwM,93
37
+ reboost-0.4.2.dist-info/top_level.txt,sha256=q-IBsDepaY_AbzbRmQoW8EZrITXRVawVnNrB-_zyXZs,8
38
+ reboost-0.4.2.dist-info/RECORD,,