corrct.processing.noise

Noise handling routines.

@author: Nicola VIGANÒ, Computational Imaging group, CWI, The Netherlands, and ESRF - The European Synchrotron, Grenoble, France

Module Contents

Functions

compute_variance_poisson

Compute the variance of a signal subject to Poisson noise, against a reference intensity.

compute_variance_transmission

Compute the variance of a linearized attenuation (transmission) signal, against a reference intensity.

compute_variance_weight

Compute the weight associated to the given variance, in a weighted least-squares context.

Data

eps

API

corrct.processing.noise.eps

None

corrct.processing.noise.compute_variance_poisson(Is: numpy.typing.NDArray, I0: Optional[numpy.typing.NDArray] = None, var_I0: Optional[numpy.typing.NDArray] = None, normalized: bool = True) numpy.typing.NDArray[source]

Compute the variance of a signal subject to Poisson noise, against a reference intensity.

The reference intensity can also be subject to Poisson and Gaussian noise. If the variance of the reference intensity is not passed, it will be assumed to be Poisson.

Parameters

Is : NDArray The signal intensity. I0 : Optional[NDArray], optional The reference intensity. The default is None. var_I0 : Optional[NDArray], optional The variance of the reference intensity. The default is None. If not given, it will be assumed to be equal to I0. normalized : bool, optional Whether to renormalize by the mean of the reference intensity.

Returns

NDArray The computed variance.

corrct.processing.noise.compute_variance_transmission(Is: numpy.typing.NDArray, I0: numpy.typing.NDArray, var_I0: Optional[numpy.typing.NDArray] = None, normalized: bool = True) numpy.typing.NDArray[source]

Compute the variance of a linearized attenuation (transmission) signal, against a reference intensity.

Parameters

Is : NDArray The transmitted signal. I0 : NDArray The reference intensity. var_I0 : Optional[NDArray], optional The variance of the reference intensity. The default is None. If not given, it will be assumed to be equal to I0. normalized : bool, optional Whether to renormalize by the mean of the reference intensity.

Returns

NDArray The computed variance.

corrct.processing.noise.compute_variance_weight(variance: numpy.typing.NDArray, *, percentile: float = 0.001, mask: Optional[numpy.typing.NDArray] = None, normalized: bool = False, use_std: bool = False, semilog: bool = False) numpy.typing.NDArray[source]

Compute the weight associated to the given variance, in a weighted least-squares context.

Parameters

variance : NDArray The variance of the signal. percentile : float Minimum percentile to discard. The default is 0.001 (0.1%) mask : NDArray | None, optional Mask of valid values. The default is None. normalized : bool, optional Scale the largest weight to 1. The default is False. use_std : bool, optional Use the standard deviation instead of the variance. semilog : bool, optional Scale the variance over a logarithmic curve. It can be beneficial with high dynamic range data. The default is False.

Returns

NDArray The computed weights.