matryoshka.emulator

Galaxy power spectrum

EFTofLSS multipoles

This set of six component emulators, collectively reffered to as the EFTEMU, apprxoimates the galaxy power spectrum multipoles that would be predicted by the EFTofLSS code PyBird. See arXiv:2202.07557 for details.

class matryoshka.emulator.EFT(multipole, version='EFTv2', redshift=0.51, path_to_model=None, yscaler_P11=None, yscaler_Ploop=None, yscaler_Pct=None)

Emulator for predicting power spectrum multipoles that would be predicted using EFTofLSS.

Parameters
  • multipole (int) – Desired multipole. Can either be 0 or 2.

  • version (str) – Version of EFTEMU. Can be EFTv2, EFT-optiresum, EFT_lowAs, or custom. Using custom requires path_to_model and kmax to also be passed. Default is EFTv2.

  • redshift (float) – Desired redshift. Can be 0.38, 0.51, or 0.61. Default is 0.51.

  • path_to_model (str) – Path where model trained with the trainEFTEMUcomponenets script is saved. Only requred if version='custom'. Default is None.

Note

See the EFTEMU example.

P11

The P_11 component emulator.

Pct

The P_ct component emulator.

Ploop

The P_loop component emulator.

emu_predict(X, bias, stochastic=None, km=None, ng=None, kvals=None)

Make predictions with the emulator.

Parameters
  • X (array) – Input cosmological parameters. Should have shape (n, 5).

  • bias (array) – Input bias parameters and counterterms. Should have shape (n, 7)

  • stochastic (array) – Input stochastic counterterms. Should have shape (n, 3). Default is None, in which case no stochastic terms are used.

  • km (float) – Controls the bias derivative expansion (see eq. 5 in arXiv:1909.05271). Default in None, in which case all counterterm inputs are assumed to be a ratio with km i.e. c_i/km**2.

  • ng (float) – Mean galaxy number density. Default is None. Only required if stochastic is not None.

  • kvals (array) – Array containing k-values at which to produce predictions. Needs to be within the k-range that the emulator has been trained to predict. Default is None, in which case predicts will be made at the default k-values.

param_names

List of the input parameters.

Halo model power spectrum

This set of component emulators predictcs the halo model power spectrum. A nonlinear boost can be applied to this power spectrum, as in arXiv:2109.15236 (it should be noted that the nonlinear boost emulator is currently trained using HALOFIT, a version trained using simulations is coming). It is also possible to use nonlinear predictions for the dark matter power spectrum here, see QUIP below.

class matryoshka.emulator.HaloModel(k, redshift_id=None, redshift=None, nonlinear=True, matter=True, version='class_aemulus', kspace_filt=False)

Class for the emulated halo model.

Upon initalisation each of the component emulators will be initalised.

Parameters
  • k (array) – The k-bins over which predictions will be made. Cannot be outside the ranges used when training the component emulators.

  • redshift_id (int) – Index in matter_boost_zlist or galaxy_boost_zlist that corespons to the desired redshift. Only needed if nonlinear is True. Default is None.

  • redshift (float) – The redshift at which predictions should be made. Can only be used if nonlinear is False. If nonlinear is True this will be ignored.

  • nonlinear (bool) – Determines if nonlinear predictions should be made. If False, the nonlinear boost componenet emulator will not be initalised.

  • matter (bool) – If nonlinear=True setting matter=True will use emulated nonlinear matter power. If matter=False the nonlinear boost will be applied to the galaxy power spectrum.

  • version (str) – Version of the emulators to be loaded.

  • kspace_filt (bool) – If True reduces contribution from P2h on small scales. Inspired by halomod. See section 2.9.1 of arXiv:2009.14066.

emu_predict(X_COSMO, X_HOD, kspace_filt=False, RT=3.0)

Make predictions for the halo model power spectrum with the pre-initalised component emulators.

Parameters
  • X_COSMO (array) – Input cosmological parameters.

  • X_HOD (array) – Input HOD parameters.

Returns

Array containing the predictions from the halo model power spectrum. Array will have shape (n,k). If making a prediction for a single set of input parameters will have shape (1,k).

Dark matter power spectrum

The QUIjote matter Power spectrum emulator, or QUIP. This set of emulators has been trained to on the Qujote simulations to predict the nonlinear matter power spectrum.

class matryoshka.emulator.QUIP(redshift_id)

Emulator for predicting the real space nonlinear matter power spectrum. Trained with the QUIJOTE simulations.

Parameters

redshift_id (int) – Index in matter_boost_zlist that corespons to the desired redshift.

Note

See the QUIP example.

MatterBoost

The nonlinear boost component emulator.

Transfer

The transfer function component emulator.

emu_predict(X, kvals=None, mean_or_full='mean')

Make predictions with the emulator.

Parameters
  • X (array) – Array containing the relevant input parameters. If making a single prediction should have shape (d,), if a batch prediction should have the shape (N,d).

  • kvals (array) – Array containing k-values at which to produce predictions. Needs to be within the k-range that the emulator has been trained to predict. Default is None, in which case predicts will be made at the default k-values.

  • mean_or_full – Can be either ‘mean’ or ‘full’. Determines if the ensemble mean prediction should be returned, or the predictions from each ensemble member (default is ‘mean’).

Returns

Array containing the predictions from the emulator. Array will have shape (m,n,k). If mean_or_full='mean' will have shape (n,k).

param_names

List of the input parameters.

Complete list of component emulators

class matryoshka.emulator.Transfer(version='class_aemulus')

Class for the transfer function componenet emulator.

On initalisation the weights for the NN ensmble will be loaded, along with the scalers required to make predictions with the NNs.

Parameters

version (str) – String to specify what version of the emulator to load. Default is ‘class_aemulus’.

Note

See the Basic emulator usage example.

emu_predict(X, mean_or_full='mean')

Make predictions with the component emulator.

Parameters
  • X (array) – Array containing the relevant input parameters. If making a single prediction should have shape (d,), if a batch prediction should have the shape (N,d).

  • mean_or_full (str) – Can be either ‘mean’ or ‘full’. Determines if the ensemble mean prediction should be returned, or the predictions from each ensemble member (default is ‘mean’).

Returns

Array containing the predictions from the component emulator. Array will have shape (m,n,k). If mean_or_full=’mean’ will have shape (n,k).

kbins

The k-bins at which predictions will be made.

models

A list containing the individual ensemble members.

class matryoshka.emulator.Sigma(version='class_aemulus')

Class for the mass variance componenet emulator.

On initalisation the weights for the NN ensmble will be loaded, along with the scalers required to make predictions with the NNs.

Parameters

version (str) – String to specify what version of the emulator to load. Default is ‘class_aemulus’.

emu_predict(X, mean_or_full='mean')

Make predictions with the component emulator.

Parameters
  • X (array) – Array containing the relevant input parameters. If making a single prediction should have shape (d,), if a batch prediction should have the shape (N,d).

  • mean_or_full – Can be either ‘mean’ or ‘full’. Determines if the ensemble mean prediction should be returned, or the predictions from each ensemble member (default is ‘mean’).

Returns

Array containing the predictions from the component emulator. Array will have shape (m,n,k). If mean_or_full=’mean’ will have shape (n,k).

mbins

The m-bins at which predictions will be made.

models

A list containing the individual ensemble members.

class matryoshka.emulator.SigmaPrime(version='class_aemulus')

Class for the mass variance logarithmic derviative componenet emulator.

On initalisation the weights for the NN ensmble will be loaded, along with the scalers required to make predictions with the NNs.

Parameters

version (str) – String to specify what version of the emulator to load. Default is ‘class_aemulus’.

emu_predict(X, mean_or_full='mean')

Make predictions with the component emulator.

Parameters
  • X (array) – Array containing the relevant input parameters. If making a single prediction should have shape (d,), if a batch prediction should have the shape (N,d).

  • mean_or_full – Can be either ‘mean’ or ‘full’. Determines if the ensemble mean prediction should be returned, or the predictions from each ensemble member (default is ‘mean’).

Returns

Array containing the predictions from the component emulator. Array will have shape (m,n,k). If mean_or_full=’mean’ will have shape (n,k).

mbins

The m-bins at which predictions will be made.

models

A list containing the individual ensemble members.

class matryoshka.emulator.Growth(version='class_aemulus')

Class for the growth function componenet emulator.

On initalisation the weights for the NN ensmble will be loaded, along with the scalers required to make predictions with the NNs.

Parameters

version (str) – String to specify what version of the emulator to load. Default is ‘class_aemulus’.

emu_predict(X, mean_or_full='mean')

Make predictions with the component emulator.

Parameters
  • X (array) – Array containing the relevant input parameters. If making a single prediction should have shape (d,), if a batch prediction should have the shape (N,d).

  • mean_or_full – Can be either ‘mean’ or ‘full’. Determines if the ensemble mean prediction should be returned, or the predictions from each ensemble member (default is ‘mean’).

Returns

Array containing the predictions from the component emulator. Array will have shape (m,n,k). If mean_or_full=’mean’ will have shape (n,k).

models

A list containing the individual ensemble members.

zbins

The z-bins at which predictions will be made.

class matryoshka.emulator.Boost(redshift_id)

Class for the nonlinear boost componenet emulator.

On initalisation the weights for the NN ensmble will be loaded, along with the scalers required to make predictions with the NNs.

Parameters

redshift_id (int) – Index in matter_boost_zlist or galaxy_boost_zlist that corespons to the desired redshift.

emu_predict(X, mean_or_full='mean')

Make predictions with the component emulator.

Parameters
  • X (array) – Array containing the relevant input parameters. If making a single prediction should have shape (d,), if a batch prediction should have the shape (N,d).

  • mean_or_full – Can be either ‘mean’ or ‘full’. Determines if the ensemble mean prediction should be returned, or the predictions from each ensemble member (default is ‘mean’).

Returns

Array containing the predictions from the component emulator. Array will have shape (m,n,k). If mean_or_full=’mean’ will have shape (n,k).

kbins

The k-bins at which predictions will be made.

models

A list containing the individual ensemble members.

class matryoshka.emulator.MatterBoost(redshift_id)
Emulator for predicting the nonlinear boost for the matter power

spectrum in real space. Trained with the QUIJOTE simulations.

Parameters

redshift_id (int) – Index in matter_boost_zlist that corespons to the desired redshift.

emu_predict(X, mean_or_full='mean')

Make predictions with the component emulator.

Parameters
  • X (array) – Array containing the relevant input parameters. If making a single prediction should have shape (d,), if a batch prediction should have the shape (N,d).

  • mean_or_full – Can be either ‘mean’ or ‘full’. Determines if the ensemble mean prediction should be returned, or the predictions from each ensemble member (default is ‘mean’).

Returns

Array containing the predictions from the component emulator. Array will have shape (m,n,k). If mean_or_full=’mean’ will have shape (n,k).

kbins

The k-bins at which predictions will be made.

models

A list containing the individual ensemble members.

class matryoshka.emulator.P11l(multipole, version='EFTv2', redshift=0.51, path_to_model=None, yscaler=None)

Class for emulator that predicts the P11l contributions to the P_n matrix.

emu_predict(X)

Make predictions with the component emulator.

Parameters

X (array) – Array containing the relevant input parameters. If making a single prediction should have shape (d,), if a batch prediction should have the shape (N,d).

Returns

Array containing the predictions from the component emulator will have shape (n,k).

model

The NN that forms this component emulator

nonzero_cols

There can be zeros for all cosmologies at certain k-values. The emulator does not make predictions here so we need to know where to put zeros.

class matryoshka.emulator.Ploopl(multipole, version='EFTv2', redshift=0.51, path_to_model=None, yscaler=None)

Class for emulator that predicts the Ploopl contributions to the P_n matrix.

emu_predict(X)

Make predictions with the component emulator.

Parameters

X (array) – Array containing the relevant input parameters. If making a single prediction should have shape (d,), if a batch prediction should have the shape (N,d).

Returns

Array containing the predictions from the component emulator will have shape (n,k).

model

The NN that forms this component emulator

nonzero_cols

There can be zeros for all cosmologies at certain k-values. The emulator does not make predictions here so we need to know where to put zeros.

class matryoshka.emulator.Pctl(multipole, version='EFTv2', redshift=0.51, path_to_model=None, yscaler=None)

Class for emulator that predicts the Pctl contributions to the P_n matrix.

emu_predict(X)

Make predictions with the component emulator.

Parameters

X (array) – Array containing the relevant input parameters. If making a single prediction should have shape (d,), if a batch prediction should have the shape (N,d).

Returns

Array containing the predictions from the component emulator will have shape (n,k).

model

The NN that forms this component emulator

nonzero_cols

There can be zeros for all cosmologies at certain k-values. The emulator does not make predictions here so we need to know where to put zeros.