AbstractMetadataMetricTask#

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

Bases: MetricTask

A base class for tasks that compute metrics from metadata values.

This class contains code that is agnostic to whether the input is one metadata object or many.

Parameters#

*args **kwargs

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

Notes#

This class should be customized by overriding getInputMetadataKeys and run.

Methods Summary

extractMetadata(metadata, metadataKeys)

Read multiple keys from a metadata object.

getInputMetadataKeys(config)

Return the metadata keys read by this task.

Methods Documentation

static extractMetadata(metadata, metadataKeys)#

Read multiple keys from a metadata object.

Parameters#

metadatalsst.pipe.base.TaskMetadata

A metadata object.

metadataKeysdict [str, str]

Keys are arbitrary labels, values are metadata keys (or their substrings) in the format of lsst.pipe.base.Task.getFullMetadata().

Returns#

metadataValuesdict [str, any]

Keys are the same as for metadataKeys, values are the value of each metadata key, or None if no matching key was found.

Raises#

lsst.verify.tasks.MetricComputationError

Raised if any metadata key string has more than one match in metadata.

abstract classmethod getInputMetadataKeys(config)#

Return the metadata keys read by this task.

Parameters#

configcls.ConfigClass

Configuration for this task.

Returns#

keysdict [str, str]

The keys are the (arbitrary) names of values to use in task code, the values are the metadata keys to be looked up (see the metadataKeys parameter to extractMetadata). Metadata keys are assumed to include task prefixes in the format of lsst.pipe.base.Task.getFullMetadata(). This method may return a substring of the desired (full) key, but the string must match a unique metadata key.