mirror of
https://github.com/vale981/hopsflow
synced 2025-03-05 08:51:37 -05:00
add slice to ensemble value
This commit is contained in:
parent
eee8cbedef
commit
913dde147d
1 changed files with 9 additions and 0 deletions
|
@ -115,6 +115,15 @@ class EnsembleValue:
|
||||||
def __getitem__(self, index):
|
def __getitem__(self, index):
|
||||||
return EnsembleValue(self._value[index])
|
return EnsembleValue(self._value[index])
|
||||||
|
|
||||||
|
def slice(self, *args):
|
||||||
|
slc = slice(*args)
|
||||||
|
|
||||||
|
results = []
|
||||||
|
for N, val, σ in self.aggregate_iterator:
|
||||||
|
results.append((N, val[slc], σ[slc]))
|
||||||
|
|
||||||
|
return EnsembleValue(results)
|
||||||
|
|
||||||
def __len__(self) -> int:
|
def __len__(self) -> int:
|
||||||
return len(self._value)
|
return len(self._value)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue