CountAction

class lsst.analysis.tools.actions.scalar.CountAction(*args, **kw)

Bases: ScalarAction

Performs count actions, with threshold-based filtering. The operator is specified as a string, for example, “lt”, “le”, “ge”, “gt”, “ne”, and “eq” for the mathematical operations <, <=, >=, >, !=, and == respectively. To count non-NaN values, only pass the column name as vector key. To count NaN values, pass threshold = nan (from math.nan). Optionally to configure from a YAML file, pass “threshold: !!float nan”. To compute the number of elements with values less than a given threshold, use op=”le”.

Attributes Summary

op

Operator name string.

threshold

Threshold to apply.

vectorKey

Key of Vector to count (str)

Methods Summary

__call__(data, **kwargs)

Compute a scalar value from keyed data.

getInputSchema()

Return the schema an AnalysisAction expects to be present in the arguments supplied to the __call__ method.

Attributes Documentation

op

Operator name string. (str, default 'ne')

Allowed values:

'lt'

less than threshold

'le'

less than or equal to threshold

'ge'

greater than or equal to threshold

'ne'

not equal to a given value

'eq'

equal to a given value

'gt'

greater than threshold

'None'

Field is optional

threshold

Threshold to apply. (float, default nan)

vectorKey

Key of Vector to count (str)

Methods Documentation

__call__(data: MutableMapping[str, ndarray[Any, dtype[ScalarType]] | Scalar | HealSparseMap | Tensor], **kwargs) Scalar

Compute a scalar value from keyed data.

Parameters:
data

Keyed data to compute a value from.

kwargs

Additional keyword arguments.

Returns:
A scalar value.
getInputSchema() Tensor]]]

Return the schema an AnalysisAction expects to be present in the arguments supplied to the __call__ method.

Returns:
resultKeyedDataSchema

The schema this action requires to be present when calling this action, keys are unformatted.