lib.survey_selection.projection.ModelProjection

class lib.survey_selection.projection.ModelProjection(data_vector, projs=None, model_bases=None, integration=None)

Bases: cosmopipe.lib.utils.BaseClass

Class 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.

Type

ProjectionBasisCollection

data_vector

Data vector to project onto.

Type

DataVector

projs

Projection names.

Type

ProjectionNameCollection

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 to data_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

Append operation to the list of operations operations.

copy

Return shallow-copy of model projection, including internal list of operations operations.

deepcopy

from_state

Instantiate and initalize class with state dictionary.

insert

Insert operation at index index in list of operations operations.

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

save

Save class to disk.

save_auto

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

set_data_vector

Set data_vector.

set_projs

Set projs.

setup

Compile all operations of operations into a single matrix transform.

to_data_vector

Same as __call__(), but returning DataVector instance.

Attributes

logger

mpiattrs

MPI attributes

mpicomm

mpiroot

mpistate

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

  • kwargs (dict) – Arguments for ModelEvaluation.__call__().

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

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. If copy_operations is True, 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 index in list of operations operations.

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

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.

set_projs(projs)

Set projs.

setup(data_vector=None, projs=None)

Compile all operations of operations into a single matrix transform.

Parameters
to_data_vector(models, **kwargs)

Same as __call__(), but returning DataVector instance.