Coder Social home page Coder Social logo

2dfftlog's Introduction

2D-FFTLog

Xiao Fang

2D-FFTLog code for efficiently computing integrals containing two Bessel or spherical Bessel functions, in the context of transforming covariance matrices from Fourier space to real space.

This code has been adapted and used in CosmoCov.

-> Paper to cite

The code is independently written and tested in python (./python/twobessel.py) and C (./C/). Examples of calling the routines are given in ./C/test1.c, ./C/test2.c, and ./python/test.py. In the examples, input arrays k and P(k) are read in, with k sampled logarithmically. k3 P(k) is set as f(k) in the integrand of the Gaussian covariance. The code then builds a matrix with diagonal elements , and then performs 2D-FFTLog. For non-Gaussian covariance, one may read in the covariance and apply 2D-FFTLog directly.

For non-bin averaged case, the transformed covariances are evaluated at points given by array 1/k. For bin-averaged case, one needs to specify bin-width in log-space, but note that the output r array is always at bin edges.

To run python examples, go to (./python/) directory, and run

python test.py

To run C examples, go to (./C/) directory, and compile with command

make tests

then run tests:

./test1
./test2

See more details of the algorithm in Fang et al (2020); arXiv:2004.04833.

Please feel free to use and adapt the code for your own purpose, and let me know if you are confused or find a bug (just open an issue) or throw me an email (address shown on the profile page). 2DFFTLog is open source and distributed with the MIT license.

Paper to Cite

Please cite the following paper if you use 2D-FFTLog in your research:

X. Fang, T. Eifler, E. Krause; 2D-FFTLog: Efficient computation of real space covariance matrices for galaxy clustering and weak lensing; arXiv:2004.04833

2dfftlog's People

Contributors

xfangcosmo avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.