Skip to content

Commit

Permalink
Merge pull request #188 from icecube/fix186
Browse files Browse the repository at this point in the history
Add add_aux_data method
  • Loading branch information
martwo authored Oct 10, 2023
2 parents f89fe63 + 0fd1508 commit a4066a6
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions skyllh/core/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -2445,6 +2445,38 @@ def __str__(self):

return lines

def add_aux_data(
self,
name,
data,
):
"""Adds the given data as auxiliary data to all datasets of this
dataset collection.
Parameters
----------
name : str
The name under which the auxiliary data will be stored.
data : unspecified
The data that should get stored. This can be of any data type.
Raises
------
ValueError
If no datasets have been added to this dataset collection yet.
KeyError
If auxiliary data is already stored under the given name.
"""
if len(self._datasets) == 0:
raise ValueError(
f'The dataset collection "{self.name}" has no datasets added '
'yet!')

for dataset in self._datasets.values():
dataset.add_aux_data(
name=name,
data=data)

def add_datasets(
self,
datasets,
Expand Down

0 comments on commit a4066a6

Please sign in to comment.