f9columnar 0.3.2__tar.gz → 0.3.3__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.
- {f9columnar-0.3.2 → f9columnar-0.3.3}/PKG-INFO +1 -1
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/arrays.py +37 -10
- {f9columnar-0.3.2 → f9columnar-0.3.3}/pyproject.toml +1 -1
- {f9columnar-0.3.2 → f9columnar-0.3.3}/LICENSE +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/README.md +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/__init__.py +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/data/PMGxsecDB_mc16.txt +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/data/PMGxsecDB_mc21.txt +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/data/campaigns.json +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/data/luminosity.json +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/data/periods.json +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/data/truth_classification.json +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/dataset_builder.py +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/hdf5_dataloader.py +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/hdf5_writer.py +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/histograms.py +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/ml/__init__.py +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/ml/dataloader_helpers.py +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/ml/dataset_scaling.py +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/ml/hdf5_dataloader.py +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/ml/hdf5_parallel_writer.py +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/ml/hdf5_writer.py +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/ml/imbalanced_sampler.py +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/ml/scalers.py +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/processors.py +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/processors_collection.py +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/root_dataloader.py +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/run.py +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/submit/__init__.py +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/submit/act_driver.py +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/submit/act_handler.py +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/submit/act_merger.py +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/submit/act_run.py +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/submit/act_run.sh +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/utils/__init__.py +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/utils/ak_helpers.py +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/utils/config_utils.py +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/utils/helpers.py +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/utils/loggers.py +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/utils/regex_helpers.py +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/utils/rucio_db.py +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/utils/rucio_utils.py +0 -0
- {f9columnar-0.3.2 → f9columnar-0.3.3}/f9columnar/utils/xsec_db.py +0 -0
|
@@ -4,7 +4,7 @@ import copy
|
|
|
4
4
|
import logging
|
|
5
5
|
from dataclasses import dataclass
|
|
6
6
|
from dataclasses import field as dataclass_field
|
|
7
|
-
from typing import Any
|
|
7
|
+
from typing import Any, Self
|
|
8
8
|
|
|
9
9
|
import awkward as ak
|
|
10
10
|
import numpy as np
|
|
@@ -25,12 +25,12 @@ class BaseArrays:
|
|
|
25
25
|
def shape(self) -> tuple[int, int]:
|
|
26
26
|
return (len(self.array), len(self.fields))
|
|
27
27
|
|
|
28
|
-
def mask(self, mask: ak.Array | np.ndarray, inplace: bool = True) ->
|
|
28
|
+
def mask(self, mask: ak.Array | np.ndarray, inplace: bool = True) -> Self:
|
|
29
29
|
if inplace:
|
|
30
30
|
self.array = self.array[mask]
|
|
31
31
|
return self
|
|
32
32
|
else:
|
|
33
|
-
return self.array[mask]
|
|
33
|
+
return self.__class__(self.array[mask])
|
|
34
34
|
|
|
35
35
|
def _check_type(self, value: Any) -> bool:
|
|
36
36
|
raise NotImplementedError
|
|
@@ -71,9 +71,9 @@ class BaseArrays:
|
|
|
71
71
|
return self
|
|
72
72
|
|
|
73
73
|
def __len__(self) -> int:
|
|
74
|
-
if
|
|
74
|
+
if isinstance(self.array, ak.Array):
|
|
75
75
|
return len(self.array)
|
|
76
|
-
elif
|
|
76
|
+
elif isinstance(self.array, ak.Record):
|
|
77
77
|
return 1
|
|
78
78
|
else:
|
|
79
79
|
raise ValueError("Invalid array type!")
|
|
@@ -169,9 +169,7 @@ class Arrays:
|
|
|
169
169
|
def shape(self) -> tuple[int, int, int]:
|
|
170
170
|
return (len(self), len(self.flat_fields), len(self.jagged_fields))
|
|
171
171
|
|
|
172
|
-
def remove_empty(
|
|
173
|
-
self, return_mask: bool = False, all_fields: bool = True
|
|
174
|
-
) -> Arrays | ak.Array | tuple[ak.Array | None, ak.Array] | None:
|
|
172
|
+
def remove_empty(self, return_mask: bool = False, all_fields: bool = True) -> Arrays | ak.Array | None:
|
|
175
173
|
if self.jagged_arrays is None:
|
|
176
174
|
if return_mask:
|
|
177
175
|
return None
|
|
@@ -185,7 +183,7 @@ class Arrays:
|
|
|
185
183
|
else:
|
|
186
184
|
return self.mask_flat_inplace(non_empty_mask)
|
|
187
185
|
|
|
188
|
-
def mask_flat(self, mask: ak.Array | np.ndarray) -> tuple[
|
|
186
|
+
def mask_flat(self, mask: ak.Array | np.ndarray) -> tuple[FlatArrays | None, JaggedArrays | None]:
|
|
189
187
|
if self.flat_arrays is not None:
|
|
190
188
|
flat_masked = self.flat_arrays.mask(mask, inplace=False)
|
|
191
189
|
else:
|
|
@@ -207,7 +205,7 @@ class Arrays:
|
|
|
207
205
|
|
|
208
206
|
return self
|
|
209
207
|
|
|
210
|
-
def mask_jagged(self, mask: ak.Array | np.ndarray) ->
|
|
208
|
+
def mask_jagged(self, mask: ak.Array | np.ndarray) -> JaggedArrays | None:
|
|
211
209
|
if self.jagged_arrays is not None:
|
|
212
210
|
jagged_masked = self.jagged_arrays.mask(mask, inplace=False)
|
|
213
211
|
else:
|
|
@@ -661,3 +659,32 @@ class ArraysProcessor(Processor):
|
|
|
661
659
|
arrays = self.arrays_handler.make_array_groups(arrays, self.groups)
|
|
662
660
|
|
|
663
661
|
return {"arrays": arrays}
|
|
662
|
+
|
|
663
|
+
|
|
664
|
+
def arrays_to_ak(arrays: Arrays) -> ak.Array:
|
|
665
|
+
fields: dict[str, ak.Array] = {}
|
|
666
|
+
|
|
667
|
+
if arrays.flat_arrays is not None:
|
|
668
|
+
for field in arrays.flat_arrays.fields:
|
|
669
|
+
fields[field] = arrays.flat_arrays.array[field]
|
|
670
|
+
|
|
671
|
+
if arrays.jagged_arrays is not None:
|
|
672
|
+
for field in arrays.jagged_arrays.fields:
|
|
673
|
+
fields[field] = arrays.jagged_arrays.array[field]
|
|
674
|
+
|
|
675
|
+
return ak.zip(fields, depth_limit=1)
|
|
676
|
+
|
|
677
|
+
|
|
678
|
+
def group_arrays_to_ak(group_arrays: GroupArrays) -> ak.Array:
|
|
679
|
+
group_fields: dict[str, ak.Array] = {}
|
|
680
|
+
|
|
681
|
+
for _, arrays in group_arrays.group_arrays.items():
|
|
682
|
+
if arrays.flat_arrays is not None:
|
|
683
|
+
for field in arrays.flat_arrays.fields:
|
|
684
|
+
group_fields[field] = arrays.flat_arrays.array[field]
|
|
685
|
+
|
|
686
|
+
if arrays.jagged_arrays is not None:
|
|
687
|
+
for field in arrays.jagged_arrays.fields:
|
|
688
|
+
group_fields[field] = arrays.jagged_arrays.array[field]
|
|
689
|
+
|
|
690
|
+
return ak.zip(group_fields, depth_limit=1)
|
|
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
|
|
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
|