Commit d719ad15 authored by payno's avatar payno
Browse files

[fix] fix datareduction operation

parent cd60a4f8
......@@ -53,7 +53,7 @@ class DataReduction(OverwritingOperation):
if cache_data is None:
self._cache_data = self.data[...][::self._z_factor, ::self._y_factor, ::self._x_factor]
else:
self._cache_data = cache_data
self._cache_data = cache_data[::self._z_factor, ::self._y_factor, ::self._x_factor]
return self._cache_data
def compute(self):
......@@ -66,9 +66,12 @@ class DataReduction(OverwritingOperation):
raise ValueError('No data in cache')
self.data = self._cache_data
self.clear_cache()
self.registerOperation()
return self.data
def clear_cache(self):
self._cache_data = None
def key(self):
return ' '.join((self._name, 'x:', str(self._x_factor), 'y:',
str(self._y_factor), 'z:', str(self._z_factor)))
......@@ -92,12 +92,9 @@ class DataReductionOW(OWWidget):
def _process(self, experiment):
if experiment is None:
return
try:
operation = DataReduction(experiment=experiment,
x_factor=self.getXReduction(),
y_factor=self.getYReduction(),
z_factor=self.getZReduction())
operation.compute()
self.send("data", experiment)
except Exception as e:
_logger.error(e)
operation = DataReduction(experiment=experiment,
x_factor=self.getXReduction(),
y_factor=self.getYReduction(),
z_factor=self.getZReduction())
operation.compute()
self.send("data", experiment)
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