Commit e740e3bc authored by Pierre Paleo's avatar Pierre Paleo
Browse files

Dont force interpolation fill value to nan, allow extrapolation

parent 424e2034
......@@ -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
......
......@@ -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),
......
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