pyfftw

A pythonic python wrapper around FFTW

https://github.com/pyfftw/pyfftw

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    4 of 31 committers (12.9%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (5.6%) to scientific vocabulary

Keywords from Contributors

closember qt cublas flexible alignment cusolver wx tk gtk tensor
Last synced: 6 months ago · JSON representation

Repository

A pythonic python wrapper around FFTW

Basic Info
Statistics
  • Stars: 396
  • Watchers: 17
  • Forks: 111
  • Open Issues: 61
  • Releases: 10
Created about 14 years ago · Last pushed 6 months ago
Metadata Files
Readme License

README.md

Current Build Status

| GitHub Actions | Read the Docs | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | | Build Wheels, Test and Release | read_the_docs |

Conda-forge Status

Linux OSX Windows

Conda-forge Info

| Name | Downloads | Version | Platforms | | ---------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | | Conda Recipe | Conda Downloads | Conda Version | Conda Platforms |

PyFFTW

pyFFTW is a pythonic wrapper around FFTW 3, the speedy FFT library. The ultimate aim is to present a unified interface for all the possible transforms that FFTW can perform.

Both the complex DFT and the real DFT are supported, as well as on arbitrary axes of arbitrary shaped and strided arrays, which makes it almost feature equivalent to standard and real FFT functions of numpy.fft (indeed, it supports the clongdouble dtype which numpy.fft does not).

Wisdom import and export now works fairly reliably.

Operating FFTW in multithreaded mode is supported.

pyFFTW implements the numpy and scipy fft interfaces in order for users to take advantage of the speed of FFTW with minimal code modifications.

A comprehensive unittest suite can be found with the source on the GitHub repository or with the source distribution on PyPI.

The documentation can be found on Read the Docs the source is on GitHub and the python package index page PyPI. Issues and questions can be raised at the GitHub Issues page.

Requirements (i.e. what it was designed for)

  • Python >= 3.11 (lower versions may work)
  • Numpy >= 1.20 (lower versions may work)
  • FFTW >= 3.3 (lower versions may work) libraries for single, double, and long double precision in serial and multithreading (pthreads or openMP) versions.
  • Cython >= 3

(install these as much as possible with your preferred package manager).

In practice, pyFFTW may work with older versions of these dependencies, but it is not tested against them.

We build wheels for PyPy 3.11, but this platform has not been tested.

Optional Dependencies

Scipy and Dask are only required in order to use their respective interfaces. In practice, older versions may work, but they are not tested against.

Installation

We recommend not building from github, but using the release on the python package index with tools such as pip:

pip install pyfftw

Pre-built binary wheels for 64-bit Python on Linux, Mac OS X and Windows are available on the PyPI page for all supported Python versions. Note that we only support binaries for 64-bit Python. 32-bit and ARM architectures have prebuilt wheels for some configurations - see below.

Note that prior to Python 3.9, the Windows installation defaulted to being 32-bit even on 64-bit Windows, so if you are having problems installing using pip (typically with an error message like ERROR: Failed building wheel for pyfftw) then please check your Python version.

Installation from PyPI may also work on other systems when the FFTW libraries are available, but other platforms have not been tested.

Alternatively, users of the conda package manager can install from the conda-forge channel via:

conda install -c conda-forge pyfftw

Read on if you do want to build from source...

Wheels

Prebuilt wheels are available for the following configurations:

| Python version | Windows (32 bit) | Windows (64 bit) | Windows ARM (64 bit) | MacOS | MacOS ARM | Linux (64 bit) | Linux ARM (64 bit) | | :-------------------------------: | :--------------: | :--------------: | :------------------: | :---: | :-------- | :------------: | :----------------: | | CPython < 3.11 (unsupported) | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | | CPython 3.11 | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | | CPython 3.12 | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | | CPython 3.13 | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | | PyPy < 3.11 (unsupported) | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | | PyPy 3.11 | ❌ | ✔ | ❌ | ✔ | ✔ | ✔ | ❌ | | PyPy > 3.11 (unsupported for now) | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |

Note that Linux 32-bit wheels are available only for pyFFTW <= 0.13.1.

If your configuration does not match one of these you will have to build pyfftw from source yourself. See instructions below.

Building

To build in place:

pip install -e . -v

That cythonizes the python extension and builds it into a shared library which is placed in pyfftw/. The directory can then be treated as a python package.

After you've run setup.py with cython available, you then have a normal C extension in the pyfftw directory. Further building does not depend on cython (as long as the .c file remains).

During configuration the available FFTW libraries are detected, so pay attention to the output when running setup.py. On certain platforms, for example the long double precision is not available. pyFFTW still builds fine but will fail at runtime if asked to perform a transform involving long double precision.

To build against FFTW libraries at non standard location, some compilers are sensitive to the environment variables CPATH and LIBRARY_PATH. Moreover, you can also use PYFFTW_INCLUDE and PYFFTW_LIB_DIR. If the FFTW libraries still cannot be found, you might also need to set the environment variable CC to build with the compiler used to compile the libraries.

Regarding multithreading, if both posix and openMP FFTW libs are available, the openMP libs are preferred. This preference can be reversed by defining the environment variable PYFFTW_USE_PTHREADS prior to building. If neither option is available, pyFFTW works in serial mode only.

For more ways of building and installing, see the distutils documentation and setuptools documentation.

Platform specific build info

Windows

To build for windows from source, download the fftw dlls for your system and the header file from here (they're in a zip file) and place them in the pyfftw directory. The files are libfftw3-3.dll, libfftw3l-3.dll, libfftw3f-3.dll. These libs use pthreads for multithreading. If you're using a version of FFTW other than 3.3, it may be necessary to copy fftw3.h into include\win.

The builds on PyPI use mingw for the 32-bit release and the Windows SDK C++ compiler for the 64-bit release. The scripts should handle this automatically. If you want to compile for 64-bit Windows, you have to use the MS Visual C++ compiler. Set up your environment as described here and then run setup.py with the version of python you wish to target and a suitable build command.

For using the MS Visual C++ compiler, you'll need to create a set of suitable .lib files as described on the FFTW page.

Mac OSX

Install FFTW from homebrew:

brew install fftw

Set temporary environmental variables, such that pyfftw finds fftw:

export DYLD_LIBRARY_PATH=/usr/local/lib
export LDFLAGS="-L/usr/local/lib"
export CPPFLAGS="-I/usr/local/include"

Now install pyfftw from pip:

pip install pyfftw

It has been suggested that macports might also work fine. You should then replace the LD environmental variables above with the right ones.

  • DYLDLIBRARYPATH - path for libfftw3.dylib etc - find /usr -name libfftw3.dylib
  • LDFLAGS - path for fftw3.h - find /usr -name fftw3.h

FreeBSD

Install FFTW from ports tree or pkg:

- math/fftw3
- math/fftw3-float
- math/fftw3-long

Please install all of them, if possible.

Testing

Tests should be run using pytest. Install using:

sh pip install pytest

To run tests against the installed (compiled) pyFFTW wheel, use:

sh pytest --import-mode=append tests/

Note: --import-mode=append is needed to prevent pytest patching sys.path in a way that resolves the local installation over the wheel installation.

Contributions

Contributions are always welcome and valued. The primary restriction on accepting contributions is that they are exhaustively tested. The bulk of pyFFTW has been developed in a test-driven way (i.e. the test to be satisfied is written before the code). I strongly encourage potential contributors to adopt such an approach.

See some of my philosophy on testing in development here. If you want to argue with the philosophy, there is probably a good place to do it.

New contributions should adhere to PEP 8, but this is only weakly enforced (there is loads of legacy stuff that breaks it, and things like a single trailing whitespace is not a big deal).

The best place to start with contributing is by raising an issue detailing the specifics of what you wish to achieve (there should be a clear use-case for any new functionality). I tend to respond pretty quickly and am happy to help where I can with any conceptual issues.

I suggest reading the issues already open in order that you know where things might be heading, or what others are working on.

Use PDM to setup a virtual environment for the development of pyFFTW

PDM, which can be for example installed with Pipx, can be used to setup a virtual environment .venv for the development of pyFFTW and install pyFFTW in editable mode.

sh pdm sync --clean -v

This environment is described in the file pyproject.toml and the exact versions of the packages are listed in a lock file pdm.lock. Maintainers can update the lockfile by running (typically in a PR before each release)

sh pdm lock

Owner

  • Name: pyFFTW
  • Login: pyFFTW
  • Kind: organization

GitHub Events

Total
  • Create event: 1
  • Release event: 1
  • Issues event: 16
  • Watch event: 17
  • Issue comment event: 33
  • Push event: 7
  • Pull request event: 13
  • Pull request review event: 16
  • Pull request review comment event: 8
  • Fork event: 1
Last Year
  • Create event: 1
  • Release event: 1
  • Issues event: 16
  • Watch event: 17
  • Issue comment event: 33
  • Push event: 7
  • Pull request event: 13
  • Pull request review event: 16
  • Pull request review comment event: 8
  • Fork event: 1

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 639
  • Total Committers: 31
  • Avg Commits per committer: 20.613
  • Development Distribution Score (DDS): 0.786
Past Year
  • Commits: 5
  • Committers: 2
  • Avg Commits per committer: 2.5
  • Development Distribution Score (DDS): 0.4
Top Committers
Name Email Commits
Henry Gomersall h****g@c****t 137
Henry Gomersall h****g@s****k 121
Frederik Beaujean F****n@l****e 72
Gregory Lee g****7@g****m 65
Henry Gomersall h****g@k****k 55
Gregory R. Lee g****e@c****g 47
John Kirkham k****j@j****g 40
Jeppe Klitgaard hi@j****e 36
David Wells d****s@v****u 14
Peter Bell p****0@l****k 11
Henry Gomersall h****l@s****k 7
Michael McNeil Forbes m****t@g****m 6
Zachary Pincus z****s@g****m 5
Jonathan Essen j****n@g****m 2
Matthieu Melot m****t@a****m 2
Ian Henriksen i****e@g****m 2
Arve Seljebu a****u@g****m 2
Matthew D. Scholefield m****9@g****m 2
jakirkham j****m@g****m 1
Dennis Brakhane b****e@g****m 1
Stephen Tu t****l@g****m 1
Yu Feng y****1@c****u 1
Hsiou-Yuan Liu h****9@g****m 1
Micael Jarniac m****l@j****m 1
endolith e****h@g****m 1
Iblis Lin i****s@h****w 1
Antony Lee a****e@g****m 1
Stefan Peterson s****t 1
unknown w****1@w****) 1
DWesl 2****l 1
and 1 more...

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 95
  • Total pull requests: 79
  • Average time to close issues: 8 months
  • Average time to close pull requests: 3 months
  • Total issue authors: 62
  • Total pull request authors: 18
  • Average comments per issue: 6.72
  • Average comments per pull request: 4.94
  • Merged pull requests: 61
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 8
  • Pull requests: 16
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 25 days
  • Issue authors: 3
  • Pull request authors: 3
  • Average comments per issue: 0.13
  • Average comments per pull request: 3.19
  • Merged pull requests: 11
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • paugier (15)
  • hgomersall (6)
  • grlee77 (5)
  • JeppeKlitgaard (5)
  • yurivict (2)
  • mshane87 (2)
  • bwohlberg (2)
  • e-kwsm (2)
  • phlibi (2)
  • gabrielfougeron (2)
  • willamgld (1)
  • gabrielb09 (1)
  • bwagner (1)
  • asapsmc (1)
  • p5a0u9l (1)
Pull Request Authors
  • paugier (27)
  • grlee77 (20)
  • hgomersall (5)
  • e-kwsm (4)
  • gabrielfougeron (4)
  • AlexeyBarsuk (2)
  • JeppeKlitgaard (2)
  • jsalort (2)
  • codyd51 (2)
  • ptim0626 (2)
  • karlotness (2)
  • rmorshea (1)
  • MicaelJarniac (1)
  • drwells (1)
  • congzhangzh (1)
Top Labels
Issue Labels
help wanted (3) feature (2) task (2) discussion (2) pull request welcome (2) bug (1) build (1)
Pull Request Labels
maintenance (7) build (5) enhancement (2) documentation (1) feature (1) bug (1)

Packages

  • Total packages: 4
  • Total downloads:
    • pypi 55,069 last-month
  • Total dependent packages: 66
    (may contain duplicates)
  • Total dependent repositories: 169
    (may contain duplicates)
  • Total versions: 90
  • Total maintainers: 3
pypi.org: pyfftw

A pythonic wrapper around FFTW, the FFT library, presenting a unified interface for all the supported transforms.

  • Versions: 24
  • Dependent Packages: 66
  • Dependent Repositories: 169
  • Downloads: 55,069 Last month
Rankings
Dependent packages count: 0.3%
Dependent repos count: 1.2%
Downloads: 1.8%
Average: 2.2%
Stargazers count: 3.4%
Forks count: 4.6%
Maintainers (3)
Last synced: 6 months ago
proxy.golang.org: github.com/PyFFTW/PyFFTW
  • Versions: 22
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.5%
Average: 5.7%
Dependent repos count: 5.9%
Last synced: 6 months ago
proxy.golang.org: github.com/pyFFTW/pyFFTW
  • Versions: 22
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.7%
Average: 5.9%
Dependent repos count: 6.0%
Last synced: 6 months ago
proxy.golang.org: github.com/pyfftw/pyfftw
  • Versions: 22
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.7%
Average: 5.9%
Dependent repos count: 6.0%
Last synced: 6 months ago

Dependencies

requirements.txt pypi
  • cython >=0.29.18
  • dask >=1.0.0
  • numpy >=1.16
  • scipy >=1.2.0
setup.py pypi
  • numpy_requirement *
.github/workflows/wheel_tests_and_release.yml actions
  • actions/checkout v3 composite
  • actions/download-artifact v2 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v2 composite
  • docker/setup-qemu-action v2 composite
  • ilammy/msvc-dev-cmd v1 composite
  • softprops/action-gh-release v1 composite