Keep data loaded when get_data is called

This commit is contained in:
CPD 2025-03-17 08:27:49 +01:00
parent db593d0bb5
commit 07828e41c9

View File

@ -129,10 +129,17 @@ class DataCollector:
file.write(self.to_csv(sep=sep))
def get_data(self) -> tuple[np.ndarray, dict]:
"""
Load the full data and return it together with the metadata
Returns
-------
tuple[np.ndarray, dict]
The full data and the metadata
"""
if self.fulldata is None:
return DataCollector.load_data_from_dir(self.dirpath)
else:
return self.fulldata, self.metadata
self.fulldata, new_mdata = DataCollector.load_data_from_dir(self.dirpath)
self.metadata |= new_mdata
return self.fulldata, self.metadata
@staticmethod
def get_csv(data, metadata, sep=","):