Skip to content

brahmap.base.NoiseCovLinearOperator

Bases: LinearOperator

Base class for noise covariance operators

Parameters:

Name Type Description Default
nargin int

description

required
matvec int

description

required
input_type Literal['covariance', 'power_spectrum']

description, by default "covariance"

'covariance'
dtype DTypeFloat

description, by default np.float64

float64
**kwargs Any

description

{}
Source code in brahmap/base/noise_ops.py
class NoiseCovLinearOperator(LinearOperator):
    """Base class for noise covariance operators

    Parameters
    ----------
    nargin : int
        _description_
    matvec : int
        _description_
    input_type : Literal["covariance", "power_spectrum"], optional
        _description_, by default "covariance"
    dtype : DTypeFloat, optional
        _description_, by default np.float64
    **kwargs: Any
        _description_
    """

    def __init__(
        self,
        nargin: int,
        matvec: int,
        input_type: Literal["covariance", "power_spectrum"] = "covariance",
        dtype: DTypeFloat = np.float64,
        **kwargs: Any,
    ):
        MPI_RAISE_EXCEPTION(
            condition=(input_type not in ["covariance", "power_spectrum"]),
            exception=ValueError,
            message="Please provide only one of `covariance` or `power_spectrum`",
        )

        super(NoiseCovLinearOperator, self).__init__(
            nargin=nargin,
            nargout=nargin,
            matvec=matvec,
            symmetric=True,
            dtype=dtype,
            **kwargs,
        )

        self.size = nargin

    @property
    def diag(self) -> np.ndarray:
        MPI_RAISE_EXCEPTION(
            condition=True,
            exception=NotImplementedError,
            message="Please subclass to implement `diag`",
        )

    def get_inverse(self) -> "InvNoiseCovLinearOperator":
        MPI_RAISE_EXCEPTION(
            condition=True,
            exception=NotImplementedError,
            message="Please subclass to implement `get_inverse()`",
        )