Commit 264ec241 authored by Julia Garriga Ferrer's avatar Julia Garriga Ferrer
Browse files

[core][dataset] Modify dimension values to be adictionary with key the dimensions names

parent 221d24e2
......@@ -89,7 +89,7 @@ class Dataset(qt.QObject):
self.dark_filename = dark_filename
self.filenames = filenames
self.__dims = AcquisitionDims()
self._dimensions_values = None
self._dimensions_values = {}
# Initialize data
self._file_series = fabio.open_series(first_filename=raw_filename,
......@@ -325,7 +325,7 @@ class Dataset(qt.QObject):
unique values.
"""
self.__dims.clear()
self._dimensions_values = None
self._dimensions_values = {}
keys = numpy.array(list(self.metadata[0].get_keys(kind)))
values = numpy.array([[data.get_value(kind=kind, name=key)[0] for data
......@@ -357,18 +357,17 @@ class Dataset(qt.QObject):
:returns: array_like
"""
if self._dimensions_values is None:
if not self._dimensions_values:
data = self.metadata
# Use only metadata of high intensity data
if self._filter_data:
data = numpy.array(self.metadata)[self.threshold]
values = numpy.empty((self.__dims.ndim, len(data)))
for row, metadata_frame in enumerate(data):
for dimension in self.__dims:
val = metadata_frame.get_value(kind=dimension[1].kind, name=dimension[1].name)
values[dimension[0]][row] = val[0]
self._dimensions_values = values
for dimension in self.__dims:
values = numpy.empty((len(data)))
for row, metadata_frame in enumerate(data):
values[row] = (metadata_frame.get_value(kind=dimension[1].kind,
name=dimension[1].name)[0])
self._dimensions_values[dimension[1].name] = values
return self._dimensions_values
def __deepcopy__(self, memo):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment