aspire.nufft package

Submodules

aspire.nufft.cufinufft module

aspire.nufft.finufft module

class aspire.nufft.finufft.FinufftPlan(*args, **kwargs)

Bases: Plan

A plan for non-uniform FFT in 2D or 3D.

Parameters:
  • sz – A tuple indicating the geometry of the signal.

  • fourier_pts – The points in Fourier space where the Fourier transform is to be calculated, arranged as a dimension-by-K array. These need to be in the range [-pi, pi] in each dimension.

  • epsilon – The desired precision of the NUFFT.

  • ntransforms – Optional integer indicating if you would like to compute a batch of ntransforms. transforms. Implies vol_f.shape is (ntransforms, …).

adjoint(signal)

Compute the NUFFT adjoint using this plan instance.

Parameters:

signal – Signal to be transformed. For a single transform, this should be a a 1D array of len num_pts. For a batch, signal should have shape (ntransforms, num_pts).

Returns:

Transformed signal (sz) or (ntransforms, sz).

transform(signal)

Compute the NUFFT transform using this plan instance.

Parameters:

signal – Signal to be transformed. For a single transform, this should be a a 1, 2, or 3D array matching the plan sz. For a batch, signal should have shape (ntransforms, *sz).

Returns:

Transformed signal of shape num_pts or (ntransforms, num_pts).

aspire.nufft.pynfft module

aspire.nufft.utils module

aspire.nufft.utils.nextpow2(x)

Module contents

class aspire.nufft.Plan(*args, **kwargs)

Bases: object

aspire.nufft.all_backends()

Determine all available NFFT backends

Returns:

A list of strings representing available NFFT backends

aspire.nufft.anufft(sig_f, fourier_pts, sz, real=False, epsilon=1e-08)

Wrapper for 1, 2, and 3 dimensional Non Uniform FFT Adjoint. Dimension is based on the dimension of fourier_pts and checked against sig_f.

Selects best available package from nfft backends configuration list.

When sig_f is provided as a CuPy GPU array with a cufinufft backend, result is maintained on GPU.

Parameters:
  • sig_f – Array representing the signal(s) in Fourier space to be transformed. sig_f either matches length of fourier_pts or sig_f.shape is stack of (ntransforms, …).

  • fourier_pts – The points in Fourier space where the Fourier transform is to be calculated, arranged as a dimension-by-K array. These need to be in the range [-pi, pi] in each dimension.

  • sz – A tuple indicating the geometry of the signal.

  • real – Optional Bool indicating if you would like only the real components, Defaults False.

Returns:

The Non Uniform FFT adjoint transform.

aspire.nufft.backend_available(backend)

Whether a particular NFFT backend is available

Parameters:

backend – String representing the NFFT backend, e.g. ‘finufft’ or ‘pynfft’

Returns:

Boolean on whether the backend is available

aspire.nufft.check_backends(raise_errors=True)

Check all NFFT backends in package configuration

Parameters:

raise_errors – Whether to raise a RuntimeError if no backends detected.

Returns:

On return, the global names ‘backends’/’default_plan_class’ have been populated

aspire.nufft.nufft(sig_f, fourier_pts, real=False, epsilon=1e-08)

Wrapper for 1, 2, and 3 dimensional Non Uniform FFT Dimension is based on the dimension of fourier_pts and checked against sig_f.

Selects best available package from nfft backends configuration list.

When sig_f is provided as a CuPy GPU array with a cufinufft backend, result is maintained on GPU.

Parameters:
  • sig_f – Array representing the signal(s) in real space to be transformed. sig_f either matches sz or sig_f.shape is stack of (…, ntransforms).

  • fourier_pts – The points in Fourier space where the Fourier transform is to be calculated, arranged as a dimension-by-K array. These need to be in the range [-pi, pi] in each dimension.

  • real – Optional Bool indicating if you would like only the real components, Defaults False.

Returns:

The Non Uniform FFT transform.