legend-pydataobj 1.11.3__py3-none-any.whl → 1.11.5__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: legend_pydataobj
3
- Version: 1.11.3
3
+ Version: 1.11.5
4
4
  Summary: LEGEND Python Data Objects
5
5
  Author: The LEGEND Collaboration
6
6
  Maintainer: The LEGEND Collaboration
@@ -1,5 +1,5 @@
1
1
  lgdo/__init__.py,sha256=QMYK9HhoMi0pbahPN8mPD18gyTxscFgo7QKfCxVhy-0,3196
2
- lgdo/_version.py,sha256=T2YM9w8KO8zThn0UoO-QJVXyTdR0uuWyR6VszamBivY,413
2
+ lgdo/_version.py,sha256=DTx-xWFNqQz9P95loDaKgAV4WuiaQCg5aAro9mWfGoA,413
3
3
  lgdo/cli.py,sha256=Qm2EPmoIVxENAR8BeW7oWpTdHT4GbV-owfzM5NkgjvM,9353
4
4
  lgdo/lgdo_utils.py,sha256=6a2YWEwpyEMXlAyTHZMO01aqxy6SxJzPZkGNWKNWuS0,2567
5
5
  lgdo/lh5_store.py,sha256=5BzbJA9sLcqjp8bJDc2olwOiw0VS6rmfg3cfh1kQkRY,8512
@@ -30,7 +30,7 @@ lgdo/lh5/_serializers/read/scalar.py,sha256=kwhWm1T91pXf86CqtUUD8_qheSR92gXZrQVt
30
30
  lgdo/lh5/_serializers/read/utils.py,sha256=USacxDA0eY-u9lDOZDuJHcScoSVMNeAYljmRvW0T1Jk,7587
31
31
  lgdo/lh5/_serializers/read/vector_of_vectors.py,sha256=Fqh2gXFqeR2y0ofQn4GoSdSAATPvHiuBzzcgL16e6ss,7205
32
32
  lgdo/lh5/_serializers/write/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
- lgdo/lh5/_serializers/write/array.py,sha256=eyVPwwddVOR9TNNyliCNYlS-XYXsdTEA8QoTnnOYJbw,2943
33
+ lgdo/lh5/_serializers/write/array.py,sha256=66DKnW2yqIBlUGNBPWcE-m4W0B2-nTKusDHGX9m6GY0,3223
34
34
  lgdo/lh5/_serializers/write/composite.py,sha256=I6lH0nWFIpAfZyG4-0rLxzg3mfazZ_FEhQVp1FZ0aA4,9254
35
35
  lgdo/lh5/_serializers/write/scalar.py,sha256=JPt_fcdTKOSFp5hfJdcKIfK4hxhcD8vhOlvDF-7btQ8,763
36
36
  lgdo/lh5/_serializers/write/vector_of_vectors.py,sha256=puGQX9XF5P_5DVbm_Cc6TvPrsDywgBLSYtkqFNltbB4,3493
@@ -44,12 +44,12 @@ lgdo/types/lgdo.py,sha256=RQ2P70N7IWMBDnLLuJI3sm6zQTIKyOMSsKZtBNzmE90,2928
44
44
  lgdo/types/scalar.py,sha256=c5Es2vyDqyWTPV6mujzfIzMpC1jNWkEIcvYyWQUxH3Q,1933
45
45
  lgdo/types/struct.py,sha256=Q0OWLVd4B0ciLb8t6VsxU3MPbmGLZ7WfQNno1lSQS0Q,4918
46
46
  lgdo/types/table.py,sha256=KPxKeLKqKQPkC_H75XraW0c1KRAhDdyGKBktVkD-KLw,18779
47
- lgdo/types/vectorofvectors.py,sha256=cic9PsZ5EptQ6RMsykYeVHA8T7fh_KBZCcqeTP4i1wU,24395
47
+ lgdo/types/vectorofvectors.py,sha256=Al9FmY44M-vnzhPdQlFOzwm06LNGBI7RSLSdU5pl9us,24663
48
48
  lgdo/types/vovutils.py,sha256=7BWPP0BSj-92ifbCIUBcfqxG5-TS8uxujTyJJuDFI04,10302
49
49
  lgdo/types/waveformtable.py,sha256=f2tS4f1OEoYaTM5ldCX9zmw8iSISCT3t3wS1SrPdu_o,9901
50
- legend_pydataobj-1.11.3.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
51
- legend_pydataobj-1.11.3.dist-info/METADATA,sha256=rYpLl_oH_V8OMAXKOb-0YOl_Y_GdtCfi91ZnrI7rVTU,44382
52
- legend_pydataobj-1.11.3.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
53
- legend_pydataobj-1.11.3.dist-info/entry_points.txt,sha256=Uu5MTlppBZxB4QGlLv-oX8FqACWjAZDNii__TBDJwLQ,72
54
- legend_pydataobj-1.11.3.dist-info/top_level.txt,sha256=KyR-EUloqiXcQ62IWnzBmtInDtvsHl4q2ZJAZgTcLXE,5
55
- legend_pydataobj-1.11.3.dist-info/RECORD,,
50
+ legend_pydataobj-1.11.5.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
51
+ legend_pydataobj-1.11.5.dist-info/METADATA,sha256=fV8jiU0IVhLxZWz9r6MdH1v53yEecRwaWlF8jN5zxxc,44382
52
+ legend_pydataobj-1.11.5.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
53
+ legend_pydataobj-1.11.5.dist-info/entry_points.txt,sha256=Uu5MTlppBZxB4QGlLv-oX8FqACWjAZDNii__TBDJwLQ,72
54
+ legend_pydataobj-1.11.5.dist-info/top_level.txt,sha256=KyR-EUloqiXcQ62IWnzBmtInDtvsHl4q2ZJAZgTcLXE,5
55
+ legend_pydataobj-1.11.5.dist-info/RECORD,,
lgdo/_version.py CHANGED
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '1.11.3'
16
- __version_tuple__ = version_tuple = (1, 11, 3)
15
+ __version__ = version = '1.11.5'
16
+ __version_tuple__ = version_tuple = (1, 11, 5)
@@ -64,6 +64,11 @@ def _h5_write_array(
64
64
  if "hdf5_settings" in obj.attrs:
65
65
  h5py_kwargs |= obj.attrs["hdf5_settings"]
66
66
 
67
+ # HACK: a tuple is strictly requested for the "chunks" setting, but
68
+ # we'd like to pass a list too in some situations
69
+ if "chunks" in h5py_kwargs and isinstance(h5py_kwargs["chunks"], list):
70
+ h5py_kwargs["chunks"] = tuple(h5py_kwargs["chunks"])
71
+
67
72
  # create HDF5 dataset
68
73
  ds = group.create_dataset(name, data=nda, **h5py_kwargs)
69
74
 
@@ -13,6 +13,7 @@ import awkward as ak
13
13
  import awkward_pandas as akpd
14
14
  import numpy as np
15
15
  import pandas as pd
16
+ from numba import jit
16
17
  from numpy.typing import ArrayLike, DTypeLike, NDArray
17
18
 
18
19
  from .. import utils
@@ -560,18 +561,16 @@ class VectorOfVectors(LGDO):
560
561
  compatible one.
561
562
  """
562
563
  if self.ndim == 2:
563
- ak_arr = self.view_as("ak")
564
-
565
564
  if max_len is None:
566
- max_len = int(ak.max(ak.count(ak_arr, axis=-1)))
567
-
568
- nda = ak.fill_none(
569
- ak.pad_none(ak_arr, max_len, clip=True), fill_val
570
- ).to_numpy(allow_missing=False)
571
-
565
+ lens = np.copy(self.cumulative_length)
566
+ lens[1:] = lens[1:] - lens[:-1]
567
+ max_len = int(np.max(lens))
568
+ nda = np.full((len(self), max_len), fill_val)
572
569
  if preserve_dtype:
573
570
  nda = nda.astype(self.flattened_data.dtype, copy=False)
574
571
 
572
+ _to_aoesa(self.flattened_data.nda, self.cumulative_length.nda, nda)
573
+
575
574
  return aoesa.ArrayOfEqualSizedArrays(nda=nda, attrs=self.getattrs())
576
575
 
577
576
  raise NotImplementedError
@@ -664,3 +663,11 @@ class VectorOfVectors(LGDO):
664
663
 
665
664
  msg = f"{library} is not a supported third-party format."
666
665
  raise ValueError(msg)
666
+
667
+
668
+ @jit
669
+ def _to_aoesa(flattened_array, cumulative_length, nda):
670
+ prev_cl = 0
671
+ for i, cl in enumerate(cumulative_length):
672
+ nda[i, : (cl - prev_cl)] = flattened_array[prev_cl:cl]
673
+ prev_cl = cl