Python wrappers of the FortranCWT codes created with f2py
If you use our codes or your research is related to our paper, please kindly cite the following paper, in which the fast CWT algorithms are reviewed and compared.
@article{Wang2023,
author = {Wang, Yun and He, Ping},
title = "{Comparisons between fast algorithms for the continuous wavelet transform and applications in cosmology: the 1D case}",
journal = {RAS Techniques and Instruments},
volume = {2},
number = {1},
pages = {307-323},
year = {2023},
month = {06},
issn = {2752-8200},
doi = {10.1093/rasti/rzad020},
url = {https://doi.org/10.1093/rasti/rzad020},
eprint = {https://academic.oup.com/rasti/advance-article-pdf/doi/10.1093/rasti/rzad020/50722942/rzad020.pdf},
}
- FFTW3
- Python3
- Numpy
- GNU Fortran 95 compiler
- MinGW (for Windows)
$:git clone https://github.com/WangYun1995/pyFortranCWT.git
$:cd pyFortranCWT/fftcwt
$:python -m numpy.f2py -c Parameters.f95 Tools.f95 FFTCWT.f95 -I/.../fftw3/include -L/.../fftw3/lib -lfftw3 --link-fftw3 --fcompiler=gnu95 --compiler=unix --opt='-O3' -m fftcwt
$:cd ..
$:cd v97cwt
$:python -m numpy.f2py -c Parameters.f95 Tools.f95 V97CWT.f95 --fcompiler=gnu95 --compiler=unix --opt='-O3' -m v97cwt
$:cd ..
$:cd m02cwt
$:python -m numpy.f2py -c Parameters.f95 Tools.f95 M02CWT.f95 --fcompiler=gnu95 --compiler=unix --opt='-O3' -m m02cwt
$:cd ..
$:cd a19cwt
$:python -m numpy.f2py -c Parameters.f95 Tools.f95 A19CWT.f95 --fcompiler=gnu95 --compiler=unix --opt='-O3' -m a19cwt
The above commands will yield ".so" files, which can be imported in Python. Then add export PYTHONPATH="${PYTHONPATH}:/.../.../pyFortranCWT/"
to your ~/.bashrc
and run the following commond
$:source ~/.bashrc
> git clone https://github.com/WangYun1995/pyFortranCWT.git
> cd pyFortranCWT\fftcwt
> python -m numpy.f2py -c Parameters.f95 Tools.f95 FFTCWT.f95 -I"\...\fftw3\include" -L"\...\fftw3\lib" -lfftw3 --link-fftw3 --fcompiler=gnu95 --compiler=mingw32 --opt='-O3' -m fftcwt
> cd ..
> cd v97cwt
> python -m numpy.f2py -c Parameters.f95 Tools.f95 V97CWT.f95 --fcompiler=gnu95 --compiler=mingw32 --opt='-O3' -m v97cwt
> cd ..
> cd m02cwt
> python -m numpy.f2py -c Parameters.f95 Tools.f95 M02CWT.f95 --fcompiler=gnu95 --compiler=mingw32 --opt='-O3' -m m02cwt
> cd ..
> cd a19cwt
> python -m numpy.f2py -c Parameters.f95 Tools.f95 A19CWT.f95 --fcompiler=gnu95 --compiler=mingw32 --opt='-O3' -m a19cwt
The above commands will yield ".pyd" files, which can be imported in Python. Then add ...\...\pyFortranCWT
to the PYTHONPATH. (see How to add to the PYTHONPATH in Windows)
see pyFortran_examples.ipynb for examples.