MetadataMetricTask#

class lsst.verify.tasks.MetadataMetricTask(**kwargs)#

Bases: AbstractMetadataMetricTask

A base class for tasks that compute metrics from single metadata objects.

Parameters#

*args **kwargs

Constructor parameters are the same as for lsst.pipe.base.PipelineTask.

Notes#

This class should be customized by overriding getInputMetadataKeys and makeMeasurement. You should not need to override run.

Methods Summary

makeMeasurement(values)

Compute the metric given the values of the metadata.

run(metadata)

Compute a measurement from science task metadata.

Methods Documentation

abstract makeMeasurement(values)#

Compute the metric given the values of the metadata.

Parameters#

valuesdict [str, any]

A dict representation of the metadata passed to run. It has the same keys as returned by getInputMetadataKeys, and maps them to the values extracted from the metadata. Any value may be None to represent missing data.

Returns#

measurementlsst.verify.Measurement or None

The measurement corresponding to the input data.

Raises#

lsst.verify.tasks.MetricComputationError

Raised if an algorithmic or system error prevents calculation of the metric. See run for expected behavior.

lsst.pipe.base.NoWorkFound

Raised if the metric is ill-defined or otherwise inapplicable. Typically this means that the pipeline step or option being measured was not run.

run(metadata)#

Compute a measurement from science task metadata.

Parameters#

metadatalsst.pipe.base.TaskMetadata

A metadata object for the unit of science processing to use for this metric, or a collection of such objects if this task combines many units of processing into a single metric.

Returns#

resultlsst.pipe.base.Struct

A Struct containing the following component:

Raises#

lsst.verify.tasks.MetricComputationError

Raised if the strings returned by getInputMetadataKeys match more than one key in any metadata object.

lsst.pipe.base.NoWorkFound

Raised if the metric is ill-defined or otherwise inapplicable. Typically this means that the pipeline step or option being measured was not run.

Notes#

This implementation calls getInputMetadataKeys, then searches for matching keys in each metadata. It then passes the values of these keys (or None if no match) to makeMeasurement, and returns its result to the caller.