lib.theory.evaluation.ModelEvaluation

class lib.theory.evaluation.ModelEvaluation(data_vector, projs=None, model_bases=None, integration=None)

Bases: cosmopipe.lib.utils.BaseClass

Class 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 to data_vector.get_projs(), i.e. projections within data view. Theory model(s) are matched to each of these projections (using ProjectionBasisCollection.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

copy

Return shallow copy of self.

deepcopy

from_state

Instantiate and initalize class with state dictionary.

is_mpi_broadcast

is_mpi_gathered

is_mpi_root

is_mpi_scattered

load

Load class in numpy binary format from disk.

load_auto

If different formats are possible, this method should between them based on file name extension.

log_critical

log_debug

log_error

log_info

log_warning

propose_out

Propose output projection names given proposed input projection names projsin.

save

Save class to disk.

save_auto

If different formats are possible, this method should between them based on file name extension.

set_model_evaluation

Set engine for model evaluation on projection proj.

to_data_vector

Same as __call__(), but returning DataVector instance.

Attributes

logger

mpiattrs

MPI attributes

mpicomm

mpiroot

mpistate

__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 each projs.

  • remove_shotnoise (bool, default=True) – For power spectrum models (model.basis.space is 'power'), remove model.basis.shotnoise (defaults to 0).

  • kwargs (dict) – Arguments for input model(s).

Returns

toret – y-coordinates. If input concatenate is True, single array concatenated over all projections. Else, a list of arrays corresponding to each projs.

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 in cls._registry, return instance of cls._registry[__class__] (instead of cls).

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
Returns

toret – Proposed projection names.

Return type

ProjectionNameCollection

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:

    • MultipoleIntegration if input model lives in \((x,\mu)\) space and proj is a multipole.

    • MuWedgeIntegration if input model lives in \((x,\mu)\) space and proj is a \(\mu\)-wedge.

to_data_vector(models, **kwargs)

Same as __call__(), but returning DataVector instance.