diff --git a/src/OSmOSE/data/audio_data.py b/src/OSmOSE/data/audio_data.py index 86c6c9c7..c9dc6bec 100644 --- a/src/OSmOSE/data/audio_data.py +++ b/src/OSmOSE/data/audio_data.py @@ -112,6 +112,7 @@ def write(self, folder: Path) -> None: Folder in which to write the audio file. """ + super().write(path=folder) sf.write(folder / f"{self}.wav", self.get_value(), self.sample_rate) def _get_item_value(self, item: AudioItem) -> np.ndarray: diff --git a/src/OSmOSE/data/base_data.py b/src/OSmOSE/data/base_data.py index a00c8bb8..21882094 100644 --- a/src/OSmOSE/data/base_data.py +++ b/src/OSmOSE/data/base_data.py @@ -10,6 +10,7 @@ import numpy as np +from OSmOSE.config import DPDEFAULT from OSmOSE.data.base_file import BaseFile from OSmOSE.data.base_item import BaseItem from OSmOSE.data.event import Event @@ -67,9 +68,12 @@ def get_value(self) -> np.ndarray: """Get the concatenated values from all Items.""" return np.concatenate([item.get_value() for item in self.items]) - def write(self, path: Path) -> None: # noqa: ARG002 - """Abstract method for writing the data.""" - return + def write(self, path: Path) -> None: + """Create the directory in which the data will be written. + + The actual data writing is left to the specified classes. + """ + path.mkdir(parents=True, exist_ok=True, mode=DPDEFAULT) @classmethod def from_files(