tnmf.backends.NumPy_CachingFFT
¶
A module that provides a NumPy based backend for computing the gradients of the factorization model.
Shift-invariance is implemented via fast convolution in the Fourier domain using scipy.fft.rfftn()
and scipy.fft.irfftn()
with additional caching of the Fourier transformed arrays compared to
tnmf.backends.NumPy_FFT
.
Module Contents¶
Classes¶
Wrapper class for conveniently caching and switching back and forth between arrays in coordinate space and their |
|
Proxy class for CachingFFT that provides access to array slices of the original object |
|
A NumPy based backend that performs convolutions and contractions for computing the gradients of the factorization model |
-
class
tnmf.backends.NumPy_CachingFFT.
CachingFFT
(field_name: str, c: Optional[numpy.ndarray] = None, fft_axes: Optional[Tuple[int, Ellipsis]] = None, fft_shape: Optional[Tuple[int, Ellipsis]] = None, logger: Optional[logging.Logger] = None)¶ Wrapper class for conveniently caching and switching back and forth between arrays in coordinate space and their representations in Fourier space.
-
__getitem__
(self, s)¶
-
__imul__
(self, other)¶
-
__itruediv__
(self, other)¶
-
__neg__
(self) → numpy.ndarray¶
-
__sub__
(self, other) → numpy.ndarray¶
-
sum
(self, *args, **kwargs)¶
-
property
c
(self) → numpy.ndarray¶ Getter for field in coordinate space
-
property
f
(self) → numpy.ndarray¶ Getter for field in fourier space
-
f_padded
(self, pad_mode: Dict = None, pad_width: Tuple[Tuple[int, int], Ellipsis] = None) → numpy.ndarray¶ Getter for padded field in fourier space
-
property
f_reversed
(self) → numpy.ndarray¶ Getter for time-reversed field in fourier space, intentionally no setter for now
-
-
class
tnmf.backends.NumPy_CachingFFT.
CachingFFT_Sliced
(parent: CachingFFT, s: slice)¶ Bases:
CachingFFT
Proxy class for CachingFFT that provides access to array slices of the original object and keeps the caching logic intact
-
class
tnmf.backends.NumPy_CachingFFT.
NumPy_CachingFFT_Backend
(logger: logging.Logger = None, verbose: int = 0, **kwargs)¶ Bases:
tnmf.backends._NumPyFFTBackend.NumPyFFTBackend
A NumPy based backend that performs convolutions and contractions for computing the gradients of the factorization model via FFT, similar to
NumPy_FFT_Backend
. However, the Fourier representations of the associated arrays are cached in order to reduce the number of Fourier transformations involved to a minimum.-
static
to_ndarray
(arr: CachingFFT) → numpy.ndarray¶
-
static
convolve_multi_1d
(arr: CachingFFT, kernels: Tuple[numpy.ndarray, Ellipsis], axes: Tuple[int, Ellipsis]) → CachingFFT¶
-
reconstruction_gradient_W
(self, V: numpy.ndarray, W: CachingFFT, H: CachingFFT, s: slice = sliceNone) → Tuple[CachingFFT, CachingFFT]¶
-
reconstruction_gradient_H
(self, V: numpy.ndarray, W: CachingFFT, H: CachingFFT, s: slice = sliceNone) → Tuple[CachingFFT, CachingFFT]¶
-
reconstruct
(self, W: CachingFFT, H: CachingFFT) → CachingFFT¶
-
partial_reconstruct
(self, W: numpy.ndarray, H: numpy.ndarray, i_atom: int) → numpy.ndarray¶
-
static