|
LSST Applications g00274db5b6+edbf708997,g00d0e8bbd7+edbf708997,g199a45376c+5137f08352,g1fd858c14a+1d4b6db739,g262e1987ae+f4d9505c4f,g29ae962dfc+7156fb1a53,g2cef7863aa+73c82f25e4,g35bb328faa+edbf708997,g3e17d7035e+5b3adc59f5,g3fd5ace14f+852fa6fbcb,g47891489e3+6dc8069a4c,g53246c7159+edbf708997,g64539dfbff+9f17e571f4,g67b6fd64d1+6dc8069a4c,g74acd417e5+ae494d68d9,g786e29fd12+af89c03590,g7ae74a0b1c+a25e60b391,g7aefaa3e3d+536efcc10a,g7cc15d900a+d121454f8d,g87389fa792+a4172ec7da,g89139ef638+6dc8069a4c,g8d7436a09f+28c28d8d6d,g8ea07a8fe4+db21c37724,g92c671f44c+9f17e571f4,g98df359435+b2e6376b13,g99af87f6a8+b0f4ad7b8d,gac66b60396+966efe6077,gb88ae4c679+7dec8f19df,gbaa8f7a6c5+38b34f4976,gbf99507273+edbf708997,gc24b5d6ed1+9f17e571f4,gca7fc764a6+6dc8069a4c,gcc769fe2a4+97d0256649,gd7ef33dd92+6dc8069a4c,gdab6d2f7ff+ae494d68d9,gdbb4c4dda9+9f17e571f4,ge410e46f29+6dc8069a4c,geaed405ab2+e194be0d2b,w.2025.47
LSST Data Management Base Package
|
Classes | |
| class | Fourier |
Functions | |
| np.ndarray | centered (np.ndarray arr, Sequence[int] newshape) |
| np.ndarray | fast_zero_pad (np.ndarray arr, Sequence[Sequence[int]] pad_width) |
| np.ndarray | _pad (np.ndarray arr, Sequence[int] newshape, int|Sequence[int]|None axes=None, str mode="constant", float constant_values=0) |
| tuple | get_fft_shape (np.ndarray|Sequence[int] im_or_shape1, np.ndarray|Sequence[int] im_or_shape2, int padding=3, int|Sequence[int]|None axes=None, bool use_max=False) |
| Fourier | _kspace_operation (Fourier image1, Fourier image2, int padding, Callable op, Sequence[int] shape, int|Sequence[int] axes) |
| Fourier|np.ndarray | match_kernel (np.ndarray|Fourier kernel1, np.ndarray|Fourier kernel2, int padding=3, int|Sequence[int] axes=(-2, -1), bool return_fourier=True, bool normalize=False) |
| np.ndarray|Fourier | convolve (np.ndarray|Fourier image, np.ndarray|Fourier kernel, int padding=3, int|Sequence[int] axes=(-2, -1), bool return_fourier=True, bool normalize=False) |
|
protected |
Combine two images in k-space using a given `operator`
Parameters
----------
image1:
The LHS of the equation.
image2:
The RHS of the equation.
padding:
The amount of padding to add before transforming into k-space.
op:
The operator used to combine the two images.
This is either ``operator.mul`` for a convolution
or ``operator.truediv`` for deconvolution.
shape:
The shape of the output image.
axes:
The dimension(s) of the array that will be transformed.
Definition at line 374 of file fft.py.
|
protected |
Pad an array to fit into newshape
Pad `arr` with zeros to fit into newshape,
which uses the `np.fft.fftshift` convention of moving
the center pixel of `arr` (if `arr.shape` is odd) to
the center-right pixel in an even shaped `newshape`.
Parameters
----------
arr:
The arrray to pad.
newshape:
The new shape of the array.
axes:
The axes that are being reshaped.
mode:
The numpy mode used to pad the array.
In other words, how to fill the new padded elements.
See ``numpy.pad`` for details.
constant_values:
If `mode` == "constant" then this is the value to set all of
the new padded elements to.
Definition at line 98 of file fft.py.
| np.ndarray lsst.scarlet.lite.fft.centered | ( | np.ndarray | arr, |
| Sequence[int] | newshape ) |
Return the central newshape portion of the array.
Parameters
----------
arr:
The array to center.
newshape:
The new shape of the array.
Notes
-----
If the array shape is odd and the target is even,
the center of `arr` is shifted to the center-right
pixel position.
This is slightly different than the scipy implementation,
which uses the center-left pixel for the array center.
The reason for the difference is that we have
adopted the convention of `np.fft.fftshift` in order
to make sure that changing back and forth from
fft standard order (0 frequency and position is
in the bottom left) to 0 position in the center.
Definition at line 34 of file fft.py.
| np.ndarray | Fourier lsst.scarlet.lite.fft.convolve | ( | np.ndarray | Fourier | image, |
| np.ndarray | Fourier | kernel, | ||
| int | padding = 3, | ||
| int | Sequence[int] | axes = (-2, -1), | ||
| bool | return_fourier = True, | ||
| bool | normalize = False ) |
Convolve image with a kernel
Parameters
----------
image:
Image either as array or as `Fourier` object
kernel:
Convolution kernel either as array or as `Fourier` object
padding:
Additional padding to use when generating the FFT
to suppress artifacts.
axes:
Axes that contain the spatial information for the PSFs.
return_fourier:
Whether to return `Fourier` or array
normalize:
Whether or not to normalize the input kernels.
Returns
-------
result:
The convolution of the image with the kernel.
Definition at line 481 of file fft.py.
| np.ndarray lsst.scarlet.lite.fft.fast_zero_pad | ( | np.ndarray | arr, |
| Sequence[Sequence[int]] | pad_width ) |
Fast version of numpy.pad when `mode="constant"`
Executing `numpy.pad` with zeros is ~1000 times slower
because it doesn't make use of the `zeros` method for padding.
Parameters
---------
arr:
The array to pad
pad_width:
Number of values padded to the edges of each axis.
See numpy.pad docs for more.
Returns
-------
result: np.ndarray
The array padded with `constant_values`
Definition at line 71 of file fft.py.
| tuple lsst.scarlet.lite.fft.get_fft_shape | ( | np.ndarray | Sequence[int] | im_or_shape1, |
| np.ndarray | Sequence[int] | im_or_shape2, | ||
| int | padding = 3, | ||
| int | Sequence[int] | None | axes = None, | ||
| bool | use_max = False ) |
Return the fast fft shapes for each spatial axis
Calculate the fast fft shape for each dimension in
axes.
Parameters
----------
im_or_shape1:
The left image or shape of an image.
im_or_shape2:
The right image or shape of an image.
padding:
Any additional padding to add to the final shape.
axes:
The axes that are being transformed.
use_max:
Whether or not to use the maximum of the two shapes,
or the sum of the two shapes.
Returns
-------
shape:
Tuple of the shape to use when the two images are transformed
into k-space.
Definition at line 152 of file fft.py.
| Fourier | np.ndarray lsst.scarlet.lite.fft.match_kernel | ( | np.ndarray | Fourier | kernel1, |
| np.ndarray | Fourier | kernel2, | ||
| int | padding = 3, | ||
| int | Sequence[int] | axes = (-2, -1), | ||
| bool | return_fourier = True, | ||
| bool | normalize = False ) |
Calculate the difference kernel to match kernel1 to kernel2
Parameters
----------
kernel1:
The first kernel, either as array or as `Fourier` object
kernel2:
The second kernel, either as array or as `Fourier` object
padding:
Additional padding to use when generating the FFT
to supress artifacts.
axes:
Axes that contain the spatial information for the kernels.
return_fourier:
Whether to return `Fourier` or array
normalize:
Whether or not to normalize the input kernels.
Returns
-------
result:
The difference kernel to go from `kernel1` to `kernel2`.
Definition at line 433 of file fft.py.