phasorpy.experimental#
Experimental functions.
The phasorpy.experimental
module provides functions related to phasor
analysis for evaluation.
The functions may be removed or moved to other modules in future releases.
- phasorpy.experimental.anscombe_transform(data, /, **kwargs)[source]#
Return Anscombe variance-stabilizing transformation.
The Anscombe transformation normalizes the standard deviation of noisy, Poisson-distributed data. It can be used to transform un-normalized phasor coordinates to approximate standard Gaussian distributions.
- Parameters:
data (array_like) – Noisy Poisson-distributed data to be transformed.
**kwargs – Optional arguments passed to numpy universal functions.
- Returns:
Anscombe-transformed data with variance of approximately 1.
- Return type:
ndarray
Notes
The Anscombe transformation according to [1]:
\[z = 2 \cdot \sqrt{x + 3 / 8}\]References
Examples
>>> z = anscombe_transform(numpy.random.poisson(10, 10000)) >>> numpy.allclose(numpy.std(z), 1.0, atol=0.1) True
- phasorpy.experimental.anscombe_transform_inverse(data, /, *, approx=False, **kwargs)[source]#
Return inverse Anscombe transformation.
- Parameters:
data (array_like) – Anscombe-transformed data.
approx (bool, default: False) – If true, return approximation of exact unbiased inverse.
**kwargs –
- Returns:
Inverse Anscombe-transformed data.
- Return type:
ndarray
Notes
The inverse Anscombe transformation according to [1]:
\[x = (z / 2.0)^2 - 3 / 8\]The approximate inverse Anscombe transformation according to [2] and [3]:
\[x = 1/4 \cdot z^2 + 1/4 \cdot \sqrt{3/2} \cdot z^{-1} - 11/8 \cdot z^{-2} + 5/8 \cdot \sqrt{3/2} \cdot z^{-3} - 1/8\]References
[2] Makitalo M, and Foi A. A closed-form approximation of the exact unbiased inverse of the Anscombe variance-stabilizing transformation. IEEE Trans Image Process, 20(9): 2697-8 (2011)
[3] Makitalo M, and Foi A. Optimal inversion of the generalized Anscombe transformation for Poisson-Gaussian noise, IEEE Trans Image Process, 22(1): 91-103 (2013)
Examples
>>> x = numpy.random.poisson(10, 100) >>> x2 = anscombe_transform_inverse(anscombe_transform(x)) >>> numpy.allclose(x, x2, atol=1e-3) True