magni.utils.validation.types module

Module providing abstract superclasses for validation.

Routine listings

MatrixBase(object)
Abstract base class of custom matrix classes.
MMSEInputChannel(object)
Abstract base class of a Minimum Mean Squaread Error (MMSE) input channel.
StopCriterion(object)
Abstract base class of a stop criterion.
ThresholdOperator(object)
Abstract base class of a threshold operator.
class magni.utils.validation.types.MatrixBase(dtype, bounds, shape)[source]

Bases: object

Abstract base class of custom matrix classes.

The magni.utils.validation.validate_numeric function accepts built-in numeric types, numpy built-in numeric types, and subclasses of the present class. In order to perform validation checks, the validation function needs to know the data type, the bounds, and the shape of the variable. Thus, subclasses must call the init function of the present class with these arguments.

Parameters:
  • dtype (type) – The data type of the values of the instance.
  • bounds (list or tuple) – The bounds of the values of the instance.
  • shape (list or tuple) – The shape of the instance.
bounds

list or tuple – The bounds of the values of the instance.

dtype

type – The data type of the values of the instance.

shape

list or tuple – The shape of the instance.

Notes

dtype is either a built-in numeric type or a numpy built-in numeric type.

If the matrix has complex values, bounds is a list with two values; The bounds on the real values and the bounds on the imaginary values. If, on the other hand, the matrix has real values, bounds has one value; The bounds on the real values. Each such bounds value is a list with two real, numeric values; The lower bound (that is, the minimum value) and the upper bound (that is, the maximum value).

bounds
dtype
shape
class magni.utils.validation.types.MMSEInputChannel(var)[source]

Bases: object

Abstract base class of a Minimum Mean Squaread Error (MMSE) input channel.

The magni.cs.reconstruction algorithms may make use of input channels to define the prior knowledge on the sought solution. In order for the validation of such an input channel to work, it must be based on this class.

Parameters:var (dict) – The input channel state variables.
compute(var)[source]

Compute the input channel value.

Parameters:var (dict) – The variables used in computing of the input channel value.
Returns:
  • mean (ndarray) – The computed input channel mean.
  • variance (ndarray) – The computed input channel variance.
class magni.utils.validation.types.MMSEOutputChannel(var)[source]

Bases: object

Abstract base class of a Minimum Mean Squaread Error (MMSE) output channel.

The magni.cs.reconstruction algorithms may make use of output channels to define the observation model. In order for the validation of such an output channel to work, it must be based on this class.

Parameters:var (dict) – The output channel state variables.
compute(var)[source]

Compute the output channel value.

Parameters:var (dict) – The variables used in computing of the output channel value.
Returns:
  • mean (ndarray) – The computed output channel mean.
  • variance (ndarray) – The computed output channel variance.
class magni.utils.validation.types.StopCriterion(var)[source]

Bases: object

Abstract base class of a stop criterion.

The magni.cs.reconstruction algorithms are typically iterative algorithms that make use of some stop criterion to determine if it has converged. In order for the validation of such a stop criterion to work, it must be based on this class.

Parameters:var (dict) – The stop criterion state variables.
compute(var)[source]

Compute the stop criterion value.

Parameters:var (dict) – The variables used in computing of the stop criterion value.
Returns:
  • stop (bool) – The indicator of whether or not the stop criterion is satisfied.
  • value (float) – The stop criterion value.
class magni.utils.validation.types.ThresholdOperator(var)[source]

Bases: object

Abstract base class of a threshold operator.

The magni.cs.reconstruction algorithms may make use of threshold operators for “de-noising”. In order for the validation of such a threshold operator to work, it must be based on this class.

Parameters:var (dict) – The threshold operator state variables.
compute_deriv_threshold(var)[source]

Compute the entrywise derivative threshold.

Parameters:var (dict) – The variables used in computing the derivative threshold.
Returns:eta_deriv (ndarray) – The computed entrywise derivative threshold.
compute_threshold(var)[source]

Compute the entrywise threshold.

Parameters:var (dict) – The variables used in computing the threshold.
Returns:eta (ndarray) – The computed entrywise threshold.
update_threshold_level(var)[source]

Update the threshold level state.

Parameters:var (dict) – The variables used in computing the threshold level update.