Training Points¶
Routine to scale the Latin Hypercube samples according to the prior and evaluate the power spctrum at these points.
-
trainingpoints.
CLASS_RUN
(module: object, parameter: numpy.ndarray, index: int) → Tuple[bool, dict][source]¶ Run CLASS given an input parameter to generate the training points (outputs)
- Param
module (object) - the CLASS module
- Param
parameter (np.ndarray) - the input cosmology, either 5 dimensions or 6 dimensions
- Index
i*th cosmology from the LHS file
- Returns
state (bool), quantities (dict) - state indicates if the run is successful, quantities contain the important quantities generated
-
class
trainingpoints.
trainingset
(lhs: str = 'maximin_1000_6D')[source]¶ Bases:
object
Runs CLASS at the LHS points generated using the maximin procedure. If we want to sample the neutrino mass, then, please use maximin_1000_6D as input (assuming it has already been generated), otherwise please use maximin_1000_5D.
-
scale
(save: bool = True) → numpy.ndarray[source]¶ Scale the LHS according to the prior range. See setting file to set up the priors for the LHS samples.
- Param
save (bool) - if True, the scaled inputs (cosmologies) will be written to a file
- Returns
cosmologies (np.ndarray) - the scaled inputs
-
targets
(cosmologies: numpy.ndarray, save: bool = False) → numpy.ndarray[source]¶ Generate the power spectrum at the specfic cosmologies
- Param
save (bool) - if True, the generated power spectrum will be saved in a directory. Note that the power spectrum is of shape (nk x nz), for example, 40 x 20. So the final shape will be of size (ncosmo x nk x nz). The power spectrum is flattened in this case, so we save a file of size 1000 x 800 (ncosmo = 1000, nk = 40, nz = 20). Therefore, we will have 800 separate GPs in this example.
- Param
cosmologies (np.ndarray) - set of cosmologies where we want to run CLASS
- Param
save (bool) - if True, the generated targets (training points/ power spectrum) will be saved in a directory
- Returns
components (dict) - a list of the different quantities (growth factor, linear matter power spectrum, q function) evaluated at different cosmologies or
- Returns
pk_non (np.ndarray) - the power spectrum evaluated at each cosmology
-