lsst.scarlet.lite gee10cc3b42+90ebb246c7
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | List of all members
lsst.scarlet.lite.fft.Fourier Class Reference

Public Member Functions

 __init__ (self, np.ndarray image, dict[Sequence[Sequence[int]], np.ndarray]|None image_fft=None)
 
np.ndarray image (self)
 
tuple[int,...] shape (self)
 
np.ndarray fft (self, Sequence[int] fft_shape, int|Sequence[int] axes)
 
int __len__ (self)
 
Fourier __getitem__ (self, int|Sequence[int]|slice index)
 

Static Public Member Functions

Fourier from_fft (np.ndarray image_fft, Sequence[int] fft_shape, Sequence[int] image_shape, int|Sequence[int]|None axes=None, DTypeLike dtype=float)
 

Public Attributes

 image
 

Protected Attributes

 _fft
 
 _image
 

Detailed Description

An array that stores its Fourier Transform

The `Fourier` class is used for images that will make
use of their Fourier Transform multiple times.
In order to prevent numerical artifacts the same image
convolved with different images might require different
padding, so the FFT for each different shape is stored
in a dictionary.

Parameters
----------
image: np.ndarray
    The real space image.
image_fft: dict[Sequence[int], np.ndarray]
    A dictionary of {shape: fft_value} for which each different
    shape has a precalculated FFT.

Member Function Documentation

◆ __len__()

int lsst.scarlet.lite.fft.Fourier.__len__ ( self)
Length of the image

◆ fft()

np.ndarray lsst.scarlet.lite.fft.Fourier.fft ( self,
Sequence[int] fft_shape,
int | Sequence[int] axes )
The FFT of an image for a given `fft_shape` along desired `axes`

Parameters
----------
fft_shape:
    "Fast" shape of the image used to generate the FFT.
    This will be different than `image_fft.shape` if
    any of the dimensions are odd, since `np.fft.rfft`
    requires an even number of dimensions (for symmetry),
    so this tells `np.fft.irfft` how to go from
    complex k-space to real space.
axes:
    The dimension(s) of the array that will be transformed.

◆ from_fft()

Fourier lsst.scarlet.lite.fft.Fourier.from_fft ( np.ndarray image_fft,
Sequence[int] fft_shape,
Sequence[int] image_shape,
int | Sequence[int] | None axes = None,
DTypeLike dtype = float )
static
Generate a new Fourier object from an FFT dictionary

If the fft of an image has been generated but not its
real space image (for example when creating a convolution kernel),
this method can be called to create a new `Fourier` instance
from the k-space representation.

Parameters
----------
image_fft:
    The FFT of the image.
fft_shape:
    "Fast" shape of the image used to generate the FFT.
    This will be different than `image_fft.shape` if
    any of the dimensions are odd, since `np.fft.rfft`
    requires an even number of dimensions (for symmetry),
    so this tells `np.fft.irfft` how to go from
    complex k-space to real space.
image_shape:
    The shape of the image *before padding*.
    This will regenerate the image with the extra
    padding stripped.
axes:
    The dimension(s) of the array that will be transformed.

Returns
-------
result:
    A `Fourier` object generated from the FFT.

◆ image()

np.ndarray lsst.scarlet.lite.fft.Fourier.image ( self)
The real space image

◆ shape()

tuple[int, ...] lsst.scarlet.lite.fft.Fourier.shape ( self)
The shape of the real space image

The documentation for this class was generated from the following file: