Commit 756b7e81 authored by Pierre Paleo's avatar Pierre Paleo
Browse files

Add nan_value in flatfield.py

parent 5a16ae03
......@@ -18,6 +18,7 @@ class FlatFieldArrays:
radios_indices=None,
interpolation: str = "linear",
distortion_correction=None,
nan_value=1.0,
):
"""
Initialize a flat-field normalization process.
......@@ -40,6 +41,8 @@ class FlatFieldArrays:
Interpolation method for flat-field. See below for more details.
distortion_correction: DistortionCorrection, optional
A DistortionCorrection object. If provided, it is used to correct flat distortions based on each radio.
nan_value: float, optional
Which float value is used to replace nan/inf after flat-field.
Important
......@@ -62,7 +65,7 @@ class FlatFieldArrays:
If interpolation="linear", the normalization is done as a linear
function of the radio index.
"""
self._set_parameters(radios_shape, radios_indices, interpolation)
self._set_parameters(radios_shape, radios_indices, interpolation, nan_value)
self._set_flats_and_darks(flats, darks)
self.distortion_correction = distortion_correction
......@@ -106,7 +109,7 @@ class FlatFieldArrays:
)
def _set_parameters(self, radios_shape, radios_indices, interpolation):
def _set_parameters(self, radios_shape, radios_indices, interpolation, nan_value):
self._set_radios_shape(radios_shape)
if radios_indices is None:
radios_indices = np.arange(0, self.n_radios, dtype=np.int32)
......@@ -122,6 +125,7 @@ class FlatFieldArrays:
check_supported(
interpolation, self._supported_interpolations, "Interpolation mode"
)
self.nan_value = nan_value
@staticmethod
def get_previous_next_indices(arr, idx):
......@@ -236,6 +240,7 @@ class FlatFieldDataUrls(FlatField):
radios_indices=None,
interpolation: str = "linear",
distortion_correction=None,
nan_value=1.0,
**chunk_reader_kwargs
):
"""
......@@ -259,6 +264,8 @@ class FlatFieldDataUrls(FlatField):
Interpolation method for flat-field. See below for more details.
distortion_correction: DistortionCorrection, optional
A DistortionCorrection object. If provided, it is used to
nan_value: float, optional
Which float value is used to replace nan/inf after flat-field.
Other Parameters
......
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