Nufft

ducc0.nufft

ducc0.nufft.bestEpsilon(*, ndim: int, singleprec: bool, sigma_min: float = 1.1, sigma_max: float = 2.6) float

Computes the smallest possible error for the given NUFFT parameters.

Parameters:
  • ndim (int (1-3)) – the dimensionality of the transform

  • singleprec (bool) – True if np.float32/np.complex64 are used, otherwise False

  • sigma_min (float) – minimum and maximum allowed oversampling factors 1.2 <= sigma_min < sigma_max <= 2.5

  • sigma_max (float) – minimum and maximum allowed oversampling factors 1.2 <= sigma_min < sigma_max <= 2.5

Returns:

the smallest possible error that can be achieved for the given parameters.

Return type:

float

ducc0.nufft.nu2u(*, points: numpy.ndarray, coord: numpy.ndarray, forward: bool, epsilon: float, nthreads: int = 1, out: numpy.ndarray = None, verbosity: int = 0, sigma_min: float = 1.2, sigma_max: float = 2.51, periodicity: object = 6.283185307179586, fft_order: bool = False) numpy.ndarray

Type 1 non-uniform FFT (non-uniform to uniform)

Parameters:
  • points (numpy.ndarray((npoints,), dtype=numpy.complex)) – The input values at the specified non-uniform grid points

  • coord (numpy.ndarray((npoints, ndim), dtype=numpy.float32 or numpy.float64)) – the coordinates of the npoints non-uniform points. ndim must be the same as out.ndim Periodicity is assumed; the coordinates don’t have to lie inside a particular interval, but smaller absolute coordinate values help accuracy

  • forward (bool) – if True, perform the FFT with exponent -1, else +1.

  • epsilon (float) – desired accuracy for single precision inputs, this must be >1e-6, for double precision it must be >2e-13

  • nthreads (int >= 0) – the number of threads to use for the computation if 0, use as many threads as there are hardware threads available on the system

  • out (numpy.ndarray(1D/2D/3D, same dtype as points)) – the grid of output data Note: this is a mandatory parameter, since its shape defines the grid dimensions!

  • verbosity (int) – 0: no console output 1: some diagnostic console output

  • sigma_min (float) – minimum and maximum allowed oversampling factors 1.2 <= sigma_min < sigma_max <= 2.5

  • sigma_max (float) – minimum and maximum allowed oversampling factors 1.2 <= sigma_min < sigma_max <= 2.5

  • periodicity (float or sequence of floats) – periodicity of the coordinates

  • fft_order (bool) – if False, grids start with the most negative Fourier node if True, grids start with the zero Fourier mode

Returns:

the computed grid values. Identical to out.

Return type:

numpy.ndarray(1D/2D/3D, same dtype as points)

ducc0.nufft.u2nu(*, grid: numpy.ndarray, coord: numpy.ndarray, forward: bool, epsilon: float, nthreads: int = 1, out: object = None, verbosity: int = 0, sigma_min: float = 1.2, sigma_max: float = 2.51, periodicity: object = 6.283185307179586, fft_order: bool = False) numpy.ndarray

Type 2 non-uniform FFT (uniform to non-uniform)

Parameters:
  • grid (numpy.ndarray(1D/2D/3D, dtype=complex)) – the grid of input data

  • coord (numpy.ndarray((npoints, ndim), dtype=numpy.float32 or numpy.float64)) – the coordinates of the npoints non-uniform points. ndim must be the same as grid.ndim Periodicity is assumed; the coordinates don’t have to lie inside a particular interval, but smaller absolute coordinate values help accuracy

  • forward (bool) – if True, perform the FFT with exponent -1, else +1.

  • epsilon (float) – desired accuracy for single precision inputs, this must be >1e-6, for double precision it must be >2e-13

  • nthreads (int >= 0) – the number of threads to use for the computation if 0, use as many threads as there are hardware threads available on the system

  • out (numpy.ndarray((npoints,), same data type as grid), optional) – if provided, this will be used to store the result

  • verbosity (int) – 0: no console output 1: some diagnostic console output

  • sigma_min (float) – minimum and maximum allowed oversampling factors

  • sigma_max (float) – minimum and maximum allowed oversampling factors

  • periodicity (float or sequence of floats) – periodicity of the coordinates

  • fft_order (bool) – if False, grids start with the most negative Fourier node if True, grids start with the zero Fourier mode

Returns:

the computed values at the specified non-uniform grid points. Identical to out if it was provided

Return type:

numpy.ndarray((npoints,), same data type as grid)