Skip to main content

Python non-uniform fast Fourier transform (PyNUFFT)

Project description

PyNUFFT: Python non-uniform fast Fourier transform

A minimal "getting start" tutorial is available at http://jyhmiinlin.github.io/pynufft/ .

Installation

$ pip install pynufft --user

Using Numpy/Scipy

$ python
Python 3.6.11 (default, Aug 23 2020, 18:05:39) 
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pynufft import NUFFT
>>> import numpy
>>> A = NUFFT()
>>> om = numpy.random.randn(10,2)
>>> Nd = (64,64)
>>> Kd = (128,128)
>>> Jd = (6,6)
>>> A.plan(om, Nd, Kd, Jd)
0
>>> x=numpy.random.randn(*Nd)
>>> y = A.forward(x)

Using PyCUDA

>>> from pynufft import NUFFT, helper
>>> import numpy
>>> A2= NUFFT(helper.device_list()[0])
>>> A2.device
<reikna.cluda.cuda.Device object at 0x7f9ad99923b0>
>>> om = numpy.random.randn(10,2)
>>> Nd = (64,64)
>>> Kd = (128,128)
>>> Jd = (6,6)
>>> A2.plan(om, Nd, Kd, Jd)
0
>>> x=numpy.random.randn(*Nd)
>>> y = A2.forward(x)

Using NUDFT_cupy and NUDFT (double precision)

Some users ask for double precision. So NUDFT and NUDFT_cupy are offered. Speed is not great though.

>>> from pynufft import NUDFT_cupy, NUDFT
>>> import numpy
>>> A2= NUDFT_cupy()
>>> om = numpy.random.randn(10,2)
>>> Nd = (64,64)
>>> A2.plan(om, Nd)
>>> x=numpy.random.randn(*Nd)
>>> y = A2.forward(x)
>>> A = NUDFT()
>>> A.plan(om, Nd)
>>> y_cpu = A.forward(x)
>>> print(numpy.linalg.norm(y.get() - y_cpu))
6.752054788357788e-14

Testing GPU acceleration

Python 3.6.11 (default, Aug 23 2020, 18:05:39) 
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pynufft import tests
>>> tests.test_init(0)
device name =  <reikna.cluda.cuda.Device object at 0x7f41d4098688>
0.06576069355010987
0.006289639472961426
error gx2= 2.0638987e-07
error gy= 1.0912560261408778e-07
acceleration= 10.455399523742015
17.97926664352417 2.710083246231079
acceleration in solver= 6.634211944790991

Contact information

email: pynufft@gamil.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pynufft-2020.2.4.tar.gz (11.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pynufft-2020.2.4-py3-none-any.whl (7.9 MB view details)

Uploaded Python 3

File details

Details for the file pynufft-2020.2.4.tar.gz.

File metadata

  • Download URL: pynufft-2020.2.4.tar.gz
  • Upload date:
  • Size: 11.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.6.11

File hashes

Hashes for pynufft-2020.2.4.tar.gz
Algorithm Hash digest
SHA256 163076c2e8d314bad91d5711bf8caf91a5542146f6f1b23ac41b41333b7c0b5e
MD5 2acf5d71987cdeebb3d70112db7a6fd6
BLAKE2b-256 e693fc4af9ba744231b91e70dc2c03841324b9c5bbf22e94b87c46f10f02d7c2

See more details on using hashes here.

File details

Details for the file pynufft-2020.2.4-py3-none-any.whl.

File metadata

  • Download URL: pynufft-2020.2.4-py3-none-any.whl
  • Upload date:
  • Size: 7.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.6.11

File hashes

Hashes for pynufft-2020.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e56c57c72b69345c0519d9ae661c0dc614349ea88aff566fd8cae636bc4c632b
MD5 716c4b8bb8dba903ab3aaa1623a6c33c
BLAKE2b-256 39fc152c43b9e2f30bac12d9dfc9845cebae1a9a417faa3ac3666f55231299f1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page