Source code for pycif.plugins.obsvects.standard.init_rinvprod

[docs] def init_rinvprod(obsvect, measurements, **kwargs): """Sanitise observation errors before the :math:`\\mathbf{R}^{-1}` product. Replaces any non-positive (zero or negative) ``obserror`` values in the datastore with the dataset mean, preventing :func:`~.rinvprod.rinvprod` from encountering divisions by zero. .. note:: Transport error inflation is mentioned in comments as a future extension; at present only the zero-error replacement is implemented. Args: obsvect (Plugin): obsvect plugin instance (carries ``datastore`` with an ``obserror`` column). measurements (Plugin): unused; kept for API compatibility with the pyCIF plugin interface. **kwargs: unused; accepted for interface consistency. """ # Update observational errors by including transport errors # At the moment, transport error is specified by the user and considered # uniform obsvect.datastore.loc[ obsvect.datastore["obserror"] <= 0, "obserror" ] = obsvect.datastore["obserror"].mean()