Metadata-Version: 2.1
Name: fftlog
Version: 0.2.2
Summary: A python wrapper for FFTLog
Author-Email: The emsig community <info@emsig.xyz>
License: CC0 1.0 Universal
         
         Statement of Purpose
         
         The laws of most jurisdictions throughout the world automatically confer
         exclusive Copyright and Related Rights (defined below) upon the creator and
         subsequent owner(s) (each and all, an "owner") of an original work of
         authorship and/or a database (each, a "Work").
         
         Certain owners wish to permanently relinquish those rights to a Work for the
         purpose of contributing to a commons of creative, cultural and scientific
         works ("Commons") that the public can reliably and without fear of later
         claims of infringement build upon, modify, incorporate in other works, reuse
         and redistribute as freely as possible in any form whatsoever and for any
         purposes, including without limitation commercial purposes. These owners may
         contribute to the Commons to promote the ideal of a free culture and the
         further production of creative, cultural and scientific works, or to gain
         reputation or greater distribution for their Work in part through the use and
         efforts of others.
         
         For these and/or other purposes and motivations, and without any expectation
         of additional consideration or compensation, the person associating CC0 with a
         Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
         and Related Rights in the Work, voluntarily elects to apply CC0 to the Work
         and publicly distribute the Work under its terms, with knowledge of his or her
         Copyright and Related Rights in the Work and the meaning and intended legal
         effect of CC0 on those rights.
         
         1. Copyright and Related Rights. A Work made available under CC0 may be
         protected by copyright and related or neighboring rights ("Copyright and
         Related Rights"). Copyright and Related Rights include, but are not limited
         to, the following:
         
           i. the right to reproduce, adapt, distribute, perform, display, communicate,
           and translate a Work;
         
           ii. moral rights retained by the original author(s) and/or performer(s);
         
           iii. publicity and privacy rights pertaining to a person's image or likeness
           depicted in a Work;
         
           iv. rights protecting against unfair competition in regards to a Work,
           subject to the limitations in paragraph 4(a), below;
         
           v. rights protecting the extraction, dissemination, use and reuse of data in
           a Work;
         
           vi. database rights (such as those arising under Directive 96/9/EC of the
           European Parliament and of the Council of 11 March 1996 on the legal
           protection of databases, and under any national implementation thereof,
           including any amended or successor version of such directive); and
         
           vii. other similar, equivalent or corresponding rights throughout the world
           based on applicable law or treaty, and any national implementations thereof.
         
         2. Waiver. To the greatest extent permitted by, but not in contravention of,
         applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
         unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
         and Related Rights and associated claims and causes of action, whether now
         known or unknown (including existing as well as future claims and causes of
         action), in the Work (i) in all territories worldwide, (ii) for the maximum
         duration provided by applicable law or treaty (including future time
         extensions), (iii) in any current or future medium and for any number of
         copies, and (iv) for any purpose whatsoever, including without limitation
         commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes
         the Waiver for the benefit of each member of the public at large and to the
         detriment of Affirmer's heirs and successors, fully intending that such Waiver
         shall not be subject to revocation, rescission, cancellation, termination, or
         any other legal or equitable action to disrupt the quiet enjoyment of the Work
         by the public as contemplated by Affirmer's express Statement of Purpose.
         
         3. Public License Fallback. Should any part of the Waiver for any reason be
         judged legally invalid or ineffective under applicable law, then the Waiver
         shall be preserved to the maximum extent permitted taking into account
         Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
         is so judged Affirmer hereby grants to each affected person a royalty-free,
         non transferable, non sublicensable, non exclusive, irrevocable and
         unconditional license to exercise Affirmer's Copyright and Related Rights in
         the Work (i) in all territories worldwide, (ii) for the maximum duration
         provided by applicable law or treaty (including future time extensions), (iii)
         in any current or future medium and for any number of copies, and (iv) for any
         purpose whatsoever, including without limitation commercial, advertising or
         promotional purposes (the "License"). The License shall be deemed effective as
         of the date CC0 was applied by Affirmer to the Work. Should any part of the
         License for any reason be judged legally invalid or ineffective under
         applicable law, such partial invalidity or ineffectiveness shall not
         invalidate the remainder of the License, and in such case Affirmer hereby
         affirms that he or she will not (i) exercise any of his or her remaining
         Copyright and Related Rights in the Work or (ii) assert any associated claims
         and causes of action with respect to the Work, in either case contrary to
         Affirmer's express Statement of Purpose.
         
         4. Limitations and Disclaimers.
         
           a. No trademark or patent rights held by Affirmer are waived, abandoned,
           surrendered, licensed or otherwise affected by this document.
         
           b. Affirmer offers the Work as-is and makes no representations or warranties
           of any kind concerning the Work, express, implied, statutory or otherwise,
           including without limitation warranties of title, merchantability, fitness
           for a particular purpose, non infringement, or the absence of latent or
           other defects, accuracy, or the present or absence of errors, whether or not
           discoverable, all to the greatest extent permissible under applicable law.
         
           c. Affirmer disclaims responsibility for clearing rights of other persons
           that may apply to the Work or any use thereof, including without limitation
           any person's Copyright and Related Rights in the Work. Further, Affirmer
           disclaims responsibility for obtaining any necessary consents, permissions
           or other rights required for any use of the Work.
         
           d. Affirmer understands and acknowledges that Creative Commons is not a
           party to this document and has no duty or obligation with respect to this
           CC0 or use of the Work.
         
         For more information, please see
         <http://creativecommons.org/publicdomain/zero/1.0/>
         
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
Project-URL: Repository, https://github.com/emsig/fftlog
Requires-Dist: numpy
Requires-Dist: scipy
Provides-Extra: tests
Requires-Dist: flake8; extra == "tests"
Requires-Dist: pytest; extra == "tests"
Requires-Dist: coveralls; extra == "tests"
Requires-Dist: pytest_cov; extra == "tests"
Requires-Dist: flake8-pyproject; extra == "tests"
Provides-Extra: all
Requires-Dist: fftlog[tests]; extra == "all"
Description-Content-Type: text/x-rst

.. image:: https://github.com/emsig/fftlog/workflows/pytest/badge.svg?branch=master
   :target: https://github.com/emsig/fftlog/actions
   :alt: GitHub Actions
.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.3830534.svg
   :target: https://doi.org/10.5281/zenodo.3830534
   :alt: Zenodo DOI


`fftlog` - A python wrapper for FFTLog
======================================

This is a simple `f2py`-wrapper for the logarithmic FFT code *FFTLog* as
presented in Appendix B of [Hami00]_ and published at
`casa.colorado.edu/~ajsh/FFTLog <http://casa.colorado.edu/~ajsh/FFTLog>`_.

A pure python version (`pyfftlog`) can be found on `github.com/emsig/pyfftlog
<https://github.com/emsig/pyfftlog>`_. Tests have shown that `fftlog` is a bit
faster than `pyfftlog`, but `pyfftlog` is easier to implement, as you only need
`NumPy` and `SciPy`, without the need to compile anything.

I hope that `FFTLog` will make it into `SciPy` in the future, which will make
this project redundant. (If you have the bandwidth and are willing to chip in
have a look at `SciPy PR #7310 <https://github.com/scipy/scipy/pull/7310>`_.)

Be aware that `pyfftlog` has not been tested extensively. It works fine for the
test from the original code, and my use case, which is `pyfftlog.fftl` with
`mu=0.5` (sine-transform), `q=0` (unbiased), `k=1`, `kropt=1`, and `tdir=1`
(forward). Please let me know if you encounter any issues.

- **Documentation**: https://pyfftlog.readthedocs.io
- **Source Code**: https://github.com/emsig/fftlog

**Note** that the documentation is for the pure python version `pyfftlog`, but
equally applies to `fftlog`.

Description of FFTLog from the FFTLog-Website
---------------------------------------------

FFTLog is a set of fortran subroutines that compute the fast Fourier or Hankel
(= Fourier-Bessel) transform of a periodic sequence of logarithmically spaced
points.

FFTLog can be regarded as a natural analogue to the standard Fast Fourier
Transform (FFT), in the sense that, just as the normal FFT gives the exact (to
machine precision) Fourier transform of a linearly spaced periodic sequence, so
also FFTLog gives the exact Fourier or Hankel transform, of arbitrary order m,
of a logarithmically spaced periodic sequence.

FFTLog shares with the normal FFT the problems of ringing (response to sudden
steps) and aliasing (periodic folding of frequencies), but under appropriate
circumstances FFTLog may approximate the results of a continuous Fourier or
Hankel transform.

The FFTLog algorithm was originally proposed by [Talm78]_.

*For the full documentation, see* `casa.colorado.edu/~ajsh/FFTLog
<http://casa.colorado.edu/~ajsh/FFTLog>`_.


Installation
------------

You can install fftlog either via **conda**:

.. code-block:: console

   conda install -c conda-forge fftlog

or via **pip**:

.. code-block:: console

   pip install fftlog


Creation
--------

The power of `f2py` did most of the work.

The *src*-directory contains the original fortran files as downloaded from
`casa.colorado.edu/~ajsh/FFTLog <http://casa.colorado.edu/~ajsh/FFTLog>`_.  The
only change I made was to recode the coding of *fftlog.f*, as `f2py` struggled
with a few characters in the description part:

.. code:: bash

   recode latin1..UTF-8 fftlog.f

Thereafter I used `f2py` to produce the `pyf`-instructions with the following
command, generating only hooks for the functions `fhti`, `fttl`, `fht`, and
`fhtq`:

.. code:: bash

   f2py src/* -m fftlog -h fftlog.pyf only: fhti fftl fht fhtq :

Lastly I amended the `pyf`-instructions, mainly with some `intent` and
`optional` statements as well as the corresponding default values.


Notes
'''''
1. `kropt=3` (interactive adjusting) is not possible with `fftlog`
2. `wsave`-dimension is set to `2*n+3*(n/2)+19`, the biggest of the four
   minimum sizes described in `fftlog.f`.


References
----------

.. [Hami00] Hamilton, A. J. S., 2000, Uncorrelated modes of the non-linear
    power spectrum: Monthly Notices of the Royal Astronomical Society, 312,
    pages 257-284; DOI: `10.1046/j.1365-8711.2000.03071.x
    <http://dx.doi.org/10.1046/j.1365-8711.2000.03071.x>`_; Website of FFTLog:
    `casa.colorado.edu/~ajsh/FFTLog <http://casa.colorado.edu/~ajsh/FFTLog>`_.

.. [Talm78] Talman, J. D., 1978, Numerical Fourier and Bessel transforms in
    logarithmic variables: Journal of Computational Physics, 29, pages 35-48;
    DOI: `10.1016/0021-9991(78)90107-9
    <http://dx.doi.org/10.1016/0021-9991(78)90107-9>`_.


License, Citation, and Credits
------------------------------

These additions to the original FFTLog-code are released to the public domain
under the `CC0 1.0 License
<http://creativecommons.org/publicdomain/zero/1.0>`_.

All releases have a Zenodo-DOI, which can be found on `10.5281/zenodo.3830364
<https://doi.org/10.5281/zenodo.3830534>`_.

Permission to distribute the original Fortran `FFTLog` code with this Python
`fftlog` package has been granted (email from Andrew Hamilton to Dieter
Werthmüller dated 28 September 2016).

Credits commented in the original code:

`FFTLog` uses the NCAR suite of FFT routines, and a modified version of the
complex Gamma function from the gamerf package at
`momonga.t.u-tokyo.ac.jp/~ooura/gamerf.html
<http://momonga.t.u-tokyo.ac.jp/~ooura/gamerf.html>`_.
The original gamerf copyright statement states::

   Copyright(C) 1996 Takuya OOURA (email: ooura@mmm.t.u-tokyo.ac.jp).
   You may use, copy, modify this code for any purpose and
   without fee. You may distribute this ORIGINAL package.

Permission to distribute the modified gamma function code with the FFTLog
package has been granted (email from Takuya Ooura to Andrew Hamilton dated 16
March 1999).

Be kind and give credits by citing Hamilton (2000).
