lib.theory.evaluation.ModelEvaluation¶
- class lib.theory.evaluation.ModelEvaluation(data_vector, projs=None, model_bases=None, integration=None)¶
Bases:
cosmopipe.lib.utils.BaseClassClass evaluating theory model(s) at given points, optionally performing some integration (e.g. against Legendre polynomials).
Initialize
ModelEvaluation.- Parameters
data_vector (DataVector) – Data vector to project onto.
projs (list, ProjectionNameCollection, default=None) – Projection names. If
None, defaults todata_vector.get_projs(), i.e. projections within data view. Theory model(s) are matched to each of these projections (usingProjectionBasisCollection.get_by_proj())model_bases (ProjectionBasis, ProjectionBasisCollection) – Projection basis of input model(s). If single projection basis, a single model is expected in
__call__().integration (dict) – Options for model integration. See
set_model_evaluation().
Methods
Return shallow copy of
self.deepcopyInstantiate and initalize class with state dictionary.
is_mpi_broadcastis_mpi_gatheredis_mpi_rootis_mpi_scatteredLoad class in numpy binary format from disk.
If different formats are possible, this method should between them based on file name extension.
log_criticallog_debuglog_errorlog_infolog_warningPropose output projection names given proposed input projection names
projsin.Save class to disk.
If different formats are possible, this method should between them based on file name extension.
Set engine for model evaluation on projection
proj.Same as
__call__(), but returningDataVectorinstance.Attributes
loggerMPI attributes
mpicommmpirootmpistate- __call__(models, concatenate=True, remove_shotnoise=True, **kwargs)¶
Project input models onto data vector, returning y-coordinates.
- Parameters
models (BaseModel, ModelCollection) – Model callable(s). A single model is expected if a single model basis was provided in
__init__().concatenate (bool, default=True) – If
True, concatenates output y-coordinates over all projections. Else, returns a list of arrays corresponding to eachprojs.remove_shotnoise (bool, default=True) – For power spectrum models (
model.basis.spaceis'power'), removemodel.basis.shotnoise(defaults to 0).kwargs (dict) – Arguments for input model(s).
- Returns
toret – y-coordinates. If input
concatenateisTrue, single array concatenated over all projections. Else, a list of arrays corresponding to eachprojs.- Return type
list, array
- copy()¶
Return shallow copy of
self.
- classmethod from_state(state, mpiroot=0, mpicomm=None)¶
Instantiate and initalize class with state dictionary.
- classmethod load(filename, mpiroot=0, mpicomm=None)¶
Load class in numpy binary format from disk. If the loaded state contains
__class__and that exists incls._registry, return instance ofcls._registry[__class__](instead ofcls).
- load_auto(*args, **kwargs)¶
If different formats are possible, this method should between them based on file name extension.
- property mpiattrs¶
MPI attributes
- classmethod propose_out(model_bases=None)¶
Propose output projection names given proposed input projection names
projsin.- Parameters
projsin (list, ProjectionNameCollection) – Input projections.
model_bases (ProjectionBasis, ProjectionBasisCollection) – Projection basis of input model(s).
- Returns
toret – Proposed projection names.
- Return type
- save(filename)¶
Save class to disk.
- save_auto(*args, **kwargs)¶
If different formats are possible, this method should between them based on file name extension.
- set_model_evaluation(data_vector, proj, model_basis, integration=None)¶
Set engine for model evaluation on projection
proj.- Parameters
data_vector (DataVector) – Data vector to project onto.
proj (ProjectionName) – Projection name to project onto.
model_basis (ProjectionBasis) – Model projection basis.
integration (dict) –
Options for model integration:
MultipoleIntegrationif input model lives in \((x,\mu)\) space andprojis a multipole.MuWedgeIntegrationif input model lives in \((x,\mu)\) space andprojis a \(\mu\)-wedge.
- to_data_vector(models, **kwargs)¶
Same as
__call__(), but returningDataVectorinstance.