fips.covariance.CovarianceModel#

class fips.covariance.CovarianceModel[source]#

Bases: ABC

A covariance without its labels: it becomes a Covariance on a space.

What with_std() gives for a number or a Series, a sum of covariance models (a + b), and Covariance.block_diag of parts some of which are models. A Covariance may be added to a model, or be a part of one: it is aligned to the space by an exact join.

See also

fips.covariance.CorrelationModel.with_std

A covariance model from a correlation.

Examples

The model-data mismatch of one site: an instrument error, independent, and a transport error correlated over 2.8 hours that day:

>>> import pandas as pd
>>> from fips import Exponential, Independent, Space
>>> times = pd.date_range("2024-01-01 22:00", periods=4, freq="h")
>>> obs = Space({"co2": pd.Index(times, name="obs_time")})
>>> S_z = Independent().with_std(0.1) + Exponential(
...     "obs_time", "2.8h", within="obs_time.date"
... ).with_std(0.5)
>>> S_z.build(obs).dense().round(3)
array([[0.26 , 0.175, 0.   , 0.   ],
       [0.175, 0.26 , 0.   , 0.   ],
       [0.   , 0.   , 0.26 , 0.175],
       [0.   , 0.   , 0.175, 0.26 ]])

Methods

build(space[, name])

Return the covariance on space.