Commit da534c93 authored by payno's avatar payno

[operation/gradient removal] deduce delta from the unique values

parent 7793e7cd
Pipeline #6660 passed with stage
in 2 minutes and 30 seconds
......@@ -171,9 +171,6 @@ class GradientRemoval(_MappingBase):
raise ValueError('Not available for Gradient removal yet')
def compute(self):
# TODO: why delta = 0.567
delta = 0.567
# TODO: for now we ask experiment for the intensity mapping if computed
mapping = self._experiment.getOperation(IntensityMapping.KEY)
if mapping is None:
......@@ -182,21 +179,22 @@ class GradientRemoval(_MappingBase):
self.__dim = self.apply_gradient_correction(self.data_flatten,
self.__intensity_map = mapping.intensity_map
def apply_gradient_correction(data, delta, mapping):
def apply_gradient_correction(self, data, mapping):
assert isinstance(mapping, IntensityMapping)
# TODO: number of element: for now only square matrices but if evolve ?
for axis, dim in mapping.dims.items():
unique_values = numpy.array(self._experiment.dims.get(axis).unique_values)
_delta = unique_values.max() - unique_values.min()'delta for axis %s: %s' % (axis, _delta))
corr2, corr1 = numpy.meshgrid(
numpy.linspace(-delta, delta, data.shape[2]),
numpy.linspace(-_delta, _delta, data.shape[2]),
numpy.linspace(0, 0, data.shape[1]))
_gradients = {}
for axis, dim in mapping.dims.items():
_mean = dim.mean + corr2
_variance = dim.variance + corr2
_skewness = dim.skewness + corr2
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