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.
Return number of threads for parallel computations on CPU cores.
This function is used to parse num_threads parameters.
Parameters:
num_threads (int, optional) – Number of threads to use for parallel computations on CPU cores.
If None (default), return 1, disabling multi-threading.
If greater than zero, return value up to max_threads if set.
If zero, return the value of the PHASORPY_NUM_THREADS environment
variable if set, else half the CPU cores up to max_threads or 32.
max_threads (int, optional) – Maximum number of threads to return.
The spectral vector denoising algorithm is based on a Gaussian weighted
average calculation, with weights obtained in n-dimensional Chebyshev or
Fourier space [4].
Parameters:
signal (array_like) – Hyperspectral data to be denoised.
A minimum of three samples are required along axis.
The samples must be uniformly spaced.
spectral_vector (array_like, optional) – Spectral vector.
For example, phasor coordinates, PCA projected phasor coordinates,
or Chebyshev coefficients.
Must be of same shape as signal with axis removed and axis
containing spectral space appended.
If None (default), phasor coordinates are calculated at specified
harmonic.
axis (int, optional, default: -1) – Axis over which spectral_vector is computed if not provided.
The default is the last axis (-1).
harmonic (int, sequence of int, or 'all', optional) – Harmonics to include in calculating spectral_vector.
If ‘all’, include all harmonics for signal samples along axis.
Else, harmonics must be at least one and no larger than half the
number of signal samples along axis.
The default is the first harmonic (fundamental frequency).
A minimum of harmonic * 2 + 1 samples are required along axis
to calculate correct phasor coordinates at harmonic.
sigma (float, default: 0.05) – Width of Gaussian filter in spectral vector space.
Weighted averages are calculated using the spectra of signal items
within an spectral vector Euclidean distance of 3 * sigma and
intensity above vmin.
vmin (float, optional) – Signal intensity along axis below which not to include in denoising.
dtype (dtype_like, optional) – Data type of output arrays. Either float32 or float64.
The default is float64 unless the signal is float32.
num_threads (int, optional) – Number of OpenMP threads to use for parallelization.
By default, multi-threading is disabled.
If zero, up to half of logical CPUs are used.
OpenMP may not be available on all platforms.
Returns:
Denoised signal of dtype.
Spectra with integrated intensity below vmin are unchanged.
Return type:
ndarray
References
Examples
Denoise a hyperspectral image with a Gaussian filter width of 0.1 in
spectral vector space using first and second harmonic: