EuclidEmulator2 (version 1.01. of the emulator, version 1.4.3 of the wrapper)
This repository contains the source code of EuclidEmulator2, a fast and accurate tool to estimate the non-linear correction to the matter power spectrum. In contrast to its predecessor EuclidEmulator, EuclidEmulator2 allows for 8-parameter cosmological models including massive neutrinos (assuming a degenerate hierarchy) and dynamical dark energy. EuclidEmulator2 is written in C++. For more information on EuclidEmulator please visit https://github.com/miknab/EuclidEmulator.
Authors: M. Knabenhans, Pedro Carrilho
Date of last update: January 2026
Reference: Euclid Consortium: Knabenhans et al., 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 wrapper, please do not hesitate to send an email to (pedromgcarrilhoATgmail.com).
Currently implemented features in the 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
-
Can output in custom k-range with extrapolation outside default range
-
Interfaces with class to compute full non-linear matter power spectrum
See below for a tutorial on usage explaining these functionalities
Quick start
Prerequisites
In any case you need:
- C++11 or later
- GNU Scientific Library version 2.5 or higher (GSL; see https://www.gnu.org/software/gsl/)
- g++ version 4.9.1 or higher
- cython, numpy, scipy (essential)
- classy (for computing non-linear power spectrum only)
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}
If are able to use conda, you can also install gsl via conda install gsl and the Euclid Emulator 2 python installer should be able to find gsl automatically.
Usage
To run the python wrapper, first import the package via
import euclidemu2
and create an instance of PyEuclidEmulator via
ee2 = euclidemu2.PyEuclidEmulator()
then create a python dictionary with the requested values of the cosmological parameters:
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}
This can then be passed to the main function along with an array of redshifts
redshifts = [0,2,4,6,8,10]
k, b = ee2.get_boost(cosmo_par,redshifts)
resulting in an array k with the wavenumbers in units of h / Mpc and a dictionary b indexed with the same index as the redshift array, e.g. b[1] is an array corresponding to redshifts[1], etc. This is always the case, even when only one redshift is requested, so accessing that array is always done via b[0].
To calculate the boost for a custom range and sampling of k values, define an array with the requested values, e.g.
k_custom = np.geomspace(1e-4,100,1000)
and use
k, b = ee2.get_boost(cosmo_par,redshifts,k_custom)
where now k=k_custom and b gives the interpolated (extrapolated) boosts inside (outside) the default range.
If classy is installed, you can also get 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).
See the python notebook (test_euclid_emu2.ipynb) for an example of a full run and more details.
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.
Metadata
Release files for euclidemu2 1.4.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| euclidemu2-1.4.3.tar.gz | 7.3 MB | Without provenance | Details for euclidemu2-1.4.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| euclidemu2-1.4.3-cp312-cp312-macosx_11_0_arm64.whl | CPython 3.12 | CPython 3.12 | macOS 11.0+ ARM64 | Details for euclidemu2-1.4.3-cp312-cp312-macosx_11_0_arm64.whl |
Total release size: 14.6 MB
Release files / euclidemu2-1.4.3.tar.gz
| Download URL | euclidemu2-1.4.3.tar.gz |
|---|---|
| Size | 7.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a39dac89e2a2f8859e6e8953a7f20877772d9e79c33ffe418260aecd7b126f42
|
|
BLAKE2b-256 checksum How to use checksums |
a642cdde9ad1f5b75a1cd14022e4bedec6dcdf099c8f261b120952ba29ae0c05
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / euclidemu2-1.4.3-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | euclidemu2-1.4.3-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 7.4 MB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
bf46b0d8c57c9c7403909e62009af94c0f9474ae30d5581785cd9fcb0db90042
|
|
BLAKE2b-256 checksum How to use checksums |
4ff919a1b8bbb982195e177ab2eb3fd0091ed616e8c0d21795217d274406c0cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Security for euclidemu2 1.4.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.