ptyrad.utils.math_ops

ptyrad.utils.math_ops#

Math operations of FFTs, masks, affine transformation matrices, etc.

Functions

approx_torch_quantile(t, q[, sample_size])

Approximated quantile to prevent the 2^24 element (roughly 16.7M) limitation of torch.quantile as of now.

compose_affine_matrix(scale, asymmetry, ...)

decompose_affine_matrix(input_affine_mat)

exponential_decay(r, a, b)

fftshift2(x)

A wrapper over torch.fft.fftshift for the last 2 dims

get_decomposed_affine_matrix_from_bases(...)

Fit the affine matrix components from input and output matrices A and B

ifftshift2(x)

A wrapper over torch.fft.ifftshift for the last 2 dims

make_gaussian_mask(Npix, radius, std[, center])

Create a 2D Gaussian-blurred circular mask.

make_sigmoid_mask(Npix[, relative_radius, ...])

Create a 2D circular mask with a sigmoid transition.

mfft2(im)

power_law(r, a, b)

torch_phasor(phase)

Creates a complex tensor with unit magnitude using the phase.