Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tomotools
Nabu
Commits
e740e3bc
Commit
e740e3bc
authored
Apr 29, 2021
by
Pierre Paleo
Browse files
Dont force interpolation fill value to nan, allow extrapolation
parent
424e2034
Changes
2
Hide whitespace changes
Inline
Side-by-side
nabu/preproc/distortion.py
View file @
e740e3bc
...
...
@@ -74,7 +74,6 @@ class DistortionCorrection:
check_supported
(
correction_method
,
self
.
correction_methods
.
keys
(),
"correction method"
)
self
.
corrector
=
self
.
correction_methods
[
correction_method
]
self
.
_corrector_kwargs
=
correction_kwargs
or
{}
self
.
_corrector_kwargs
[
"fill_value"
]
=
np
.
nan
def
estimate_distortion
(
self
,
image
,
reference_image
):
...
...
@@ -84,8 +83,10 @@ class DistortionCorrection:
def
correct_distortion
(
self
,
image
,
coords
):
image_corrected
=
self
.
corrector
(
image
,
coords
,
**
self
.
_corrector_kwargs
)
mask
=
np
.
isnan
(
image_corrected
)
image_corrected
[
mask
]
=
image
[
mask
]
fill_value
=
self
.
_corrector_kwargs
.
get
(
"fill_value"
,
None
)
if
fill_value
is
not
None
and
np
.
isnan
(
fill_value
):
mask
=
np
.
isnan
(
image_corrected
)
image_corrected
[
mask
]
=
image
[
mask
]
return
image_corrected
correct
=
correct_distortion
...
...
nabu/preproc/tests/test_ctf.py
View file @
e740e3bc
...
...
@@ -125,7 +125,7 @@ class TestCtf:
"correction_spike_threshold"
:
3.0
},
correction_method
=
"interpn"
,
correction_kwargs
=
None
correction_kwargs
=
{
"fill_value"
:
None
}
)
flats
=
FlatFieldArrays
(
[
1200
]
+
list
(
self
.
img_shape_vh
),
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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