reboost 0.5.4__tar.gz → 0.5.5__tar.gz

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.
Files changed (71) hide show
  1. {reboost-0.5.4 → reboost-0.5.5}/PKG-INFO +1 -1
  2. {reboost-0.5.4 → reboost-0.5.5}/src/reboost/_version.py +2 -2
  3. {reboost-0.5.4 → reboost-0.5.5}/src/reboost/utils.py +33 -5
  4. {reboost-0.5.4 → reboost-0.5.5}/src/reboost.egg-info/PKG-INFO +1 -1
  5. {reboost-0.5.4 → reboost-0.5.5}/tests/hit/test_build_hit.py +54 -0
  6. {reboost-0.5.4 → reboost-0.5.5}/tests/test_utils.py +1 -0
  7. {reboost-0.5.4 → reboost-0.5.5}/LICENSE +0 -0
  8. {reboost-0.5.4 → reboost-0.5.5}/README.md +0 -0
  9. {reboost-0.5.4 → reboost-0.5.5}/pyproject.toml +0 -0
  10. {reboost-0.5.4 → reboost-0.5.5}/setup.cfg +0 -0
  11. {reboost-0.5.4 → reboost-0.5.5}/src/reboost/__init__.py +0 -0
  12. {reboost-0.5.4 → reboost-0.5.5}/src/reboost/build_evt.py +0 -0
  13. {reboost-0.5.4 → reboost-0.5.5}/src/reboost/build_glm.py +0 -0
  14. {reboost-0.5.4 → reboost-0.5.5}/src/reboost/build_hit.py +0 -0
  15. {reboost-0.5.4 → reboost-0.5.5}/src/reboost/cli.py +0 -0
  16. {reboost-0.5.4 → reboost-0.5.5}/src/reboost/core.py +0 -0
  17. {reboost-0.5.4 → reboost-0.5.5}/src/reboost/hpge/__init__.py +0 -0
  18. {reboost-0.5.4 → reboost-0.5.5}/src/reboost/hpge/psd.py +0 -0
  19. {reboost-0.5.4 → reboost-0.5.5}/src/reboost/hpge/surface.py +0 -0
  20. {reboost-0.5.4 → reboost-0.5.5}/src/reboost/hpge/utils.py +0 -0
  21. {reboost-0.5.4 → reboost-0.5.5}/src/reboost/iterator.py +0 -0
  22. {reboost-0.5.4 → reboost-0.5.5}/src/reboost/log_utils.py +0 -0
  23. {reboost-0.5.4 → reboost-0.5.5}/src/reboost/math/__init__.py +0 -0
  24. {reboost-0.5.4 → reboost-0.5.5}/src/reboost/math/functions.py +0 -0
  25. {reboost-0.5.4 → reboost-0.5.5}/src/reboost/math/stats.py +0 -0
  26. {reboost-0.5.4 → reboost-0.5.5}/src/reboost/optmap/__init__.py +0 -0
  27. {reboost-0.5.4 → reboost-0.5.5}/src/reboost/optmap/cli.py +0 -0
  28. {reboost-0.5.4 → reboost-0.5.5}/src/reboost/optmap/convolve.py +0 -0
  29. {reboost-0.5.4 → reboost-0.5.5}/src/reboost/optmap/create.py +0 -0
  30. {reboost-0.5.4 → reboost-0.5.5}/src/reboost/optmap/evt.py +0 -0
  31. {reboost-0.5.4 → reboost-0.5.5}/src/reboost/optmap/mapview.py +0 -0
  32. {reboost-0.5.4 → reboost-0.5.5}/src/reboost/optmap/numba_pdg.py +0 -0
  33. {reboost-0.5.4 → reboost-0.5.5}/src/reboost/optmap/optmap.py +0 -0
  34. {reboost-0.5.4 → reboost-0.5.5}/src/reboost/profile.py +0 -0
  35. {reboost-0.5.4 → reboost-0.5.5}/src/reboost/shape/__init__.py +0 -0
  36. {reboost-0.5.4 → reboost-0.5.5}/src/reboost/shape/cluster.py +0 -0
  37. {reboost-0.5.4 → reboost-0.5.5}/src/reboost/shape/group.py +0 -0
  38. {reboost-0.5.4 → reboost-0.5.5}/src/reboost/shape/reduction.py +0 -0
  39. {reboost-0.5.4 → reboost-0.5.5}/src/reboost/units.py +0 -0
  40. {reboost-0.5.4 → reboost-0.5.5}/src/reboost.egg-info/SOURCES.txt +0 -0
  41. {reboost-0.5.4 → reboost-0.5.5}/src/reboost.egg-info/dependency_links.txt +0 -0
  42. {reboost-0.5.4 → reboost-0.5.5}/src/reboost.egg-info/entry_points.txt +0 -0
  43. {reboost-0.5.4 → reboost-0.5.5}/src/reboost.egg-info/not-zip-safe +0 -0
  44. {reboost-0.5.4 → reboost-0.5.5}/src/reboost.egg-info/requires.txt +0 -0
  45. {reboost-0.5.4 → reboost-0.5.5}/src/reboost.egg-info/top_level.txt +0 -0
  46. {reboost-0.5.4 → reboost-0.5.5}/tests/conftest.py +0 -0
  47. {reboost-0.5.4 → reboost-0.5.5}/tests/glm/test_build_glm.py +0 -0
  48. {reboost-0.5.4 → reboost-0.5.5}/tests/hit/configs/args.yaml +0 -0
  49. {reboost-0.5.4 → reboost-0.5.5}/tests/hit/configs/basic.yaml +0 -0
  50. {reboost-0.5.4 → reboost-0.5.5}/tests/hit/configs/geom.gdml +0 -0
  51. {reboost-0.5.4 → reboost-0.5.5}/tests/hit/configs/hit_config.yaml +0 -0
  52. {reboost-0.5.4 → reboost-0.5.5}/tests/hit/configs/pars.yaml +0 -0
  53. {reboost-0.5.4 → reboost-0.5.5}/tests/hit/configs/reshape.yaml +0 -0
  54. {reboost-0.5.4 → reboost-0.5.5}/tests/hpge/simulation/gammas.mac +0 -0
  55. {reboost-0.5.4 → reboost-0.5.5}/tests/hpge/simulation/geometry.gdml +0 -0
  56. {reboost-0.5.4 → reboost-0.5.5}/tests/hpge/simulation/make_dt_map.jl +0 -0
  57. {reboost-0.5.4 → reboost-0.5.5}/tests/hpge/simulation/make_geom.py +0 -0
  58. {reboost-0.5.4 → reboost-0.5.5}/tests/hpge/test_current.py +0 -0
  59. {reboost-0.5.4 → reboost-0.5.5}/tests/hpge/test_dt_heuristic.py +0 -0
  60. {reboost-0.5.4 → reboost-0.5.5}/tests/hpge/test_files/drift_time_maps.lh5 +0 -0
  61. {reboost-0.5.4 → reboost-0.5.5}/tests/hpge/test_files/internal_electron.lh5 +0 -0
  62. {reboost-0.5.4 → reboost-0.5.5}/tests/hpge/test_hpge_map.py +0 -0
  63. {reboost-0.5.4 → reboost-0.5.5}/tests/hpge/test_r90.py +0 -0
  64. {reboost-0.5.4 → reboost-0.5.5}/tests/hpge/test_surface.py +0 -0
  65. {reboost-0.5.4 → reboost-0.5.5}/tests/test_cli.py +0 -0
  66. {reboost-0.5.4 → reboost-0.5.5}/tests/test_core.py +0 -0
  67. {reboost-0.5.4 → reboost-0.5.5}/tests/test_math.py +0 -0
  68. {reboost-0.5.4 → reboost-0.5.5}/tests/test_optmap.py +0 -0
  69. {reboost-0.5.4 → reboost-0.5.5}/tests/test_profile.py +0 -0
  70. {reboost-0.5.4 → reboost-0.5.5}/tests/test_shape.py +0 -0
  71. {reboost-0.5.4 → reboost-0.5.5}/tests/test_units.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reboost
3
- Version: 0.5.4
3
+ Version: 0.5.5
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
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '0.5.4'
21
- __version_tuple__ = version_tuple = (0, 5, 4)
20
+ __version__ = version = '0.5.5'
21
+ __version_tuple__ = version_tuple = (0, 5, 5)
@@ -20,8 +20,35 @@ log = logging.getLogger(__name__)
20
20
 
21
21
  def get_wo_mode(
22
22
  group: int, out_det: int, in_det: int, chunk: int, new_hit_file: bool, overwrite: bool = False
23
- ):
24
- """Get the mode for lh5 file writing."""
23
+ ) -> str:
24
+ """Get the mode for lh5 file writing.
25
+
26
+ If all indices are 0 and we are writing a new output file
27
+ then the mode "overwrite_file" is used (if the overwrite) flag
28
+ is set, otherwise the mode "write_safe" is used.
29
+
30
+ Otherwise the code choses between "append_column" if this is the
31
+ first time a group is being written to the file, or "append"
32
+
33
+ Parameters
34
+ ----------
35
+ group
36
+ the index of the processing group
37
+ out_det
38
+ the index of the output detector
39
+ in_det
40
+ the index of the input detector
41
+ chunk
42
+ the chunk index
43
+ new_hit_file
44
+ a flag of whether we are writing a new hit file
45
+ overwrite
46
+ a flag of whether to overwrite the old file.
47
+
48
+ Returns
49
+ -------
50
+ the mode for IO
51
+ """
25
52
  indices = [group, out_det, in_det, chunk]
26
53
 
27
54
  good_idx = all(i == 0 for i in indices)
@@ -30,9 +57,10 @@ def get_wo_mode(
30
57
  return "overwrite_file" if overwrite else "write_safe"
31
58
 
32
59
  # if we have a detector not the first and chunk 0 append column
33
- is_append = ((in_det > 0) or (out_det > 0)) & (chunk == 0)
34
- is_append = is_append or (in_det == 0 and out_det == 0 and chunk == 0 and group > 0)
35
- if is_append:
60
+ is_ac = ((in_det > 0) or (out_det > 0)) & (chunk == 0)
61
+ is_ac = is_ac or (in_det == 0 and out_det == 0 and chunk == 0 and (group > 0))
62
+
63
+ if is_ac and new_hit_file:
36
64
  return "append_column"
37
65
  return "append"
38
66
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reboost
3
- Version: 0.5.4
3
+ Version: 0.5.5
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
@@ -179,6 +179,60 @@ def test_file_merging(test_gen_lh5, tmptestdir):
179
179
  assert len(hits) == 4
180
180
 
181
181
 
182
+ def test_multi_file(test_gen_lh5, tmptestdir):
183
+ outfile = [f"{tmptestdir}/basic_hit_t0.lh5", f"{tmptestdir}/basic_hit_t1.lh5"]
184
+
185
+ reboost.build_hit(
186
+ f"{Path(__file__).parent}/configs/basic.yaml",
187
+ args={},
188
+ stp_files=[test_gen_lh5, test_gen_lh5],
189
+ glm_files=None,
190
+ hit_files=outfile,
191
+ overwrite=True,
192
+ )
193
+
194
+ for file in outfile:
195
+ assert lh5.ls(file) == ["hit", "vtx"]
196
+
197
+ hits = lh5.read("hit/det1", file).view_as("ak")
198
+
199
+ assert len(hits) == 2
200
+
201
+
202
+ def test_overwrite(test_gen_lh5, tmptestdir):
203
+ # test with two output files
204
+ outfile = [f"{tmptestdir}/basic_hit_t0.lh5", f"{tmptestdir}/basic_hit_t1.lh5"]
205
+
206
+ reboost.build_hit(
207
+ f"{Path(__file__).parent}/configs/basic.yaml",
208
+ args={},
209
+ stp_files=[test_gen_lh5, test_gen_lh5],
210
+ glm_files=None,
211
+ hit_files=outfile,
212
+ overwrite=True,
213
+ )
214
+ for file in outfile:
215
+ assert lh5.ls(file) == ["hit", "vtx"]
216
+
217
+ hits = lh5.read("hit/det1", file).view_as("ak")
218
+
219
+ assert len(hits) == 2
220
+
221
+ outfile = f"{tmptestdir}/basic_hit_merged.lh5"
222
+
223
+ reboost.build_hit(
224
+ f"{Path(__file__).parent}/configs/basic.yaml",
225
+ args={},
226
+ stp_files=[test_gen_lh5, test_gen_lh5],
227
+ glm_files=None,
228
+ hit_files=outfile,
229
+ overwrite=True,
230
+ )
231
+ assert lh5.ls(outfile) == ["hit", "vtx"]
232
+ hits = lh5.read("hit/det1", outfile).view_as("ak")
233
+ assert len(hits) == 4
234
+
235
+
182
236
  def test_full_chain(test_gen_lh5, tmptestdir):
183
237
  args = dbetto.AttrsDict(
184
238
  {
@@ -122,6 +122,7 @@ def test_wo_mode():
122
122
  assert get_wo_mode(0, 0, 0, 0, True, overwrite=False) == "write_safe"
123
123
  assert get_wo_mode(0, 0, 1, 0, True, overwrite=False) == "append_column"
124
124
  assert get_wo_mode(0, 0, 1, 1, True, overwrite=False) == "append"
125
+ assert get_wo_mode(0, 0, 1, 0, False, overwrite=False) == "append"
125
126
 
126
127
 
127
128
  def test_get_files_dict():
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes