CountAction#
- class lsst.analysis.tools.actions.scalar.CountAction(*args, **kw)#
Bases:
ScalarActionPerforms 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
Methods Summary
__call__(data, **kwargs)Compute a scalar value from keyed data.
Return the schema an
AnalysisActionexpects 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, defaultnan)
- vectorKey#
Key of Vector to count (
str)
Methods Documentation
- __call__(data: MutableMapping[str, ndarray[tuple[Any, ...], dtype[_ScalarT]] | Scalar | HealSparseMap | Tensor | Mapping], **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() Iterable[tuple[str, type[ndarray[tuple[Any, ...], dtype[_ScalarT]]] | type[Scalar] | type[HealSparseMap] | type[Tensor] | type[Mapping]]]#
Return the schema an
AnalysisActionexpects to be present in the arguments supplied to the __call__ method.Returns#
- result
KeyedDataSchema The schema this action requires to be present when calling this action, keys are unformatted.
- result