Commit 7969fad8 authored by Julia Garriga Ferrer's avatar Julia Garriga Ferrer
Browse files

[components] Save W matrix with all images shape

parent 3298e31d
......@@ -359,9 +359,6 @@ class Dataset(qt.QObject):
"""
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]
for dimension in self.__dims:
values = numpy.empty((len(data)))
for row, metadata_frame in enumerate(data):
......
......@@ -148,6 +148,13 @@ class BSSWidget(qt.QMainWindow):
self._displayComponentsWidget.show()
self.computeButton.setEnabled(True)
self.nComponentsLE.setEnabled(True)
if numpy.any(self.dataset.li_data):
# If filter data is activated, the matrix W has reduced dimensionality, so reshaping is not possible
# Create empty array with shape the total number of frames
W = numpy.zeros((self.dataset.nframes, n_comp))
# Set actual values of W where threshold of filter is True
W[self.dataset.threshold] = self.W
self.W = W
self._displayComponentsWidget.setComponents(self.comp, self.W, self.dataset.get_dimensions_values())
def _detectComp(self):
......
......@@ -218,20 +218,6 @@ class DisplayComponentsWidget(qt.QMainWindow):
self._plot_rocking_curves.getBrowser().setRange(0, len(self.dimensions[text]) - 1)
self._plot_rocking_curves.getBrowser().setValue(0)
for i in range(len(self.W.T)):
"""
if numpy.any(self.dataset.li_data):
# If filter data is activated, the matrix W has reduced dimensionality, so reshaping is not possible
# Create empty array with shape the total number of frames
W = numpy.empty(self.dataset.threshold.shape)
# Set actual values of W where threshold of filter is True
W[self.dataset.threshold] = self.W.T[i]
# Take only the thresholds for the dimension
threshold = numpy.take(self.dataset.threshold.reshape(self.dataset.dims.shape), 0, axis=self.dimension)
# Reshape W into the dimensions and take the first element of the chosen dimension
W = numpy.take(W.reshape(self.dataset.dims.shape), 0, self.dimension)
# Take only the values of W that correspond to high intensity data
W = W[threshold]
else:"""
dimensions_shape = numpy.array(self.dimensions.values()).shape
W = numpy.take(self.W.T[i].reshape(dimensions_shape), self.index, self.dimension)
self._plot_rocking_curves.addCurve(numpy.arange(len(W)), W, legend=str(i))
......@@ -246,19 +232,6 @@ class DisplayComponentsWidget(qt.QMainWindow):
self.index = index
self._plot_rocking_curves.clear()
for i in range(len(self.W.T)):
"""if numpy.any(self.dataset.li_data):
# If filter data is activated, the matrix W has reduced dimensionality, so reshaping is not possible
# Create empty array with shape the total number of frames
W = numpy.empty(self.dataset.threshold.shape)
# Set actual values of W where threshold of filter is True
W[self.dataset.threshold] = self.W.T[i]
# Take only the thresholds for the dimension
threshold = numpy.take(self.dataset.threshold.reshape(self.dataset.dims.shape), self.index, axis=self.dimension)
# Reshape W into the dimensions and take the chosen element and dimension
W = numpy.take(W.reshape(self.dataset.dims.shape), self.index, self.dimension)
# Take only the values of W that correspond to high intensity data
W = W[threshold]
else:"""
dimensions_shape = numpy.array(self.dimensions.values()).shape
W = numpy.take(self.W.T[i].reshape(dimensions_shape), self.index, self.dimension)
self._plot_rocking_curves.addCurve(numpy.arange(len(W)), W, legend=str(i))
......
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