Logical

class stdatamodels.jwst.transforms.Logical(condition, compareto, value, **kwargs)

Bases: Model

Substitute values in an array where the condition is evaluated to True.

Similar to numpy’s where function.

Initialize the model.

Parameters:
conditionstr

A string representing the logical, one of GT, LT, NE, EQ

comparetofloat, np.ndarray

A number to compare to using the condition If ndarray then the input array, compareto and value should have the same shape.

valuefloat, np.ndarray

Value to substitute where condition is True.

**kwargs

Additional keyword arguments to pass to Model.

Attributes Summary

conditions

n_inputs

n_outputs

Methods Summary

__call__(*inputs[, model_set_axis, ...])

Evaluate this model using the given input(s) and the parameter values that were specified when the model was instantiated.

evaluate(x)

Compare x to compareto and substitute value where condition is True.

Attributes Documentation

conditions = {'EQ': <ufunc 'equal'>, 'GT': <ufunc 'greater'>, 'LT': <ufunc 'less'>, 'NE': <ufunc 'not_equal'>}
n_inputs = 1
n_outputs = 1

Methods Documentation

__call__(*inputs, model_set_axis=None, with_bounding_box=False, fill_value=nan, equivalencies=None, inputs_map=None, **new_inputs)

Evaluate this model using the given input(s) and the parameter values that were specified when the model was instantiated.

evaluate(x)

Compare x to compareto and substitute value where condition is True.

Parameters:
xnp.ndarray

Input array.

Returns:
array-like

The input array with values substituted where the condition is True.