lib.survey_selection.projection.ModelProjection¶
- class lib.survey_selection.projection.ModelProjection(data_vector, projs=None, model_bases=None, integration=None)¶
Bases:
cosmopipe.lib.utils.BaseClassClass projecting theory model onto data vector by chaining several matrix operations, accounting for the various survey selection effects: wide-angle, window function etc.
- model_bases¶
Projection bases of input theory models.
- data_vector¶
Data vector to project onto.
- Type
- projs¶
Projection names.
- operations¶
List of successive matrix operations to apply.
- Type
list
Initialize
ModelProjection.- 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.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 evaluation / integration, see
ModelEvaluation.
Methods
Append operation to the list of operations
operations.Return shallow-copy of model projection, including internal list of operations
operations.deepcopyInstantiate and initalize class with state dictionary.
Insert operation at index
indexin list of operationsoperations.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_warningSave class to disk.
If different formats are possible, this method should between them based on file name extension.
Set
data_vector.Set
projs.Compile all operations of
operationsinto a single matrix transform.Same as
__call__(), but returningDataVectorinstance.Attributes
loggerMPI attributes
mpicommmpirootmpistate- __call__(models, concatenate=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.kwargs (dict) – Arguments for
ModelEvaluation.__call__().
- 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
- append(operation)¶
Append operation to the list of operations
operations.
- copy(copy_operations=True)¶
Return shallow-copy of model projection, including internal list of operations
operations. Ifcopy_operationsisTrue, further shallow-copy each operation.
- classmethod from_state(state, mpiroot=0, mpicomm=None)¶
Instantiate and initalize class with state dictionary.
- insert(index, operation)¶
Insert operation at index
indexin list of operationsoperations.
- 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
- 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_data_vector(data_vector)¶
Set
data_vector.
- setup(data_vector=None, projs=None)¶
Compile all operations of
operationsinto a single matrix transform.- Parameters
data_vector (DataVector, default=None) – Data vector to project onto. If not
None, replace currentdata_vector.projs (list, ProjectionNameCollection) – Projection names. If not
None, replace currentprojs.
- to_data_vector(models, **kwargs)¶
Same as
__call__(), but returningDataVectorinstance.