sorting datasets added
@@ -143,6 +143,7 @@ class DatasetBase:
"""
raise NotImplementedError(
"subset_channel function not implemented in used Dataset class!")
+
def save(self, filename, file_type='hdf5'):
""" Saves the dataset object to a file
@@ -283,6 +284,21 @@ class Dataset(DatasetBase):
channel_descriptors=channel_descriptors)
return dataset
+ def sort_by(self, by):
+ """ sorts the dataset by a given observation descriptor
+
+ Args:
+ by(String): the descriptor by which the dataset shall be sorted
+
+ Returns:
+ ---
+
+ """
+ desc = self.obs_descriptors[by]
+ order = np.argsort(desc)
+ self.measurements = self.measurements[order]
+ self.obs_descriptors = subset_descriptor(self.obs_descriptors, order)
+
def load_dataset(filename, file_type=None):
""" loads a Dataset object from disc
