Commit 07b80b3b authored by payno's avatar payno

[noisereduction] fix getBackground

parent e386d0ef
......@@ -146,5 +146,9 @@ class Dataset(object):
# TODO: add information if the number of frame is fixed...
if len(files_list) is 0:
return None
series = FileSeries(files_list)
return self._loadSeries(series)
res = []
series = FileSeries(filenames=files_list, single_frame=True)
for iframe in range(series.nframes):
res.append(series.getframe(iframe).data)
return numpy.asarray(res)
......@@ -209,18 +209,22 @@ class Experiment(object):
steps = (1, 1, 1)
else:
if len(reductionStep) is 1:
steps = reductionStep[0]
steps = reductionStep[0].steps
else:
raise NotImplementedError(
'cannot manage several reduction steps for the moment')
# first apply data reduction because roi is applied after data
# reduction
background_img = numpy.median(background, axis=0)
background_img = background_img[::steps[1], ::steps[0]]
if self.roi is None:
return background_img[::steps[1], ::steps[2]]
return background_img
else:
origin, size = self.roi
ymin, ymax = int(origin[1]), int(origin[1] + size[1])
xmin, xmax = int(origin[0]), int(origin[0] + size[0])
return background_img[ymin:ymax:steps[1], xmin:xmax:steps[2]]
return background_img[ymin:ymax, xmin:xmax]
def addOperation(self, operation):
"""Add the operation to the stack of operations"""
......@@ -250,7 +254,9 @@ class Experiment(object):
def _getDataReductionOperations(self):
"""
:return: the list of roi operation
:return: the list of roi operation.
..note: reduction steps are defined as tuple(x, y, z)
"""
return self._data_reduction_operations
......
Markdown is supported
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