diff --git a/src/RsWaveform/meta/defaults.py b/src/RsWaveform/meta/defaults.py index 543700b..4c1b4aa 100644 --- a/src/RsWaveform/meta/defaults.py +++ b/src/RsWaveform/meta/defaults.py @@ -12,6 +12,7 @@ "peak": None, "samples": None, "reflevel": None, + "date": None, } META_IQTAR_DEFAULTS = { diff --git a/src/RsWaveform/meta/meta_wv.py b/src/RsWaveform/meta/meta_wv.py index 7f86d5a..b7378a8 100644 --- a/src/RsWaveform/meta/meta_wv.py +++ b/src/RsWaveform/meta/meta_wv.py @@ -1,5 +1,5 @@ """WV meta data for Storage container.""" - +import datetime import typing import numpy as np @@ -115,3 +115,12 @@ def reflevel(self) -> typing.Optional[float]: @reflevel.setter def reflevel(self, value: float) -> None: self._items["reflevel"] = value + + @property + def date(self) -> typing.Optional[datetime.datetime]: + """The timestamp of the loaded file.""" + return self._items.get("date") + + @date.setter + def date(self, value: float) -> None: + self._items["date"] = value diff --git a/tests/test_wv.py b/tests/test_wv.py index b2d0e33..ccc10a1 100644 --- a/tests/test_wv.py +++ b/tests/test_wv.py @@ -137,6 +137,13 @@ def test_loader_meta_only(reference_waveform_file_name: str, meta): assert obtained_meta == ref_meta +def test_meta_provides_date_field(reference_waveform_file_name: str, meta): + loader = Load() + parent_storage = loader.load_meta(reference_waveform_file_name) + obtained_meta = parent_storage.storages[0].meta + assert obtained_meta.date == meta["date"] + + def test_loader_mwv( reference_waveform_mwv_file_name: str, meta_mwv: dict, reference_mwv: np.ndarray ):