SHIFT is a lightweight Python library designed to simplify Fourier transforms and spectral calculations on regular grids. Built around SciPy's FFT routines, SHIFT provides a convenient interface for computing Fourier, discrete cosine (DCT), and discrete sine (DST) transforms in one, two, and three dimensions, alongside utilities for constructing grids and their corresponding Fourier-space modes.
A central motivation behind SHIFT is to make parallel Fourier
transforms easier to install, use, and integrate into scientific
applications. Unlike implementations requiring FFTW and additional
compiled extensions, SHIFT uses SciPy's FFT backend and supports
distributed transforms through mpi4py, employing an MPI slab
decomposition. This avoids the need for a separate FFTW installation
while retaining compatibility with standard scientific Python
environments.
In addition to spectral transforms, SHIFT provides utilities for MPI communication and distributed array operations, making it suitable for integration into larger scientific computing workflows.
NOTE: SHIFT was originally conceived as a framework for Fourier transforms in Cartesian, polar, and spherical coordinate systems. Current development focuses on Cartesian spectral transforms and MPI-based scientific computing. Experimental polar and spherical transform implementations are available in the
spherebranch, but are not part of the supported release and should be used with caution. Further development of these capabilities is planned.
numbanumpyscipympi4py[Optional: enables MPI distributed processes]
SHIFT can be installed via pip:
pip install shift-fft
Or by cloning the github repository:
git clone https://github.com/knaidoo29/SHIFT.git
cd SHIFT
pip install .
The latter of which can be used to install specific branches.
Once this is done you should be able to call SHIFT from python:
import shiftTo use the MPI functionality please take a look at the documentation which instructs users how to use the SHIFT MPI object and how to run these distributed jobs successfully without errors or MPI related hanging.
In depth documentation and tutorials are provided here.
SHIFT is released under the MIT License. See LICENSE for details.
If you use SHIFT in your work, please cite:
@software{naidoo_shift_2025,
author = {Naidoo, Krishna},
title = {SHIFT: a scalable MPI library for computing fast Fourier transforms in python},
year = 2025,
publisher = {Zenodo},
doi = {10.5281/zenodo.17093446},
url = {https://doi.org/10.5281/zenodo.17093446}}If you have any issues with the code or want to suggest ways to improve it please open a new issue (here) or (if you don't have a github account) email krishna.naidoo.11@ucl.ac.uk.
