Quick Usage
Installation
To use CSST Emulator, you can install it via pip:
$ pip install git+https://github.com/czymh/csstemu
for the stable version, or
$ pip install git+https://github.com/czymh/csstemu/tree/dev
for the development version to use the latest function.
Creating recipes
To use the package, you need add the code directory to your Python path:
from CEmulator.Emulator import CEmulator
Firstly, you need to create an object of the class CEmulator:
csstemu = CEmulator(verbose=True)
Then set the cosmologies you want to use:
csstemu.set_cosmos(Omegab=Omegab, Omegac=Omegac, H0=h0*100,
ns=n_s, As=A_s, w=w0,
wa=wa, mnu=m_nu)
All these variables can be float numbers or arrays. Finally, you can predict the matter power spectrum:
csstemu.get_pknl(z=zlist, k=klist, Pcb=False, lintype='Emulator', nltype='hmcode2020')
- CEmulator.Emulator.CEmulator.get_pknl(self, z=None, k=None, Pcb=False, lintype='Emulator', nltype='hmcode2020', cosmo_class=None, camb_results=None)
Get the nonlinear power spectrum.
Note
For now, nltype = ‘hmcode2020’, ‘halofit’ can give a better result than nltype = ‘linear’. For nltype = ‘halofit’ or ‘hmcode2020’, we only use the ‘Emulator’ method to generate the halofit Pk for consistency between trainning and output data. The lintype only determine which method to generate the neutrino linear Pk. For nltype = ‘linear’, lintype determine which method to generate the linear cb and mm Pk. Because the agreements of linear Pk between CAMB, CLASS and Emulator is better than 0.5%.
- Parameters:
z – float or array-like, redshift.
k – float or array-like, wavenumber [h/Mpc].
Pcb – bool, whether to output the total power spectrum (if False [default]) or the cb power spectrum (if True).
lintype – string, use ‘Emulator’, ‘CLASS’ or ‘CAMB’ method to generate linear Pk. Default is ‘Emulator’.
nltype – string, ‘linear’, ‘halofit’ or ‘hmcode2020’. means ratio of nonlinear to nltype power spectrum. Default is ‘hmcode2020’.
cosmo_class – CLASS object, if type is ‘CLASS’, then you can provide the CLASS object directly to avoid the repeated calculation for CLASS.
camb_results – CAMB results, if type is CAMB, then you can provide the CAMB object directly to avoid the repeated calculation for CAMB.
- Returns:
nonlinear power spectrum with shape (len(z), len(k))
- Return type:
array-like