Skip to main content

Python wrapper for EuclidEmulator2

Project description

EuclidEmulator2 (version 1.0.1)

This package includes a python wrapper of EuclidEmulator2, a fast and accurate tool to estimate the non-linear correction to the matter power spectrum developed by M. Knabenhans. EuclidEmulator2 allows for 8-parameter cosmological models including massive neutrinos (assuming a degenerate hierarchy) and dynamical dark energy. The source for EuclidEmulator2 is written in C++, with most main functions accessed through the python wrapper.

Authors: M. Knabenhans (emulator), Pedro Carrilho (python wrapper)
Date of last update: March 2021
Reference: Euclid Consortium: Knabenhans et al. (submitted), https://arxiv.org/abs/2010.11288

If you use EuclidEmulator2 in any way (for a publication or otherwise), please cite this paper.

Contact information: If you have any questions and/or remarks related to this work, please do not hesitate to send an email to (p.gregoriocarrilho@qmul.ac.uk)

Currently implemented features in this python wrapper:

  • emulation of the non-linear correction factor B(k,z)

  • large allowed redshift interval: z in the interval [0.0,10.0]

  • spatial scales spanning more than three orders of magnitude: 8.73 x 10-3 h / Mpc ≤ k ≤ 9.41 h / Mpc.

  • Cosmology defined via parameter dictionary

  • Outputs numpy arrays

  • Can output in custom k-range with extrapolation outside default range

See below for a tutorial on usage explaining these functionalities

Quick start

Prerequisites

In any case you need:

GSL install

On most machines, building GSL is relatively simple. To install it locally, e.g. in ~/local/gsl, use

mkdir -p $HOME/local/gsl && cd $HOME/local
wget -c ftp://ftp.gnu.org/gnu/gsl/gsl-latest.tar.gz -O - | tar zxv

The install procedure follows standard steps, but each one might take several minutes. Execute each command separately and only continue if there are no errors.

./configure --prefix=$HOME/local/gsl
make
make check
make install

Once done, make sure to add the GSL library to your library path with

export LD_LIBRARY_PATH=$HOME/local/gsl/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}

Usage

To load the package in python use

import euclidemu2

The main function is get_boost(cosmo_par, redshifts, k_custom=None) that takes a dictionary of cosmological parameters, an array with the requested redshifts and an optional array with a custom range of wave numbers. It outputs an array with the k values used and a dictionary with the boosts, indexed in the same order as the chosen redshifts. An example run looks like

import euclidemu2 as ee2
import numpy as np
import matplotlib.pyplot as plt

cosmo_par={'As':2.1e-09, 'ns':0.966, 'Omb':0.04,'Omm':0.3,'h':0.68,'mnu':0.15,'w':-1.0,'wa':0.0}
redshifts=[0,2,4,6,8,10]
k, b = ee2.get_boost(cosmo_par,redshifts)

for i in range(len(redshifts)):
    plt.loglog(k,b[i],label="z="+str(redshifts[i]))

plt.legend()
plt.show()

If everything is correctly installed, this should produce a plot of the boosts for the chosen redshifts.

Should the user have installed classy, it is also possible to compute the full non-linear power spectrum via

k, pnl, plin, b = ee2.get_pnonlin(cosmo_par, redshifts, k_custom)

which will now output pnl in addition to the linear power spectrum plin and the boost b, which are all indexed in the same way as the boost from get_boost.

If classy is not installed, a warning will appear when loading euclidemu2 and the get_pnonlin function will not work. The get_boost function will always work.

Warning: In the most recent versions of Python (e.g. 3.8) classy may not work unless it is the first package to be imported. This is taken into account when calling euclidemu2, but implies that euclidemu2 must be the first package to be imported. This has been verified not to be a problem for older versions of python (e.g. 3.6).

License

EuclidEmulator2 is free software, distributed under the GNU General Public License. This implies that you may freely distribute and copy the software. You may also modify it as you wish, and distribute these modified versions. You must always indicate prominently any changes you made in the original code and leave the copyright notices, and the no-warranty notice intact. Please read the General Public License for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

euclidemu2-1.1.2.tar.gz (7.2 MB view details)

Uploaded Source

Built Distributions

euclidemu2-1.1.2-cp38-cp38-macosx_10_9_x86_64.whl (7.3 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

euclidemu2-1.1.2-cp36-cp36m-macosx_10_9_x86_64.whl (7.3 MB view details)

Uploaded CPython 3.6m macOS 10.9+ x86-64

File details

Details for the file euclidemu2-1.1.2.tar.gz.

File metadata

  • Download URL: euclidemu2-1.1.2.tar.gz
  • Upload date:
  • Size: 7.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.8.1 requests/2.26.0 setuptools/59.4.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for euclidemu2-1.1.2.tar.gz
Algorithm Hash digest
SHA256 bade974f3dce2b894a6c1045ebde9df45289332245eb42039cedc0fce850731e
MD5 45b59501dd8c130551d73420ef1f16df
BLAKE2b-256 1ff05348f85d6f7f8eb4f92de56912d3a7f7b140a3333b45df3f21663d2a3ef2

See more details on using hashes here.

File details

Details for the file euclidemu2-1.1.2-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: euclidemu2-1.1.2-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 7.3 MB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.8.1 requests/2.26.0 setuptools/59.4.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for euclidemu2-1.1.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4241fc1ae69a551c0d49978e12aa1852509bf669837bd562ecc5e3f0e0756320
MD5 c564623e96d1cc14ce6676bdba9ed9a0
BLAKE2b-256 af1317731f3ad5a0f05072c7c5314fad90f805f2babf86e084947d04a29b1c13

See more details on using hashes here.

File details

Details for the file euclidemu2-1.1.2-cp36-cp36m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: euclidemu2-1.1.2-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 7.3 MB
  • Tags: CPython 3.6m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.8.1 requests/2.26.0 setuptools/59.4.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for euclidemu2-1.1.2-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d0c2d5eb7e2ce9d63d9e1e319b7334e848fcd5789b8e0166fe3625d28c673f6d
MD5 c3bb335c7bf0b1aa1d7b9b9996d49344
BLAKE2b-256 90f4306b1b7461b7d4cda31709230309c4e9e5f8fb749e83e2d6a2136ebb95ab

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page