Coder Social home page Coder Social logo

modichirag / cleft Goto Github PK

View Code? Open in Web Editor NEW
2.0 4.0 0.0 1.81 MB

Parallelized python code to compute the tree-level and 1-loop mode-coupling integrals and real-space power spectrum of biased tracers from Convolution Lagrangian Effective Field Theory

Jupyter Notebook 94.49% Python 5.51%

cleft's Introduction

Power spectrum code

Parallelized python code to compute the tree-level and 1-loop mode-coupling integrals and hence the real-space power spectrum of biased tracers from Convolution Lagrangian Effective Field Theory, as described in:

Z.Vlah, E.Castorina, M.White

The Gaussian streaming model and Convolution Lagrangian effective field theory

JCAP 12(2016)007, [https://arxiv.org/abs/1609.02908]

The code is parallelized using 'pool' object in python.

Requirements

This code requires NumPy and SciPy and makes use of the "multiplicative convolutional fast integral transforms" library:

https://github.com/eelregit/mcfit

which you will need to install.

Code setup

The main piece of code is in cleftpool.py, which has CLEFT class to create PT kernels and make_table function in the same file uses these kernels to create a table of P(k) where different columns correspond to contribution of different bias parameters. The CLEFT class also takes in an 'order' argument which can be 1 or 2 (default) to do ZA or 1-loop perturbation theory.

We provide a script "main.py" which can be directly run as follows:

  python main.py -- pfile path_to_linear_ps_file
  • Other arguments that can be provided are can be seen by calling:
  python main.py -- help
  • Some of the important arguments are:
    • pfile: path to the file containing linear power spectrum at z=0
    • npool: number of processes to spawn, default=32
    • z: redshift, default = 0
    • M: Omega-Matter
    • nk: Number of log-spaced k-values to evaluate power spectrum at, default=50
    • kmin: the minimum k value, default=0.001
    • kmax: the maximum k value, default=3
    • k, p: if 'pfile' is not specified, one can altternatively pass in the k, p numpy arrays for linear power spectrum
      Either of (k, p) or (pfile) argument is required to be passed in
    • order: 1 or 2, order of perturbation theory, default=2

Other parameters such as --qfile and --rfile can be specified to point to the save kernels in order to speed up the code when computing power spectrum for same cosmology.

  • Basic syntax to call it in jupyter notebooks or as a part of other code is:
  import cleftpool as cpool
  cl = cpool.CLEFT(pfile = pfile,  npool=32, order=2)
  pk = cpool.make_table(cl, kmin = 0.002, kmax = 1, nk = 200, npool=32, z = 1, M = 0.3)
  • Timing: With 32 cores on a single node of Cori-jupyter hub, it takes ~35 seconds to compute power spectra at 200 k-values.

The code uses package 'mcfit' to do bessel integrals in the file qfuncpool.py. This is handled by function 'dosph' in class 'Qfunc' and it takes in the integration ranges 'q1' and 'q2'. While the current set-up for these values has been tested for many cosmologies, it has the potential of outputing 'nans' in some rare cases. This can be solved by changing the tilt or the said intergation ranges for the corresponding function

cleft's People

Contributors

modichirag avatar

Stargazers

Boris Bolliet avatar Jamie Sullivan avatar

Watchers

James Cloos avatar  avatar Boris Bolliet avatar paper2code - bot 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.