Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
payno
id06workflow
Commits
da534c93
Commit
da534c93
authored
Nov 28, 2018
by
payno
Browse files
[operation/gradient removal] deduce delta from the unique values
parent
7793e7cd
Pipeline
#6660
passed with stage
in 2 minutes and 30 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
id06workflow/core/operation/mapping.py
View file @
da534c93
...
...
@@ -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):
return
self
.
__dim
=
self
.
apply_gradient_correction
(
self
.
data_flatten
,
delta
=
delta
,
mapping
=
mapping
)
self
.
__intensity_map
=
mapping
.
intensity_map
self
.
registerOperation
()
@
staticmethod
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 ?
corr2
,
corr1
=
numpy
.
meshgrid
(
numpy
.
linspace
(
-
delta
,
delta
,
data
.
shape
[
2
]),
numpy
.
linspace
(
0
,
0
,
data
.
shape
[
1
]))
_gradients
=
{}
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
()
_logger
.
info
(
'delta for axis %s: %s'
%
(
axis
,
_delta
))
corr2
,
corr1
=
numpy
.
meshgrid
(
numpy
.
linspace
(
-
_delta
,
_delta
,
data
.
shape
[
2
]),
numpy
.
linspace
(
0
,
0
,
data
.
shape
[
1
]))
_gradients
=
{}
_mean
=
dim
.
mean
+
corr2
_variance
=
dim
.
variance
+
corr2
_skewness
=
dim
.
skewness
+
corr2
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment