class rubin_sim.maf.metrics.StringCountMetric(metric_name='stringCountMetric', col='filter', percent=False, **kwargs)

Bases: BaseMetric

Count up the number of times each string appears in a column.

Dynamically builds reduce functions for each unique string value, so summary sats can be named the same as strings in the simData array without knowing the values of those trings ahead of time.

Methods Summary

run(data_slice[, slice_point])

Calculate metric values.

Methods Documentation

run(data_slice, slice_point=None)

Calculate metric values.

data_slicenumpy.ndarray, (N,)

Values passed to metric by the slicer, which the metric will use to calculate metric values at each slice_point.

slice_pointdict or None

Dictionary of slice_point metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

metricValue: int float or object

The metric value at each slice_point.