nifty7.operators.operator module#

class Operator[source]#

Bases: object

Transforms values defined on one domain into values defined on another domain, and can also provide the Jacobian.

abs(*args, **kwargs)#
abs_pre(*args, **kwargs)#
absolute(*args, **kwargs)#
absolute_pre(*args, **kwargs)#
apply(x)[source]#

Applies the operator to a Field or MultiField.

Parameters:

x (Field or MultiField) – Input on which the operator shall act. Needs to be defined on domain.

arctan(*args, **kwargs)#
arctan_pre(*args, **kwargs)#
clip(*args, **kwargs)#
clip_pre(*args, **kwargs)#
conjugate()[source]#
cos(*args, **kwargs)#
cos_pre(*args, **kwargs)#
cosh(*args, **kwargs)#
cosh_pre(*args, **kwargs)#
property domain#

The domain on which the Operator’s input Field is defined.

Returns:

domain

Return type:

DomainTuple or MultiDomain

ducktape(name)[source]#
ducktape_left(name)[source]#
exp(*args, **kwargs)#
exp_pre(*args, **kwargs)#
expm1(*args, **kwargs)#
expm1_pre(*args, **kwargs)#
exponentiate(*args, **kwargs)#
exponentiate_pre(*args, **kwargs)#
force(x)[source]#

Extract subset of domain of x according to self.domain and apply operator.

get_transformation()[source]#

The coordinate transformation that maps into a coordinate system in which the metric of a likelihood is the Euclidean metric. It is None, except for instances of LikelihoodEnergyOperator or (nested) sums thereof.

Returns:

  • np.dtype, or dict of np.dtype (The dtype(s) of the target space of the)

  • transformation.

  • Operator (The transformation that maps from domain into the)

  • Euclidean target space.

Note

This Euclidean target space is the disjoint union of the Euclidean target spaces of all summands. Therefore, the keys of MultiDomains are prefixed with an index and DomainTuples are converted to MultiDomains with the index as the key.

static identity_operator(dom)[source]#
property imag#
integrate(spaces=None)[source]#
property jac#

The Jacobian associated with this object For “pure” operators this is None. For Field-like objects this can be None (in which case the object is a constant), or it can be a LinearOperator with domain and target matching the object’s.

Returns:

None or LinearOperator

Return type:

the Jacobian

Notes

if value is None, this must be None as well!

log(*args, **kwargs)#
log10(*args, **kwargs)#
log10_pre(*args, **kwargs)#
log1p(*args, **kwargs)#
log1p_pre(*args, **kwargs)#
log_pre(*args, **kwargs)#
property metric#

The metric associated with the object. This is None, except when all the following conditions hold: - want_metric is True

  • target is the scalar domain

  • the operator chain contained an operator which could compute the metric

Returns:

None or LinearOperator

Return type:

the metric

partial_insert(x)[source]#
power(*args, **kwargs)#
power_pre(*args, **kwargs)#
ptw(op, *args, **kwargs)[source]#
ptw_pre(op, *args, **kwargs)[source]#
property real#
reciprocal(*args, **kwargs)#
reciprocal_pre(*args, **kwargs)#
scale(factor)[source]#
sigmoid(*args, **kwargs)#
sigmoid_pre(*args, **kwargs)#
sign(*args, **kwargs)#
sign_pre(*args, **kwargs)#
simplify_for_constant_input(c_inp)[source]#
sin(*args, **kwargs)#
sin_pre(*args, **kwargs)#
sinc(*args, **kwargs)#
sinc_pre(*args, **kwargs)#
sinh(*args, **kwargs)#
sinh_pre(*args, **kwargs)#
softplus(*args, **kwargs)#
softplus_pre(*args, **kwargs)#
sqrt(*args, **kwargs)#
sqrt_pre(*args, **kwargs)#
sum(spaces=None)[source]#
tan(*args, **kwargs)#
tan_pre(*args, **kwargs)#
tanh(*args, **kwargs)#
tanh_pre(*args, **kwargs)#
property target#

The domain on which the Operator’s output Field is defined.

Returns:

target

Return type:

DomainTuple or MultiDomain

unitstep(*args, **kwargs)#
unitstep_pre(*args, **kwargs)#
property val#

The numerical value associated with this object For “pure” operators this is None. For Field-like objects this is a numpy.ndarray or a dictionary of numpy.ndarray`s mathcing the object’s `target.

Returns:

None or numpy.ndarray or dictionary of np.ndarrays

Return type:

the numerical value

vdot(other)[source]#
property want_metric#

Whether a metric should be computed for the full expression. This is False whenever jac is None. In other cases it signals that operators processing this object should compute the metric.

Returns:

bool

Return type:

whether the metric should be computed

func(f)[source]#