ApdbMetricTask#

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

Bases: MetricTask

A base class for tasks that compute metrics from an alert production database.

Parameters#

**kwargs

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

Notes#

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

Methods Summary

makeMeasurement(dbHandle, outputDataId)

Compute the metric from database data.

run(dbInfo[, outputDataId])

Compute a measurement from a database.

runQuantum(butlerQC, inputRefs, outputRefs)

Do Butler I/O to provide in-memory objects for run.

Methods Documentation

abstract makeMeasurement(dbHandle, outputDataId)#

Compute the metric from database data.

Parameters#

dbHandlelsst.dax.apdb.Apdb

A database instance.

outputDataIdany data ID type

The subset of the database to which this measurement applies. May be empty to represent the entire dataset.

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 to the database state. Typically this means that the pipeline step or option being measured was not run.

run(dbInfo, outputDataId={})#

Compute a measurement from a database.

Parameters#

dbInfolist

The datasets (of the type indicated by the config) from which to load the database. If more than one dataset is provided (as may be the case if DB writes are fine-grained), all are assumed identical.

outputDataId: any data ID type, optional

The output data ID for the metric value. Defaults to the empty ID, representing a value that covers the entire dataset.

Returns#

resultlsst.pipe.base.Struct

Result struct with component:

measurement

the value of the metric (lsst.verify.Measurement or None)

Raises#

lsst.verify.tasks.MetricComputationError

Raised if an algorithmic or system error prevents calculation of the metric.

lsst.pipe.base.NoWorkFound

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

Notes#

This implementation calls dbLoader to acquire a database handle, then passes it and the value of outputDataId to makeMeasurement. The result of makeMeasurement is returned to the caller.

runQuantum(butlerQC, inputRefs, outputRefs)#

Do Butler I/O to provide in-memory objects for run.

This specialization of runQuantum passes the output data ID to run.