Coverage for python/lsst/ap/verify/measurements/compute_metrics.py : 16%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# # This file is part of ap_verify. # # Developed for the LSST Data Management System. # This product includes software developed by the LSST Project # (http://www.lsst.org). # See the COPYRIGHT file at the top-level directory of this distribution # for details of code ownership. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. #
The rest of `ap_verify` should access `measurements` through the functions defined here, rather than depending on individual measurement functions. """
measureNumberUnassociatedDiaObjects, \ measureFractionUpdatedDiaObjects, \ measureNumberSciSources, \ measureFractionDiaSourcesToSciSources, \ measureTotalUnassociatedDiaObjects
"""Compute all known metrics on Task metadata.
Parameters ---------- metadata : `lsst.daf.base.PropertySet` The metadata to search for measurements.
Returns ------- measurements : iterable of `lsst.verify.Measurement` all the measurements derived from ``metadata``. May be empty. """ result = []
measurement = measureNumberNewDiaObjects( metadata, 'apPipe:associator', 'ap_association.numNewDiaObjects') if measurement is not None: result.append(measurement) measurement = measureFractionUpdatedDiaObjects( metadata, 'apPipe:associator', 'ap_association.fracUpdatedDiaObjects') if measurement is not None: result.append(measurement) measurement = measureNumberUnassociatedDiaObjects( metadata, 'apPipe:associator', 'ap_association.numUnassociatedDiaObjects') if measurement is not None: result.append(measurement) return result
"""Create measurements from a butler repository.
Parameters ---------- metricsConfig : `str` A file containing a `~lsst.verify.gen2tasks.MetricsControllerConfig`. butler : `lsst.daf.persistence.Butler` A butler opened to the repository to read. rawDataId : `lsst.daf.persistence.DataId` or `dict` Butler identifier naming the data given to ap_pipe.
Returns ------- measurements : iterable of `lsst.verify.Measurement` all the measurements derived from ``metadata``. May be empty. """ result = []
dataId = copy.copy(rawDataId) # Workaround for bug where Butler tries to load HDU # even when template doesn't have one if "hdu" in dataId: del dataId["hdu"]
timingConfig = MetricsControllerTask.ConfigClass() timingConfig.load(metricsConfig) _runMetricTasks(timingConfig, butler, dataId)
measurement = measureNumberSciSources( butler, dataId, "ip_diffim.numSciSources") if measurement is not None: result.append(measurement)
measurement = measureFractionDiaSourcesToSciSources( butler, dataId, "ip_diffim.fracDiaSourcesToSciSources") if measurement is not None: result.append(measurement)
config = butler.get(ApPipeTask._DefaultName + '_config') result.extend(measureFromPpdb(config.ppdb))
metadata = butler.get(ApPipeTask._DefaultName + '_metadata', dataId=dataId) result.extend(measureFromMetadata(metadata)) return result
"""Run MetricControllerTask on a single dataset.
Parameters ---------- config : `lsst.verify.gen2tasks.MetricsControllerConfig` The config for running `~lsst.verify.gen2tasks.MetricsControllerTask`. butler : `lsst.daf.persistence.Butler` A butler opened to ap_verify's output repository. dataId : `lsst.daf.persistence.DataId` or `dict` The data ID for this run of ``ap_verify``. """ allMetricTasks = MetricsControllerTask(config)
# Don't particularly want calexps, but they tend to have compatible # data IDs with other processed data types processedDatarefs = butler.subset('calexp', dataId=dataId) allMetricTasks.runDataRefs(processedDatarefs)
"""Make measurements on a ppdb database containing the results of source association.
configurable : `lsst.pex.config.ConfigurableInstance` A configurable object for a `lsst.dax.ppdb.Ppdb` or similar type. """ result = [] ppdb = configurable.apply() measurement = measureTotalUnassociatedDiaObjects( ppdb, "ap_association.totalUnassociatedDiaObjects") if measurement is not None: result.append(measurement)
return result |