reboost 0.9.0__tar.gz → 0.9.1__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 (83) hide show
  1. {reboost-0.9.0/src/reboost.egg-info → reboost-0.9.1}/PKG-INFO +1 -1
  2. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/_version.py +3 -3
  3. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/core.py +19 -4
  4. {reboost-0.9.0 → reboost-0.9.1/src/reboost.egg-info}/PKG-INFO +1 -1
  5. {reboost-0.9.0 → reboost-0.9.1}/tests/test_core.py +17 -4
  6. {reboost-0.9.0 → reboost-0.9.1}/LICENSE +0 -0
  7. {reboost-0.9.0 → reboost-0.9.1}/README.md +0 -0
  8. {reboost-0.9.0 → reboost-0.9.1}/pyproject.toml +0 -0
  9. {reboost-0.9.0 → reboost-0.9.1}/setup.cfg +0 -0
  10. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/__init__.py +0 -0
  11. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/__main__.py +0 -0
  12. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/build_evt.py +0 -0
  13. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/build_glm.py +0 -0
  14. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/build_hit.py +0 -0
  15. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/cli.py +0 -0
  16. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/daq/__init__.py +0 -0
  17. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/daq/core.py +0 -0
  18. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/daq/utils.py +0 -0
  19. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/hpge/__init__.py +0 -0
  20. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/hpge/psd.py +0 -0
  21. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/hpge/surface.py +0 -0
  22. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/hpge/utils.py +0 -0
  23. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/iterator.py +0 -0
  24. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/log_utils.py +0 -0
  25. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/math/__init__.py +0 -0
  26. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/math/functions.py +0 -0
  27. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/math/stats.py +0 -0
  28. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/optmap/__init__.py +0 -0
  29. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/optmap/__main__.py +0 -0
  30. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/optmap/cli.py +0 -0
  31. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/optmap/convolve.py +0 -0
  32. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/optmap/create.py +0 -0
  33. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/optmap/evt.py +0 -0
  34. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/optmap/mapview.py +0 -0
  35. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/optmap/numba_pdg.py +0 -0
  36. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/optmap/optmap.py +0 -0
  37. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/profile.py +0 -0
  38. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/shape/__init__.py +0 -0
  39. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/shape/cluster.py +0 -0
  40. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/shape/group.py +0 -0
  41. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/shape/reduction.py +0 -0
  42. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/spms/__init__.py +0 -0
  43. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/spms/pe.py +0 -0
  44. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/units.py +0 -0
  45. {reboost-0.9.0 → reboost-0.9.1}/src/reboost/utils.py +0 -0
  46. {reboost-0.9.0 → reboost-0.9.1}/src/reboost.egg-info/SOURCES.txt +0 -0
  47. {reboost-0.9.0 → reboost-0.9.1}/src/reboost.egg-info/dependency_links.txt +0 -0
  48. {reboost-0.9.0 → reboost-0.9.1}/src/reboost.egg-info/entry_points.txt +0 -0
  49. {reboost-0.9.0 → reboost-0.9.1}/src/reboost.egg-info/not-zip-safe +0 -0
  50. {reboost-0.9.0 → reboost-0.9.1}/src/reboost.egg-info/requires.txt +0 -0
  51. {reboost-0.9.0 → reboost-0.9.1}/src/reboost.egg-info/top_level.txt +0 -0
  52. {reboost-0.9.0 → reboost-0.9.1}/tests/conftest.py +0 -0
  53. {reboost-0.9.0 → reboost-0.9.1}/tests/evt/test_evt.py +0 -0
  54. {reboost-0.9.0 → reboost-0.9.1}/tests/glm/test_build_glm.py +0 -0
  55. {reboost-0.9.0 → reboost-0.9.1}/tests/hit/configs/args.yaml +0 -0
  56. {reboost-0.9.0 → reboost-0.9.1}/tests/hit/configs/basic.yaml +0 -0
  57. {reboost-0.9.0 → reboost-0.9.1}/tests/hit/configs/foward_only.yaml +0 -0
  58. {reboost-0.9.0 → reboost-0.9.1}/tests/hit/configs/geom.gdml +0 -0
  59. {reboost-0.9.0 → reboost-0.9.1}/tests/hit/configs/hit_config.yaml +0 -0
  60. {reboost-0.9.0 → reboost-0.9.1}/tests/hit/configs/pars.yaml +0 -0
  61. {reboost-0.9.0 → reboost-0.9.1}/tests/hit/configs/reshape.yaml +0 -0
  62. {reboost-0.9.0 → reboost-0.9.1}/tests/hit/configs/spms.yaml +0 -0
  63. {reboost-0.9.0 → reboost-0.9.1}/tests/hit/test_build_hit.py +0 -0
  64. {reboost-0.9.0 → reboost-0.9.1}/tests/hpge/simulation/gammas.mac +0 -0
  65. {reboost-0.9.0 → reboost-0.9.1}/tests/hpge/simulation/geometry.gdml +0 -0
  66. {reboost-0.9.0 → reboost-0.9.1}/tests/hpge/simulation/make_dt_map.jl +0 -0
  67. {reboost-0.9.0 → reboost-0.9.1}/tests/hpge/simulation/make_geom.py +0 -0
  68. {reboost-0.9.0 → reboost-0.9.1}/tests/hpge/test_current.py +0 -0
  69. {reboost-0.9.0 → reboost-0.9.1}/tests/hpge/test_dt_heuristic.py +0 -0
  70. {reboost-0.9.0 → reboost-0.9.1}/tests/hpge/test_files/drift_time_maps.lh5 +0 -0
  71. {reboost-0.9.0 → reboost-0.9.1}/tests/hpge/test_files/internal_electron.lh5 +0 -0
  72. {reboost-0.9.0 → reboost-0.9.1}/tests/hpge/test_hpge_map.py +0 -0
  73. {reboost-0.9.0 → reboost-0.9.1}/tests/hpge/test_r90.py +0 -0
  74. {reboost-0.9.0 → reboost-0.9.1}/tests/hpge/test_surface.py +0 -0
  75. {reboost-0.9.0 → reboost-0.9.1}/tests/spms/test_pe.py +0 -0
  76. {reboost-0.9.0 → reboost-0.9.1}/tests/test_cli.py +0 -0
  77. {reboost-0.9.0 → reboost-0.9.1}/tests/test_math.py +0 -0
  78. {reboost-0.9.0 → reboost-0.9.1}/tests/test_optmap.py +0 -0
  79. {reboost-0.9.0 → reboost-0.9.1}/tests/test_optmap_dets.gdml +0 -0
  80. {reboost-0.9.0 → reboost-0.9.1}/tests/test_profile.py +0 -0
  81. {reboost-0.9.0 → reboost-0.9.1}/tests/test_shape.py +0 -0
  82. {reboost-0.9.0 → reboost-0.9.1}/tests/test_units.py +0 -0
  83. {reboost-0.9.0 → reboost-0.9.1}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reboost
3
- Version: 0.9.0
3
+ Version: 0.9.1
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
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '0.9.0'
32
- __version_tuple__ = version_tuple = (0, 9, 0)
31
+ __version__ = version = '0.9.1'
32
+ __version_tuple__ = version_tuple = (0, 9, 1)
33
33
 
34
- __commit_id__ = commit_id = 'g0f7fc07b4'
34
+ __commit_id__ = commit_id = 'g366fa2abd'
@@ -18,9 +18,18 @@ log = logging.getLogger(__name__)
18
18
 
19
19
 
20
20
  def read_data_at_channel_as_ak(
21
- channels: ak.Array, rows: ak.Array, file: str, field: str, group: str, tab_map: dict[int, str]
21
+ channels: ak.Array,
22
+ rows: ak.Array,
23
+ file: str,
24
+ field: str,
25
+ group: str,
26
+ tab_map: dict[int, str],
27
+ with_units: bool = False,
22
28
  ) -> ak.Array:
23
- r"""Read the data from a particular field to an awkward array. This replaces the TCM like object defined by the channels and rows with the corresponding data field.
29
+ r"""Read the data from a particular field to an Awkward array.
30
+
31
+ This replaces the TCM like object defined by the channels and rows with the
32
+ corresponding data field.
24
33
 
25
34
  Parameters
26
35
  ----------
@@ -68,7 +77,9 @@ def read_data_at_channel_as_ak(
68
77
  tcm_rows = np.where(ak.flatten(channels == key))[0]
69
78
 
70
79
  # read the data with sorted idx
71
- data_ch = lh5.read(f"{group}/{tab_name}/{field}", file, idx=idx[arg_idx]).view_as("ak")
80
+ data_ch = lh5.read(f"{group}/{tab_name}/{field}", file, idx=idx[arg_idx])
81
+ units = data_ch.attrs.get("units", None)
82
+ data_ch = data_ch.view_as("ak")
72
83
 
73
84
  # sort back to order for tcm
74
85
  data_ch = data_ch[np.argsort(arg_idx)]
@@ -85,8 +96,12 @@ def read_data_at_channel_as_ak(
85
96
 
86
97
  # sort the final data
87
98
  data_flat = data_flat[np.argsort(tcm_rows_full)]
99
+ data_unflat = ak.unflatten(data_flat, reorder)
100
+
101
+ if with_units and units is not None:
102
+ return ak.with_parameter(data_unflat, "units", units)
88
103
 
89
- return ak.unflatten(data_flat, reorder)
104
+ return data_unflat
90
105
 
91
106
 
92
107
  def evaluate_output_column(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reboost
3
- Version: 0.9.0
3
+ Version: 0.9.1
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
@@ -59,13 +59,13 @@ def hitfiles(tmptestdir):
59
59
  # make some hit tier files
60
60
  channel1 = Table(
61
61
  {
62
- "energy": Array([100, 200, 400, 300]),
62
+ "energy": Array([100, 200, 400, 300], attrs={"units": "keV"}),
63
63
  "times": VectorOfVectors([[0.1], [0.2, 0.3], [0.4, 98], [2]]),
64
64
  }
65
65
  )
66
66
  channel2 = Table(
67
67
  {
68
- "energy": Array([10, 70, 0, 56, 400, 400]),
68
+ "energy": Array([10, 70, 0, 56, 400, 400], attrs={"units": "keV"}),
69
69
  "times": VectorOfVectors([[12], [], [-0.4, 0.4], [89], [1], [2]]),
70
70
  }
71
71
  )
@@ -83,12 +83,13 @@ def hitfiles(tmptestdir):
83
83
 
84
84
  def test_read_data_at_channel(hitfiles):
85
85
  # make a TCM
86
- tcm_channels = ak.Array([[0], [0], [0, 1], [1], [1], [0, 1], [1], [1]])
87
- tcm_rows = ak.Array([[0], [1], [2, 0], [1], [2], [3, 3], [4], [5]])
86
+ tcm_channels = ak.Array([[0], [0], [0, 1], [1], [1], [0, 1], [1], [], [1]])
87
+ tcm_rows = ak.Array([[0], [1], [2, 0], [1], [2], [3, 3], [4], [], [5]])
88
88
 
89
89
  energy = reboost.core.read_data_at_channel_as_ak(
90
90
  tcm_channels, tcm_rows, hitfiles[2], "energy", "hit", {"det001": 0, "det002": 1}
91
91
  )
92
+ assert "units" not in ak.parameters(energy)
92
93
 
93
94
  # check the same
94
95
  assert len(energy) == len(tcm_channels)
@@ -105,6 +106,18 @@ def test_read_data_at_channel(hitfiles):
105
106
  )
106
107
  assert len(times) == len(tcm_channels)
107
108
 
109
+ energy = reboost.core.read_data_at_channel_as_ak(
110
+ tcm_channels,
111
+ tcm_rows,
112
+ hitfiles[2],
113
+ "energy",
114
+ "hit",
115
+ {"det001": 0, "det002": 1},
116
+ with_units=True,
117
+ )
118
+ assert "units" in ak.parameters(energy)
119
+ assert ak.parameters(energy)["units"] == "keV"
120
+
108
121
 
109
122
  def test_get_objects(test_data_configs, make_gdml):
110
123
  # check basic eval
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
File without changes
File without changes
File without changes
File without changes
File without changes