Identity Observation Operators#

Identity([configs])

Identity observation operator added for compatibility.

create_Identity_observation_operator(model)

Create an identity observation operator from a simulation model.

Class implementing identity observation operator. This is added for compatibility. All functions/methods return a copy of the states passed as arguments

class IdentityConfigs(*, debug=False, verbose=False, output_dir='./_PYOED_RESULTS_', model=None)[source]#

Bases: ObservationOperatorConfigs

Configuration class for the identity observation operator.

Parameters:
  • verbose (bool) – a boolean flag to control verbosity of the object.

  • debug (bool) – a boolean flag that enables adding extra functionlity in a debug mode

  • output_dir (str | Path) – the base directory where the output files will be saved.

  • model (SimulationModel | None) – an instance of a simulation model derived from pyoed.models.SimulationModel.

model: SimulationModel | None#
__init__(*, debug=False, verbose=False, output_dir='./_PYOED_RESULTS_', model=None)#
class Identity(configs=None)[source]#

Bases: ObservationOperator

Identity observation operator added for compatibility. All functions/methods return a copy of the states passed as arguments In addition to standard functionality, here we provide a specific attribute ‘design’ which enables modifying the observation space by projection/selection

  • If the design is a binary vector (bool or int dtype attributes with 0/1 entries), the observation operator restricts observations to only entries identified by the 1/True entries. This acts like sensor placing/activation where 1 means ON/ACTIVE, and 0 means OFF.

  • If the design contains non-binary values, it is transformed to boolean flag; any entry in the design variable that’s not zero is set to 1.

Raises:
  • TypeError – if the passed model is not an instance of pyoed.models.SimulationModel.

  • NotImplementedError – if the passed model simulates more than one prognostic variable; extensions require proper handling of the design which is on our TODO list.

Remarks:
  • Currently, this implementation assumes a single prognostic variable; that is, the design does not repeat itself on the covariance matrix. This will be provided as needed!

__init__(configs=None)[source]#
validate_configurations(configs, raise_for_invalid=True)[source]#

Check the passed configuratios and make sure they are conformable with each other, and with current configurations once combined. This guarantees that any key-value pair passed in configs can be properly used

Note

Here only the locally-defined configurations in IdentityConfigs are validated. Finally, super classes validators are called.

Parameters:
  • configs – full or partial (subset) configurations to be validated

  • raise_for_invalid – if True raise an error for invalid configrations type/key. Default True

Returns:

flag indicating whether passed configurations dictionary is valid or not

Raises:
  • AttributeError – if any (or a group) of the configurations does not exist in the model configurations IdentityConfigs.

  • PyOEDConfigsValidationError – if the configurations are invalid and raise_for_invalid is set to True.

observation_vector(init_val=0.0)[source]#

Create an observation vector

Parameters:

init_val (float) – (optional) value assigned to entries of the state vector upon initialization

Returns:

an observation vector identical to state vectors generated by the underlying model

is_observation_vector(observation)[source]#

Test whether the passed observation vector is valid or not

Parameters:

observation – an observation vector

get_observation_grid()[source]#

Return a copy of the observational grid

apply(state)[source]#

Given a state vector (laid out as defined by the model grid passed upon instantiation), evaluate the observation vector by applying interpolation

Parameters:

state – instance of a model state with entries corresponding the model grid passed upon instantiation

Returns:

an observation vector/instance

Raises:

TypeError is raised if state has the wrong shape,

Jacobian_T_matvec(observation, eval_at=None)[source]#

Multiply (Matrix-free matrix-vector product) of transpose of the Jacobian/tangent-linear (TLM) of the observation operator by the passed observation; The Jacobian is evaluated (for nonlinear operators) at eval_at

Parameters:
  • observation – observation instance/vector

  • eval_at – state around which observation operator is linearized; ignored here since \(\mathbf{I}\) is linear

Returns:

result of multiplying the transpose of derivative of the observation operator by the passed observation

property shape#

A tuple holding the shape of the observation operator (observation size, model state size)

property extended_design#

Return a vector indicating active/inactive entries (with proper replication for multiple prognostic variables) of the observation vector/range

property design#

Get a copy of the design vector (bool representing active/inactive sensors)

property model#

The underlying simulation model

create_Identity_observation_operator(model)[source]#

Create an identity observation operator from a simulation model. The observation operator is identity, so it just mirrors a model state.

Parameters:

model – a simulation model object; instance of SimulationModel

Returns:

an instance of Identity inistantiated based on the passed simulation model