polyTEM.image.fft

Adapted from Camila Cendra’s nano package

Functions

apply_fourier_filter(img, dx, fft_size[, ...])

Perfomrs fourier filter

bandpass_filter(s, q_low, q_high, dx)

Generates bandpass filter of size s x s for range of frequencies (q_low, q_high).

cpu_fft(img, shape[, centered])

Computes fft of 2D image stored on cpu using numpy Output fft is zero centered.

fft(array, shape, processor[, centered])

computes the fft based on the processor input.

frc(fft1, fft2, dx, processor)

Fourier Ring Coefficient

gaussian_q_filter(q, sigma_q, sigma_th, M, dx)

Generates gaussian filter in Fourier space for designated q center and bandwidth.

get_orientation_torch(fft, filters, device)

Gets Intensity tensor for different angles at any grid point (x,y).

get_q_pixels(q, s, dx)

Conversion of reciprocal space component in angstroms to spatial frequency in number of pixels.

ifft(ffts, outshape, processor[, ...])

param ffts:

list object. if only one, then it should be treated as the total, complex fft.

normalize_tensor(tensor)

Tensor normalization operation.

plot(fft, s, dx[, ax, q_contour_list, ...])

Plots Fourier transform and optionally radial contours of q space.

q_lineout(fft_gpu, dx[, q_bandwidth, ...])

Function performs azimuthal intensity integrations as function of q for selected q bandwidth.

rotate_filter(single_filter, angles[, device])

Generates 3D tensor of size (M, M, number_angles) with stack of rotated Fourier filters to be used for datacube extraction.

sliding_window_scan(image, res, window_size, ...)

Performs sliding psd across the input image.

ssnr(img1, img2, shape, dx, processor)

Spectral Signal to Noise Ratio

subplot_mini(image, fft_raw, I_vs_th[, ...])

Plots stack of figures to describe nano-FFT extraction process.

tensor_fft(tensor, shape[, centered])

Computes fft of 2D tensor using pytorch GPU implementation TENSOR FFT IS NOT ZERO CENTERED BY DEFAULT! the comment out is legacy code from camila :param tensor: 2D torch.tensor :param size: int shape of fft output size

tensor_ifft(fft)

inverse FFT using pytorch implentation for GPU use :param fft: complex torch.Tensor

tensor_psd(tensor[, size])

Returns powder spectrum of 2D tensor (image) using PyTorch implementation.