diff --git a/SConstruct b/SConstruct
index 89ccd153..92a3ebb7 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1,4 +1,4 @@
# -*- python -*-
from lsst.sconsUtils import scripts
-scripts.BasicSConstruct("ap_verify", disableCc=True)
-
+# Python-only package
+scripts.BasicSConstruct("ap_verify", disableCc=True, noCfgFile=True)
diff --git a/python/lsst/ap/verify/testPipeline.py b/python/lsst/ap/verify/testPipeline.py
deleted file mode 100644
index d0d59d33..00000000
--- a/python/lsst/ap/verify/testPipeline.py
+++ /dev/null
@@ -1,676 +0,0 @@
-#
-# 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 .
-#
-
-
-# These classes exist only to be included in a mock pipeline, and don't need
-# to be public for that.
-__all__ = []
-
-import astropy.table
-import numpy as np
-import pandas
-
-import lsst.geom as geom
-import lsst.afw.image as afwImage
-import lsst.afw.math as afwMath
-import lsst.afw.table as afwTable
-from lsst.ap.association import (LoadDiaCatalogsConfig, TransformDiaSourceCatalogConfig,
- DiaPipelineConfig, FilterDiaSourceCatalogConfig)
-from lsst.pipe.base import PipelineTask, Struct
-from lsst.ip.isr import IsrTaskConfig
-from lsst.ip.diffim import (GetTemplateConfig, AlardLuptonSubtractConfig,
- DetectAndMeasureConfig, SpatiallySampledMetricsConfig)
-from lsst.pipe.tasks.characterizeImage import CharacterizeImageConfig
-from lsst.pipe.tasks.calibrate import CalibrateConfig
-from lsst.meas.transiNet import RBTransiNetConfig
-
-
-class MockLoadDiaCatalogsTask(PipelineTask):
- """A do-nothing substitute for LoadDiaCatalogsTask.
- """
- ConfigClass = LoadDiaCatalogsConfig
- _DefaultName = "notLoadDiaCatalogs"
-
- def run(self, regionTime):
- """Produce preloaded DiaSource and DiaObject outputs with no processing.
-
- Parameters
- ----------
- regionTime : `lsst.pipe.base.utils.RegionTimeInfo`
- A serializable container for a sky region and timespan.
-
- Returns
- -------
- result : `lsst.pipe.base.Struct`
- Results struct with components.
-
- - ``diaObjects`` : Complete set of DiaObjects covering the input
- exposure padded by ``pixelMargin``. DataFrame is indexed by
- the ``diaObjectId`` column. (`pandas.DataFrame`)
- - ``diaSources`` : Complete set of DiaSources covering the input
- exposure padded by ``pixelMargin``. DataFrame is indexed by
- ``diaObjectId``, ``band``, ``diaSourceId`` columns.
- (`pandas.DataFrame`)
- - ``diaForcedSources`` : Complete set of forced photometered fluxes
- on the past 12 months of difference images at DiaObject locations.
- """
- return Struct(diaObjects=pandas.DataFrame(),
- diaSources=pandas.DataFrame(),
- diaForcedSources=pandas.DataFrame(),
- )
-
-
-class MockIsrTask(PipelineTask):
- """A do-nothing substitute for IsrTask.
- """
- ConfigClass = IsrTaskConfig
- _DefaultName = "notIsr"
-
- def run(self, ccdExposure, *, camera=None, bias=None, linearizer=None,
- crosstalk=None, crosstalkSources=None,
- dark=None, flat=None, ptc=None, bfKernel=None, bfGains=None, defects=None,
- fringes=Struct(fringes=None), opticsTransmission=None, filterTransmission=None,
- sensorTransmission=None, atmosphereTransmission=None,
- detectorNum=None, strayLightData=None, illumMaskedImage=None,
- deferredCharge=None,
- ):
- """Accept ISR inputs, and produce ISR outputs with no processing.
-
- Parameters
- ----------
- ccdExposure : `lsst.afw.image.Exposure`
- The raw exposure that is to be run through ISR. The
- exposure is modified by this method.
- camera : `lsst.afw.cameraGeom.Camera`, optional
- The camera geometry for this exposure. Required if
- one or more of ``ccdExposure``, ``bias``, ``dark``, or
- ``flat`` does not have an associated detector.
- bias : `lsst.afw.image.Exposure`, optional
- Bias calibration frame.
- linearizer : `lsst.ip.isr.linearize.LinearizeBase`, optional
- Functor for linearization.
- crosstalk : `lsst.ip.isr.crosstalk.CrosstalkCalib`, optional
- Calibration for crosstalk.
- crosstalkSources : `list`, optional
- List of possible crosstalk sources.
- dark : `lsst.afw.image.Exposure`, optional
- Dark calibration frame.
- flat : `lsst.afw.image.Exposure`, optional
- Flat calibration frame.
- ptc : `lsst.ip.isr.PhotonTransferCurveDataset`, optional
- Photon transfer curve dataset, with, e.g., gains
- and read noise.
- bfKernel : `numpy.ndarray`, optional
- Brighter-fatter kernel.
- bfGains : `dict` of `float`, optional
- Gains used to override the detector's nominal gains for the
- brighter-fatter correction. A dict keyed by amplifier name for
- the detector in question.
- defects : `lsst.ip.isr.Defects`, optional
- List of defects.
- fringes : `lsst.pipe.base.Struct`, optional
- Struct containing the fringe correction data, with
- elements:
- - ``fringes``: fringe calibration frame (`afw.image.Exposure`)
- - ``seed``: random seed derived from the ccdExposureId for random
- number generator (`uint32`)
- opticsTransmission: `lsst.afw.image.TransmissionCurve`, optional
- A ``TransmissionCurve`` that represents the throughput of the
- optics, to be evaluated in focal-plane coordinates.
- filterTransmission : `lsst.afw.image.TransmissionCurve`
- A ``TransmissionCurve`` that represents the throughput of the
- filter itself, to be evaluated in focal-plane coordinates.
- sensorTransmission : `lsst.afw.image.TransmissionCurve`
- A ``TransmissionCurve`` that represents the throughput of the
- sensor itself, to be evaluated in post-assembly trimmed detector
- coordinates.
- atmosphereTransmission : `lsst.afw.image.TransmissionCurve`
- A ``TransmissionCurve`` that represents the throughput of the
- atmosphere, assumed to be spatially constant.
- detectorNum : `int`, optional
- The integer number for the detector to process.
- isGen3 : bool, optional
- Flag this call to run() as using the Gen3 butler environment.
- strayLightData : `object`, optional
- Opaque object containing calibration information for stray-light
- correction. If `None`, no correction will be performed.
- illumMaskedImage : `lsst.afw.image.MaskedImage`, optional
- Illumination correction image.
-
- Returns
- -------
- result : `lsst.pipe.base.Struct`
- Result struct with components:
-
- ``exposure``
- The fully ISR corrected exposure (`afw.image.Exposure`).
- ``outputExposure``
- An alias for ``exposure`` (`afw.image.Exposure`).
- ``ossThumb``
- Thumbnail image of the exposure after overscan subtraction
- (`numpy.ndarray`).
- ``flattenedThumb``
- Thumbnail image of the exposure after flat-field correction
- (`numpy.ndarray`).
- - ``outputStatistics`` : mapping [`str`]
- Values of the additional statistics calculated.
- """
- return Struct(exposure=afwImage.ExposureF(),
- outputExposure=afwImage.ExposureF(),
- ossThumb=np.empty((1, 1)),
- flattenedThumb=np.empty((1, 1)),
- preInterpExposure=afwImage.ExposureF(),
- outputOssThumbnail=np.empty((1, 1)),
- outputFlattenedThumbnail=np.empty((1, 1)),
- outputStatistics={},
- )
-
-
-class MockCharacterizeImageTask(PipelineTask):
- """A do-nothing substitute for CharacterizeImageTask.
- """
- ConfigClass = CharacterizeImageConfig
- _DefaultName = "notCharacterizeImage"
-
- def __init__(self, refObjLoader=None, schema=None, **kwargs):
- super().__init__(**kwargs)
- self.outputSchema = afwTable.SourceCatalog()
-
- def runQuantum(self, butlerQC, inputRefs, outputRefs):
- inputs = butlerQC.get(inputRefs)
- if 'idGenerator' not in inputs.keys():
- inputs['idGenerator'] = self.config.idGenerator.apply(butlerQC.quantum.dataId)
- outputs = self.run(**inputs)
- butlerQC.put(outputs, outputRefs)
-
- def run(self, exposure, background=None, idGenerator=None):
- """Produce characterization outputs with no processing.
-
- Parameters
- ----------
- exposure : `lsst.afw.image.Exposure`
- Exposure to characterize.
- background : `lsst.afw.math.BackgroundList`, optional
- Initial model of background already subtracted from exposure.
- idGenerator : `lsst.meas.base.IdGenerator`, optional
- Object that generates source IDs and provides random number
- generator seeds.
-
- Returns
- -------
- result : `lsst.pipe.base.Struct`
- Struct containing these fields:
-
- ``characterized``
- Characterized exposure (`lsst.afw.image.Exposure`).
- ``sourceCat``
- Detected sources (`lsst.afw.table.SourceCatalog`).
- ``backgroundModel``
- Model of background subtracted from exposure (`lsst.afw.math.BackgroundList`)
- ``psfCellSet``
- Spatial cells of PSF candidates (`lsst.afw.math.SpatialCellSet`)
- """
- # Can't persist empty BackgroundList; DM-33714
- bg = afwMath.BackgroundMI(geom.Box2I(geom.Point2I(0, 0), geom.Point2I(16, 16)),
- afwImage.MaskedImageF(16, 16))
- return Struct(characterized=exposure,
- sourceCat=afwTable.SourceCatalog(),
- backgroundModel=afwMath.BackgroundList(bg),
- psfCellSet=afwMath.SpatialCellSet(exposure.getBBox(), 10),
- )
-
-
-class MockCalibrateTask(PipelineTask):
- """A do-nothing substitute for CalibrateTask.
- """
- ConfigClass = CalibrateConfig
- _DefaultName = "notCalibrate"
-
- def __init__(self, astromRefObjLoader=None,
- photoRefObjLoader=None, icSourceSchema=None,
- initInputs=None, **kwargs):
- super().__init__(**kwargs)
- self.outputSchema = afwTable.SourceCatalog()
-
- def runQuantum(self, butlerQC, inputRefs, outputRefs):
- inputs = butlerQC.get(inputRefs)
- inputs['idGenerator'] = self.config.idGenerator.apply(butlerQC.quantum.dataId)
-
- if self.config.doAstrometry:
- inputs.pop('astromRefCat')
- if self.config.doPhotoCal:
- inputs.pop('photoRefCat')
-
- outputs = self.run(**inputs)
-
- if self.config.doWriteMatches and self.config.doAstrometry:
- normalizedMatches = afwTable.packMatches(outputs.astromMatches)
- if self.config.doWriteMatchesDenormalized:
- # Just need an empty BaseCatalog with a valid schema.
- outputs.matchesDenormalized = afwTable.BaseCatalog(outputs.outputCat.schema)
- outputs.matches = normalizedMatches
- butlerQC.put(outputs, outputRefs)
-
- def run(self, exposure, background=None,
- icSourceCat=None, idGenerator=None):
- """Produce calibration outputs with no processing.
-
- Parameters
- ----------
- exposure : `lsst.afw.image.Exposure`
- Exposure to calibrate.
- background : `lsst.afw.math.BackgroundList`, optional
- Background model already subtracted from exposure.
- icSourceCat : `lsst.afw.table.SourceCatalog`, optional
- A SourceCatalog from CharacterizeImageTask from which we can copy some fields.
- idGenerator : `lsst.meas.base.IdGenerator`, optional
- Object that generates source IDs and provides random number
- generator seeds.
-
- Returns
- -------
- result : `lsst.pipe.base.Struct`
- Struct containing these fields:
-
- ``outputExposure``
- Calibrated science exposure with refined WCS and PhotoCalib
- (`lsst.afw.image.Exposure`).
- ``outputBackground``
- Model of background subtracted from exposure
- (`lsst.afw.math.BackgroundList`).
- ``outputCat``
- Catalog of measured sources (`lsst.afw.table.SourceCatalog`).
- ``astromMatches``
- List of source/refObj matches from the astrometry solver
- (`list` [`lsst.afw.table.ReferenceMatch`]).
- """
- # Can't persist empty BackgroundList; DM-33714
- bg = afwMath.BackgroundMI(geom.Box2I(geom.Point2I(0, 0), geom.Point2I(16, 16)),
- afwImage.MaskedImageF(16, 16))
- return Struct(outputExposure=exposure,
- outputBackground=afwMath.BackgroundList(bg),
- outputCat=afwTable.SourceCatalog(),
- astromMatches=[],
- )
-
-
-class MockGetTemplateTask(PipelineTask):
- """A do-nothing substitute for GetTemplateTask.
- """
- ConfigClass = GetTemplateConfig
- _DefaultName = "notGetTemplate"
-
- def runQuantum(self, butlerQC, inputRefs, outputRefs):
- inputs = butlerQC.get(inputRefs)
- # Mock GetTemplateTask.getOverlappingExposures
- results = Struct(coaddExposures=[],
- dataIds=[],
- )
- inputs["coaddExposures"] = results.coaddExposures
- inputs["dataIds"] = results.dataIds
- outputs = self.run(**inputs)
- butlerQC.put(outputs, outputRefs)
-
- def run(self, coaddExposures, bbox, wcs, dataIds, **kwargs):
- """Warp coadds from multiple tracts to form a template for image diff.
-
- Where the tracts overlap, the resulting template image is averaged.
- The PSF on the template is created by combining the CoaddPsf on each
- template image into a meta-CoaddPsf.
-
- Parameters
- ----------
- coaddExposures : `list` of `lsst.afw.image.Exposure`
- Coadds to be mosaicked
- bbox : `lsst.geom.Box2I`
- Template Bounding box of the detector geometry onto which to
- resample the coaddExposures
- wcs : `lsst.afw.geom.SkyWcs`
- Template WCS onto which to resample the coaddExposures
- dataIds : `list` of `lsst.daf.butler.DataCoordinate`
- Record of the tract and patch of each coaddExposure.
- **kwargs
- Any additional keyword parameters.
-
- Returns
- -------
- result : `lsst.pipe.base.Struct` containing
- - ``template`` : a template coadd exposure assembled out of patches
- """
- return Struct(template=afwImage.ExposureF(),
- )
-
-
-class MockAlardLuptonSubtractTask(PipelineTask):
- """A do-nothing substitute for AlardLuptonSubtractTask.
- """
- ConfigClass = AlardLuptonSubtractConfig
- _DefaultName = "notAlardLuptonSubtract"
-
- def run(self, template, science, sources, finalizedPsfApCorrCatalog=None, visitSummary=None):
- """PSF match, subtract, and decorrelate two images.
-
- Parameters
- ----------
- template : `lsst.afw.image.ExposureF`
- Template exposure, warped to match the science exposure.
- science : `lsst.afw.image.ExposureF`
- Science exposure to subtract from the template.
- sources : `lsst.afw.table.SourceCatalog`
- Identified sources on the science exposure. This catalog is used to
- select sources in order to perform the AL PSF matching on stamp
- images around them.
- finalizedPsfApCorrCatalog : `lsst.afw.table.ExposureCatalog`, optional
- Exposure catalog with finalized psf models and aperture correction
- maps to be applied if config.doApplyFinalizedPsf=True. Catalog
- uses the detector id for the catalog id, sorted on id for fast
- lookup. Deprecated in favor of ``visitSummary``, and will be
- removed after v26.
- visitSummary : `lsst.afw.table.ExposureCatalog`, optional
- Exposure catalog with external calibrations to be applied. Catalog
- uses the detector id for the catalog id, sorted on id for fast
- lookup. Ignored (for temporary backwards compatibility) if
- ``finalizedPsfApCorrCatalog`` is provided.
-
- Returns
- -------
- results : `lsst.pipe.base.Struct`
- ``difference`` : `lsst.afw.image.ExposureF`
- Result of subtracting template and science.
- ``matchedTemplate`` : `lsst.afw.image.ExposureF`
- Warped and PSF-matched template exposure.
- ``backgroundModel`` : `lsst.afw.math.Function2D`
- Background model that was fit while solving for the
- PSF-matching kernel
- ``psfMatchingKernel`` : `lsst.afw.math.Kernel`
- Kernel used to PSF-match the convolved image.
- """
- return Struct(difference=afwImage.ExposureF(),
- matchedTemplate=afwImage.ExposureF(),
- backgroundModel=afwMath.NullFunction2D(),
- psfMatchingKernel=afwMath.FixedKernel(),
- )
-
-
-class MockDetectAndMeasureConfig(DetectAndMeasureConfig):
-
- def setDefaults(self):
- super().setDefaults()
- # Avoid delegating to lsst.obs.base.Instrument specialization for the
- # data ID packing algorithm to use, since test code often does not use a
- # real Instrument in its data IDs.
- self.idGenerator.packer.name = "observation"
-
-
-class MockDetectAndMeasureTask(PipelineTask):
- """A do-nothing substitute for DetectAndMeasureTask.
- """
- ConfigClass = MockDetectAndMeasureConfig
- _DefaultName = "notDetectAndMeasure"
-
- def __init__(self, **kwargs):
- super().__init__(**kwargs)
- self.outputSchema = afwTable.SourceCatalog()
-
- def runQuantum(self, butlerQC, inputRefs, outputRefs):
- inputs = butlerQC.get(inputRefs)
- idFactory = afwTable.IdFactory.makeSimple()
-
- outputs = self.run(inputs['science'],
- inputs['matchedTemplate'],
- inputs['difference'],
- idFactory=idFactory)
- butlerQC.put(outputs, outputRefs)
-
- def run(self, science, matchedTemplate, difference,
- idFactory=None):
- """Detect and measure sources on a difference image.
-
- Parameters
- ----------
- science : `lsst.afw.image.ExposureF`
- Science exposure that the template was subtracted from.
- matchedTemplate : `lsst.afw.image.ExposureF`
- Warped and PSF-matched template that was used produce the
- difference image.
- difference : `lsst.afw.image.ExposureF`
- Result of subtracting template from the science image.
- idFactory : `lsst.afw.table.IdFactory`, optional
- Generator object to assign ids to detected sources in the difference image.
-
- Returns
- -------
- results : `lsst.pipe.base.Struct`
- ``subtractedMeasuredExposure`` : `lsst.afw.image.ExposureF`
- Subtracted exposure with detection mask applied.
- ``diaSources`` : `lsst.afw.table.SourceCatalog`
- The catalog of detected sources.
- """
- return Struct(subtractedMeasuredExposure=difference,
- diaSources=afwTable.SourceCatalog(),
- )
-
-
-class MockFilterDiaSourceCatalogTask(PipelineTask):
- """A do-nothing substitute for FilterDiaSourceCatalogTask.
- """
- ConfigClass = FilterDiaSourceCatalogConfig
- _DefaultName = "notFilterDiaSourceCatalog"
-
- def run(self, diaSourceCat, diffImVisitInfo):
- """Produce filtering outputs with no processing.
-
- Parameters
- ----------
- diaSourceCat : `lsst.afw.table.SourceCatalog`
- Catalog of sources measured on the difference image.
- diffImVisitInfo: `lsst.afw.image.VisitInfo`
- VisitInfo for the difference image corresponding to diaSourceCat.
-
- Returns
- -------
- results : `lsst.pipe.base.Struct`
- Results struct with components.
-
- ``filteredDiaSourceCat`` : `lsst.afw.table.SourceCatalog`
- The catalog of filtered sources.
- ``rejectedDiaSources`` : `lsst.afw.table.SourceCatalog`
- The catalog of rejected sky sources.
- ``longTrailedDiaSources`` : `astropy.table.Table`
- DiaSources which have trail lengths greater than
- max_trail_length*exposure_time.
- """
- # TODO Add docstrings for diffIm
- return Struct(filteredDiaSourceCat=afwTable.SourceCatalog(),
- rejectedDiaSources=afwTable.SourceCatalog(),
- longTrailedSources=afwTable.SourceCatalog().asAstropy(),
- )
-
-
-class MockSpatiallySampledMetricsTask(PipelineTask):
- """A do-nothing substitute for SpatiallySampledMetricsTask.
- """
- ConfigClass = SpatiallySampledMetricsConfig
- _DefaultName = "notSpatiallySampledMetricsTask"
-
- def run(self, science, matchedTemplate, template, difference, diaSources, psfMatchingKernel):
- """Produce spatially sampled metrics
-
- Parameters
- ----------
- science : `lsst.afw.image.ExposureF`
- Science exposure that the template was subtracted from.
- matchedTemplate : `lsst.afw.image.ExposureF`
- Warped and PSF-matched template that was used produce the
- difference image.
- template : `lsst.afw.image.ExposureF`
- Warped and non PSF-matched template that was used to produce
- the difference image.
- difference : `lsst.afw.image.ExposureF`
- Result of subtracting template from the science image.
- diaSources : `lsst.afw.table.SourceCatalog`
- The catalog of detected sources.
- psfMatchingKernel : `~lsst.afw.math.LinearCombinationKernel`
- The PSF matching kernel of the subtraction to evaluate.
-
- Returns
- -------
- results : `lsst.pipe.base.Struct`
- Results struct with components.
- """
-
- return Struct(spatiallySampledMetrics=astropy.table.Table())
-
-
-class MockRBTransiNetTask(PipelineTask):
- """A do-nothing substitute for RBTransiNetTask.
- """
- _DefaultName = "notRbTransiNet"
- ConfigClass = RBTransiNetConfig
-
- def run(self, template, science, difference, diaSources, pretrainedModel=None):
- return Struct(classifications=afwTable.BaseCatalog(afwTable.Schema()))
-
-
-class MockTransformDiaSourceCatalogTask(PipelineTask):
- """A do-nothing substitute for TransformDiaSourceCatalogTask.
- """
- ConfigClass = TransformDiaSourceCatalogConfig
- _DefaultName = "notTransformDiaSourceCatalog"
-
- def __init__(self, initInputs, **kwargs):
- super().__init__(**kwargs)
-
- def runQuantum(self, butlerQC, inputRefs, outputRefs):
- inputs = butlerQC.get(inputRefs)
- inputs["band"] = butlerQC.quantum.dataId["band"]
-
- outputs = self.run(**inputs)
-
- butlerQC.put(outputs, outputRefs)
-
- def run(self, diaSourceCat, diffIm, band, reliability=None):
- """Produce transformation outputs with no processing.
-
- Parameters
- ----------
- diaSourceCat : `lsst.afw.table.SourceCatalog`
- The catalog to transform.
- diffIm : `lsst.afw.image.Exposure`
- An image, to provide supplementary information.
- reliability : `lsst.afw.table.SourceCatalog`, optional
- Reliability (e.g. real/bogus) scores, row-matched to
- ``diaSourceCat``.
-
- Returns
- -------
- results : `lsst.pipe.base.Struct`
- Results struct with components:
-
- ``diaSourceTable``
- Catalog of DiaSources (`pandas.DataFrame`).
- """
- return Struct(diaSourceTable=pandas.DataFrame(),
- )
-
-
-class MockDiaPipelineConfig(DiaPipelineConfig):
-
- def setDefaults(self):
- super().setDefaults()
- # Avoid delegating to lsst.obs.base.Instrument specialization for the
- # data ID packing algorithm to use, since test code often does not use a
- # real Instrument in its data IDs.
- self.idGenerator.packer.name = "observation"
-
-
-class MockDiaPipelineTask(PipelineTask):
- """A do-nothing substitute for DiaPipelineTask.
- """
- ConfigClass = MockDiaPipelineConfig
- _DefaultName = "notDiaPipe"
-
- def runQuantum(self, butlerQC, inputRefs, outputRefs):
- inputs = butlerQC.get(inputRefs)
- inputs["idGenerator"] = self.config.idGenerator.apply(butlerQC.quantum.dataId)
- inputs["band"] = butlerQC.quantum.dataId["band"]
- if not self.config.doSolarSystemAssociation:
- inputs["solarSystemObjectTable"] = None
-
- outputs = self.run(**inputs)
-
- butlerQC.put(outputs, outputRefs)
-
- def run(self,
- diaSourceTable,
- solarSystemObjectTable,
- diffIm,
- exposure,
- template,
- preloadedDiaObjects,
- preloadedDiaSources,
- preloadedDiaForcedSources,
- band,
- idGenerator):
- """Produce DiaSource and DiaObject outputs with no processing.
-
- Parameters
- ----------
- diaSourceTable : `pandas.DataFrame`
- Newly detected DiaSources.
- solarSystemObjectTable : `pandas.DataFrame`
- Expected solar system objects in the field of view.
- diffIm : `lsst.afw.image.ExposureF`
- Difference image exposure in which the sources in ``diaSourceCat``
- were detected.
- exposure : `lsst.afw.image.ExposureF`
- Calibrated exposure differenced with a template to create
- ``diffIm``.
- template : `lsst.afw.image.ExposureF`
- Template exposure used to create diffIm.
- preloadedDiaObjects : `pandas.DataFrame`
- Previously detected DiaObjects, loaded from the APDB.
- preloadedDiaSources : `pandas.DataFrame`
- Previously detected DiaSources, loaded from the APDB.
- preloadedDiaForcedSources : `pandas.DataFrame`
- Catalog of previously detected forced DiaSources, from the APDB
- band : `str`
- The band in which the new DiaSources were detected.
- idGenerator : `lsst.meas.base.IdGenerator`
- Object that generates source IDs and random number generator seeds.
-
- Returns
- -------
- results : `lsst.pipe.base.Struct`
- Results struct with components:
-
- ``apdbMarker``
- Marker dataset to store in the Butler indicating that this
- ccdVisit has completed successfully (`lsst.dax.apdb.ApdbConfig`).
- ``associatedDiaSources``
- Catalog of newly associated DiaSources (`pandas.DataFrame`).
- """
- return Struct(apdbMarker=self.config.apdb.value,
- associatedDiaSources=pandas.DataFrame(),
- diaForcedSources=pandas.DataFrame(),
- diaObjects=pandas.DataFrame(),)
diff --git a/tests/MockApPipe.yaml b/tests/MockApPipe.yaml
deleted file mode 100644
index 54f34d39..00000000
--- a/tests/MockApPipe.yaml
+++ /dev/null
@@ -1,99 +0,0 @@
-description: Mock Alert Production pipeline. Use only for testing!
-
-parameters:
- # only templates in ap_verify_testdata
- coaddName: goodSeeing
- # only refcat in ap_verify_testdata
- refcat: gaia
- apdb_config: dummy_path.yaml
-tasks:
- loadDiaCatalogs:
- class: lsst.ap.verify.testPipeline.MockLoadDiaCatalogsTask
- config:
- apdb_config_url: parameters.apdb_config
- isr:
- class: lsst.ap.verify.testPipeline.MockIsrTask
- config:
- # ap_verify_testdata lacks many auxiliary inputs
- doDark: False
- doDefect: False
- characterizeImage: lsst.ap.verify.testPipeline.MockCharacterizeImageTask
- calibrate:
- class: lsst.ap.verify.testPipeline.MockCalibrateTask
- config:
- connections.astromRefCat: parameters.refcat
- connections.photoRefCat: parameters.refcat
- # ap_verify_testdata has bad refcats
- doAstrometry: False
- doPhotoCal: False
- retrieveTemplate:
- class: lsst.ap.verify.testPipeline.MockGetTemplateTask
- config:
- connections.coaddName: parameters.coaddName
- subtractImages:
- class: lsst.ap.verify.testPipeline.MockAlardLuptonSubtractTask
- config:
- connections.coaddName: parameters.coaddName
- doApplyExternalCalibrations: False
- detectAndMeasure:
- class: lsst.ap.verify.testPipeline.MockDetectAndMeasureTask
- config:
- connections.coaddName: parameters.coaddName
- doSkySources: True
- filterDiaSrcCat:
- class: lsst.ap.verify.testPipeline.MockFilterDiaSourceCatalogTask
- config:
- doRemoveSkySources: True
- connections.coaddName: parameters.coaddName
- rbClassify:
- class: lsst.ap.verify.testPipeline.MockRBTransiNetTask
- config:
- modelPackageStorageMode: butler
- connections.coaddName: parameters.coaddName
- transformDiaSrcCat:
- class: lsst.ap.verify.testPipeline.MockTransformDiaSourceCatalogTask
- config:
- doRemoveSkySources: True
- connections.coaddName: parameters.coaddName
- getRegionTimeFromVisit:
- # class: lsst.ap.verify.testPipeline.MockGetRegionTimeFromVisitTask
- class: lsst.pipe.tasks.getRegionTimeFromVisit.GetRegionTimeFromVisitTask
- config:
- connections.coaddName: parameters.coaddName
- diaPipe:
- class: lsst.ap.verify.testPipeline.MockDiaPipelineTask
- config:
- doWriteAssociatedSources: True
- doConfigureApdb: False
- apdb_config_url: parameters.apdb_config
- connections.coaddName: parameters.coaddName
-contracts:
- # Inputs and outputs must match
- # Use of ConnectionsClass for templated fields is a workaround for DM-30210
- - retrieveTemplate.connections.ConnectionsClass(config=retrieveTemplate).template.name ==
- subtractImages.connections.ConnectionsClass(config=subtractImages).template.name
- - subtractImages.connections.ConnectionsClass(config=subtractImages).difference.name ==
- detectAndMeasure.connections.ConnectionsClass(config=detectAndMeasure).difference.name
- - subtractImages.connections.ConnectionsClass(config=subtractImages).science.name ==
- detectAndMeasure.connections.ConnectionsClass(config=detectAndMeasure).science.name
- - subtractImages.connections.ConnectionsClass(config=subtractImages).template.name ==
- diaPipe.connections.ConnectionsClass(config=diaPipe).template.name
- - subtractImages.connections.ConnectionsClass(config=subtractImages).science.name ==
- diaPipe.connections.ConnectionsClass(config=diaPipe).exposure.name
- - detectAndMeasure.connections.ConnectionsClass(config=detectAndMeasure).subtractedMeasuredExposure.name ==
- rbClassify.connections.ConnectionsClass(config=rbClassify).difference.name
- - filterDiaSrcCat.connections.ConnectionsClass(config=filterDiaSrcCat).filteredDiaSourceCat.name ==
- rbClassify.connections.ConnectionsClass(config=rbClassify).diaSources.name
- - detectAndMeasure.connections.ConnectionsClass(config=detectAndMeasure).subtractedMeasuredExposure.name ==
- transformDiaSrcCat.connections.ConnectionsClass(config=transformDiaSrcCat).diffIm.name
- - detectAndMeasure.connections.ConnectionsClass(config=detectAndMeasure).diaSources.name ==
- filterDiaSrcCat.connections.ConnectionsClass(config=filterDiaSrcCat).diaSourceCat.name
- - filterDiaSrcCat.connections.ConnectionsClass(config=filterDiaSrcCat).filteredDiaSourceCat.name ==
- transformDiaSrcCat.connections.ConnectionsClass(config=transformDiaSrcCat).diaSourceCat.name
- - detectAndMeasure.connections.ConnectionsClass(config=detectAndMeasure).subtractedMeasuredExposure.name ==
- diaPipe.connections.ConnectionsClass(config=diaPipe).diffIm.name
- - (not transformDiaSrcCat.doIncludeReliability) or
- (rbClassify.connections.ConnectionsClass(config=rbClassify).classifications.name ==
- transformDiaSrcCat.connections.ConnectionsClass(config=transformDiaSrcCat).reliability.name)
- - transformDiaSrcCat.connections.ConnectionsClass(config=transformDiaSrcCat).diaSourceTable.name ==
- diaPipe.connections.ConnectionsClass(config=diaPipe).diaSourceTable.name
diff --git a/tests/test_driver.py b/tests/test_driver.py
index 758b89a9..6b5e3b9f 100644
--- a/tests/test_driver.py
+++ b/tests/test_driver.py
@@ -34,20 +34,14 @@
from lsst.ap.verify import Dataset, WorkspaceGen3
-TESTDIR = os.path.abspath(os.path.dirname(__file__))
-
-
-def _getDataIds(butler):
- return list(butler.registry.queryDataIds({"instrument", "visit", "detector"}, datasets="raw"))
-
-
def patchApPipeGen3(method):
"""Shortcut decorator for consistently patching AP code.
"""
@functools.wraps(method)
def wrapper(self, *args, **kwargs):
dbPatcher = unittest.mock.patch("lsst.ap.verify.pipeline_driver._makeApdb")
- patchedMethod = dbPatcher(method)
+ pipePatcher = unittest.mock.patch("lsst.ap.verify.pipeline_driver.subprocess")
+ patchedMethod = dbPatcher(pipePatcher(method))
return patchedMethod(self, *args, **kwargs)
return wrapper
@@ -74,24 +68,7 @@ def setUp(self):
defineVisit = DefineVisitsTask(butler=self.workspace.workButler,
config=DefineVisitsTask.ConfigClass())
defineVisit.run(self.workspace.workButler.registry.queryDataIds("exposure", datasets="raw"))
- ids = _getDataIds(self.workspace.workButler)
- self.apPipeArgs = pipeline_driver.ApPipeParser().parse_args(
- ["--data-query", f"instrument = '{ids[0]['instrument']}' AND visit = {ids[0]['visit']}",
- "--pipeline", os.path.join(TESTDIR, "MockApPipe.yaml")])
-
- def testrunApPipeGen3Steps(self):
- """Test that runApPipeGen3 runs the entire pipeline.
- """
- pipeline_driver.runApPipeGen3(self.workspace, self.apPipeArgs)
-
- # Use datasets as a proxy for pipeline completion
- id = _getDataIds(self.workspace.analysisButler)[0]
- self.assertTrue(self.workspace.analysisButler.exists("calexp", id))
- self.assertTrue(self.workspace.analysisButler.exists("src", id))
- self.assertTrue(self.workspace.analysisButler.exists("goodSeeingDiff_differenceExp", id))
- self.assertTrue(self.workspace.analysisButler.exists("goodSeeingDiff_diaSrc", id))
- self.assertTrue(self.workspace.analysisButler.exists("apdb_marker", id))
- self.assertTrue(self.workspace.analysisButler.exists("goodSeeingDiff_assocDiaSrc", id))
+ self.apPipeArgs = pipeline_driver.ApPipeParser().parse_args(["--pipeline", "foo.yaml"])
def _getArgs(self, call_args):
if call_args.args:
@@ -102,7 +79,7 @@ def _getArgs(self, call_args):
self.fail(f"No APDB args passed to {call_args}!")
@patchApPipeGen3
- def testrunApPipeGen3WorkspaceDb(self, mockDb):
+ def testrunApPipeGen3WorkspaceDb(self, _mockPipe, mockDb):
"""Test that runApPipeGen3 places a database in the workspace location by default.
"""
pipeline_driver.runApPipeGen3(self.workspace, self.apPipeArgs)
@@ -113,7 +90,7 @@ def testrunApPipeGen3WorkspaceDb(self, mockDb):
self.assertEqual(dbArgs["db_url"], "sqlite:///" + self.workspace.dbLocation)
@patchApPipeGen3
- def testrunApPipeGen3WorkspaceCustom(self, mockDb):
+ def testrunApPipeGen3WorkspaceCustom(self, _mockPipe, mockDb):
"""Test that runApPipeGen3 places a database in the specified location.
"""
self.apPipeArgs.db = "postgresql://somebody@pgdb.misc.org/custom_db"
@@ -124,20 +101,14 @@ def testrunApPipeGen3WorkspaceCustom(self, mockDb):
self.assertIn("db_url", dbArgs)
self.assertEqual(dbArgs["db_url"], self.apPipeArgs.db)
- def testrunApPipeGen3Reuse(self):
+ @patchApPipeGen3
+ def testrunApPipeGen3Reuse(self, mockPipe, _mockDb):
"""Test that runApPipeGen3 does not run the pipeline at all (not even with
--skip-existing) if --skip-pipeline is provided.
"""
skipArgs = pipeline_driver.ApPipeParser().parse_args(["--skip-pipeline"])
pipeline_driver.runApPipeGen3(self.workspace, skipArgs)
-
- # Use datasets as a proxy for pipeline completion.
- # Depending on the overall test setup, the dataset may or may not be
- # registered if the pipeline didn't run; check both cases.
- id = _getDataIds(self.workspace.analysisButler)[0]
- calexpQuery = set(self.workspace.analysisButler.registry.queryDatasetTypes("calexp"))
- calexpExists = len(calexpQuery) > 0
- self.assertFalse(calexpExists and self.workspace.analysisButler.exists("calexp", id))
+ mockPipe.assert_not_called()
class MemoryTester(lsst.utils.tests.MemoryTestCase):
diff --git a/tests/test_testPipeline.py b/tests/test_testPipeline.py
deleted file mode 100644
index 133d9911..00000000
--- a/tests/test_testPipeline.py
+++ /dev/null
@@ -1,423 +0,0 @@
-#
-# 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 .
-#
-
-import shutil
-import tempfile
-import unittest
-
-import pandas
-
-import lsst.utils.tests
-import lsst.geom
-import lsst.afw.image as afwImage
-import lsst.afw.math as afwMath
-import lsst.afw.table as afwTable
-import lsst.skymap
-from lsst.daf.butler import Timespan
-import lsst.daf.butler.tests as butlerTests
-from lsst.meas.base import IdGenerator
-import lsst.pipe.base.testUtils as pipelineTests
-from lsst.pipe.base.utils import RegionTimeInfo
-from lsst.ap.verify.testPipeline import MockIsrTask, MockCharacterizeImageTask, \
- MockCalibrateTask, MockGetTemplateTask, \
- MockAlardLuptonSubtractTask, MockDetectAndMeasureTask, MockTransformDiaSourceCatalogTask, \
- MockRBTransiNetTask, MockDiaPipelineTask, MockFilterDiaSourceCatalogTask, \
- MockSpatiallySampledMetricsTask, MockLoadDiaCatalogsTask
-
-
-class MockTaskTestSuite(unittest.TestCase):
- """Test that mock tasks have the correct inputs and outputs for the task
- they are replacing.
-
- These tests assume that the mock tasks use real config and connection
- classes, and therefore out-of-date mocks won't match their connections.
- """
-
- @classmethod
- def setUpClass(cls):
- super().setUpClass()
-
- repoDir = tempfile.mkdtemp()
- cls.addClassCleanup(shutil.rmtree, repoDir, ignore_errors=True)
- cls.repo = butlerTests.makeTestRepo(repoDir)
-
- INSTRUMENT = "DummyCam"
- VISIT = 42
- GROUP = '42'
- CCD = 101
- HTM = 42
- SKYMAP = "TreasureMap"
- TRACT = 28
- PATCH = 4
- BAND = 'k'
- PHYSICAL = 'k2022'
- SUB_FILTER = 9
- # Mock instrument by hand, because some tasks care about parameters
- instrumentRecord = cls.repo.dimensions["instrument"].RecordClass(
- name=INSTRUMENT, visit_max=256, exposure_max=256, detector_max=128,
- class_name="lsst.obs.base.instrument_tests.DummyCam",
- )
- cls.repo.registry.syncDimensionData("instrument", instrumentRecord)
- butlerTests.addDataIdValue(cls.repo, "physical_filter", PHYSICAL, band=BAND)
- butlerTests.addDataIdValue(cls.repo, "subfilter", SUB_FILTER)
- butlerTests.addDataIdValue(cls.repo, "exposure", VISIT)
- butlerTests.addDataIdValue(cls.repo, "visit", VISIT)
- butlerTests.addDataIdValue(cls.repo, "group", GROUP)
- butlerTests.addDataIdValue(cls.repo, "detector", CCD)
- butlerTests.addDataIdValue(cls.repo, "skymap", SKYMAP)
- butlerTests.addDataIdValue(cls.repo, "tract", TRACT)
- butlerTests.addDataIdValue(cls.repo, "patch", PATCH)
-
- cls.emptyId = cls.repo.registry.expandDataId({})
- cls.exposureId = cls.repo.registry.expandDataId(
- {"instrument": INSTRUMENT, "exposure": VISIT, "detector": CCD})
- cls.visitId = cls.repo.registry.expandDataId(
- {"instrument": INSTRUMENT, "visit": VISIT, "detector": CCD})
- cls.groupId = cls.repo.registry.expandDataId(
- {"instrument": INSTRUMENT, "group": GROUP, "detector": CCD})
- cls.visitOnlyId = cls.repo.registry.expandDataId(
- {"instrument": INSTRUMENT, "visit": VISIT})
- cls.skymapId = cls.repo.registry.expandDataId({"skymap": SKYMAP})
- cls.skymapVisitId = cls.repo.registry.expandDataId(
- {"instrument": INSTRUMENT, "visit": VISIT, "detector": CCD, "skymap": SKYMAP})
- cls.patchId = cls.repo.registry.expandDataId(
- {"skymap": SKYMAP, "tract": TRACT, "patch": PATCH, "band": BAND})
- cls.subfilterId = cls.repo.registry.expandDataId(
- {"skymap": SKYMAP, "tract": TRACT, "patch": PATCH, "band": BAND, "subfilter": SUB_FILTER})
- cls.htmId = cls.repo.registry.expandDataId({"htm7": HTM})
-
- butlerTests.addDatasetType(cls.repo, "regionTimeInfo", cls.groupId.dimensions, "RegionTimeInfo")
- butlerTests.addDatasetType(cls.repo, "preloaded_diaObjects", cls.groupId.dimensions, "DataFrame")
- butlerTests.addDatasetType(cls.repo, "preloaded_diaSources", cls.groupId.dimensions, "DataFrame")
- butlerTests.addDatasetType(cls.repo, "preloaded_diaForcedSources", cls.groupId.dimensions,
- "DataFrame")
- butlerTests.addDatasetType(cls.repo, "postISRCCD", cls.exposureId.dimensions, "Exposure")
- butlerTests.addDatasetType(cls.repo, "icExp", cls.visitId.dimensions, "ExposureF")
- butlerTests.addDatasetType(cls.repo, "icSrc", cls.visitId.dimensions, "SourceCatalog")
- butlerTests.addDatasetType(cls.repo, "icExpBackground", cls.visitId.dimensions, "Background")
- butlerTests.addDatasetType(cls.repo, "gaia_dr3_20230707", cls.htmId.dimensions, "SimpleCatalog")
- butlerTests.addDatasetType(cls.repo, "ps1_pv3_3pi_20170110", cls.htmId.dimensions, "SimpleCatalog")
- butlerTests.addDatasetType(cls.repo, "calexp", cls.visitId.dimensions, "ExposureF")
- butlerTests.addDatasetType(cls.repo, "src", cls.visitId.dimensions, "SourceCatalog")
- butlerTests.addDatasetType(cls.repo, "calexpBackground", cls.visitId.dimensions, "Background")
- butlerTests.addDatasetType(cls.repo, "srcMatch", cls.visitId.dimensions, "Catalog")
- butlerTests.addDatasetType(cls.repo, "srcMatchFull", cls.visitId.dimensions, "Catalog")
- butlerTests.addDatasetType(cls.repo, lsst.skymap.BaseSkyMap.SKYMAP_DATASET_TYPE_NAME,
- cls.skymapId.dimensions, "SkyMap")
- butlerTests.addDatasetType(cls.repo, "goodSeeingCoadd", cls.patchId.dimensions, "ExposureF")
- butlerTests.addDatasetType(cls.repo, "deepDiff_differenceExp", cls.visitId.dimensions, "ExposureF")
- butlerTests.addDatasetType(cls.repo, "deepDiff_differenceTempExp", cls.visitId.dimensions,
- "ExposureF")
- butlerTests.addDatasetType(cls.repo, "deepDiff_templateExp", cls.visitId.dimensions, "ExposureF")
- butlerTests.addDatasetType(cls.repo, "goodSeeingDiff_templateExp", cls.visitId.dimensions,
- "ExposureF")
- butlerTests.addDatasetType(cls.repo, "deepDiff_psfMatchKernel", cls.visitId.dimensions,
- "MatchingKernel")
- butlerTests.addDatasetType(cls.repo, "deepDiff_matchedExp", cls.visitId.dimensions, "ExposureF")
- butlerTests.addDatasetType(cls.repo, "deepDiff_diaSrc", cls.visitId.dimensions, "SourceCatalog")
- butlerTests.addDatasetType(cls.repo, "deepDiff_diaSrcTable", cls.visitId.dimensions, "DataFrame")
- butlerTests.addDatasetType(cls.repo, "deepDiff_spatiallySampledMetrics", cls.visitId.dimensions,
- "ArrowAstropy")
- butlerTests.addDatasetType(cls.repo, "deepDiff_candidateDiaSrc", cls.visitId.dimensions,
- "SourceCatalog")
- butlerTests.addDatasetType(cls.repo, "visitSsObjects", cls.visitOnlyId.dimensions, "DataFrame")
- butlerTests.addDatasetType(cls.repo, "apdb_marker", cls.visitId.dimensions, "Config")
- butlerTests.addDatasetType(cls.repo, "deepDiff_assocDiaSrc", cls.visitId.dimensions, "DataFrame")
- butlerTests.addDatasetType(cls.repo, "deepDiff_longTrailedSrc", cls.visitId.dimensions,
- "ArrowAstropy")
- butlerTests.addDatasetType(cls.repo, "deepRealBogusSources", cls.visitId.dimensions, "Catalog")
- butlerTests.addDatasetType(cls.repo, "deepDiff_diaForcedSrc", cls.visitId.dimensions, "DataFrame")
- butlerTests.addDatasetType(cls.repo, "deepDiff_diaObject", cls.visitId.dimensions, "DataFrame")
-
- def setUp(self):
- super().setUp()
- self.butler = butlerTests.makeTestCollection(self.repo, uniqueId=self.id())
-
- def testMockLoadDiaCatalogsTask(self):
- config = MockLoadDiaCatalogsTask.ConfigClass()
- config.apdb_config_url = "testing_only"
- task = MockLoadDiaCatalogsTask(config=config)
- pipelineTests.assertValidInitOutput(task)
- region = lsst.sphgeom.Circle()
- timespan = Timespan.makeEmpty()
- result = task.run(RegionTimeInfo(region=region, timespan=timespan))
- pipelineTests.assertValidOutput(task, result)
-
- self.butler.put(RegionTimeInfo(region=region, timespan=timespan), "regionTimeInfo", self.groupId)
- quantum = pipelineTests.makeQuantum(
- task, self.butler, self.groupId,
- {"regionTime": self.groupId,
- "diaObjects": self.groupId,
- "diaSources": self.groupId,
- "diaForcedSources": self.groupId,
- })
- pipelineTests.runTestQuantum(task, self.butler, quantum, mockRun=False)
-
- def testMockIsr(self):
- # Testing MockIsrTask is tricky because the real ISR has an unstable
- # interface with dozens of potential inputs, too many to pass through
- # runTestQuantum. I don't see a good way to test the inputs;
- # fortunately, this is unlikely to matter for the overall goal of
- # testing ap_verify's interaction with the AP pipeline.
- task = MockIsrTask()
- pipelineTests.assertValidInitOutput(task)
- result = task.run(afwImage.ExposureF())
- pipelineTests.assertValidOutput(task, result)
- # Skip runTestQuantum
-
- def testMockCharacterizeImageTask(self):
- task = MockCharacterizeImageTask()
- pipelineTests.assertValidInitOutput(task)
- result = task.run(afwImage.ExposureF())
- pipelineTests.assertValidOutput(task, result)
-
- self.butler.put(afwImage.ExposureF(), "postISRCCD", self.exposureId)
- quantum = pipelineTests.makeQuantum(
- task, self.butler, self.visitId,
- {"exposure": self.exposureId,
- "characterized": self.visitId,
- "sourceCat": self.visitId,
- "backgroundModel": self.visitId,
- })
- pipelineTests.runTestQuantum(task, self.butler, quantum, mockRun=False)
-
- def testMockCalibrateTask(self):
- task = MockCalibrateTask()
- pipelineTests.assertValidInitOutput(task)
- # Even the real CalibrateTask won't pass assertValidOutput, because for
- # some reason the outputs are injected in runQuantum rather than run.
-
- self.butler.put(afwImage.ExposureF(), "icExp", self.visitId)
- self.butler.put(afwMath.BackgroundList(), "icExpBackground", self.visitId)
- self.butler.put(afwTable.SourceCatalog(), "icSrc", self.visitId)
- self.butler.put(afwTable.SimpleCatalog(), "gaia_dr3_20230707", self.htmId)
- self.butler.put(afwTable.SimpleCatalog(), "ps1_pv3_3pi_20170110", self.htmId)
- quantum = pipelineTests.makeQuantum(
- task, self.butler, self.visitId,
- {"exposure": self.visitId,
- "background": self.visitId,
- "icSourceCat": self.visitId,
- "astromRefCat": [self.htmId],
- "photoRefCat": [self.htmId],
- "outputExposure": self.visitId,
- "outputCat": self.visitId,
- "outputBackground": self.visitId,
- "matches": self.visitId,
- "matchesDenormalized": self.visitId,
- })
- pipelineTests.runTestQuantum(task, self.butler, quantum, mockRun=False)
-
- def testMockGetTemplateTask(self):
- task = MockGetTemplateTask()
- pipelineTests.assertValidInitOutput(task)
- result = task.run(coaddExposures=[afwImage.ExposureF()],
- bbox=lsst.geom.Box2I(),
- wcs=None, # Should not be allowed, but too hard to fake a SkyWcs
- dataIds=[],
- )
- pipelineTests.assertValidOutput(task, result)
-
- self.butler.put(afwImage.ExposureF(), "calexp", self.visitId)
- skymap = lsst.skymap.DiscreteSkyMap(lsst.skymap.DiscreteSkyMapConfig())
- self.butler.put(skymap, lsst.skymap.BaseSkyMap.SKYMAP_DATASET_TYPE_NAME, self.skymapId)
- self.butler.put(afwImage.ExposureF(), "goodSeeingCoadd", self.patchId)
- quantum = pipelineTests.makeQuantum(
- task, self.butler, self.skymapVisitId,
- {"bbox": self.visitId,
- "wcs": self.visitId,
- "skyMap": self.skymapId,
- "coaddExposures": [self.patchId],
- "template": self.visitId,
- })
- pipelineTests.runTestQuantum(task, self.butler, quantum, mockRun=False)
-
- def testMockAlardLuptonSubtractTask(self):
- task = MockAlardLuptonSubtractTask()
- pipelineTests.assertValidInitOutput(task)
- result = task.run(afwImage.ExposureF(), afwImage.ExposureF(), afwTable.SourceCatalog())
- pipelineTests.assertValidOutput(task, result)
-
- self.butler.put(afwImage.ExposureF(), "deepDiff_templateExp", self.visitId)
- self.butler.put(afwImage.ExposureF(), "calexp", self.visitId)
- self.butler.put(afwTable.SourceCatalog(), "src", self.visitId)
- quantum = pipelineTests.makeQuantum(
- task, self.butler, self.visitId,
- {"template": self.visitId,
- "science": self.visitId,
- "sources": self.visitId,
- "difference": self.visitId,
- "matchedTemplate": self.visitId,
- "psfMatchingKernel": self.visitId,
- })
- pipelineTests.runTestQuantum(task, self.butler, quantum, mockRun=False)
-
- def testMockDetectAndMeasureTask(self):
- task = MockDetectAndMeasureTask()
- pipelineTests.assertValidInitOutput(task)
- result = task.run(science=afwImage.ExposureF(),
- matchedTemplate=afwImage.ExposureF(),
- difference=afwImage.ExposureF(),
- )
- pipelineTests.assertValidOutput(task, result)
-
- self.butler.put(afwImage.ExposureF(), "calexp", self.visitId)
- self.butler.put(afwImage.ExposureF(), "deepDiff_matchedExp", self.visitId)
- self.butler.put(afwImage.ExposureF(), "deepDiff_differenceTempExp", self.visitId)
- self.butler.put(afwTable.SourceCatalog(), "src", self.visitId)
- quantum = pipelineTests.makeQuantum(
- task, self.butler, self.visitId,
- {"science": self.visitId,
- "matchedTemplate": self.visitId,
- "difference": self.visitId,
- "diaSources": self.visitId,
- "subtractedMeasuredExposure": self.visitId,
- })
- pipelineTests.runTestQuantum(task, self.butler, quantum, mockRun=False)
-
- def testMockFilterDiaSourceCatalogTask(self):
- visitInfo = afwImage.VisitInfo()
- task = MockFilterDiaSourceCatalogTask()
- pipelineTests.assertValidInitOutput(task)
- result = task.run(afwTable.SourceCatalog(), visitInfo)
- pipelineTests.assertValidOutput(task, result)
-
- def testMockSpatiallySampledMetricsTask(self):
- task = MockSpatiallySampledMetricsTask()
- result = task.run(
- afwImage.ExposureF(),
- afwImage.ExposureF(),
- afwImage.ExposureF(),
- afwImage.ExposureF(),
- afwTable.SourceCatalog(),
- afwMath.LinearCombinationKernel(),
- )
- pipelineTests.assertValidOutput(task, result)
-
- self.butler.put(afwImage.ExposureF(), "calexp", self.visitId)
- self.butler.put(afwImage.ExposureF(), "deepDiff_matchedExp", self.visitId)
- self.butler.put(afwImage.ExposureF(), "deepDiff_templateExp", self.visitId)
- self.butler.put(afwImage.ExposureF(), "deepDiff_differenceExp", self.visitId)
- self.butler.put(afwTable.SourceCatalog(), "deepDiff_candidateDiaSrc", self.visitId)
- self.butler.put(afwMath.LinearCombinationKernel(), "deepDiff_psfMatchKernel", self.visitId)
- quantum = pipelineTests.makeQuantum(
- task, self.butler, self.visitId,
- {"science": self.visitId,
- "matchedTemplate": self.visitId,
- "template": self.visitId,
- "difference": self.visitId,
- "diaSources": self.visitId,
- "psfMatchingKernel": self.visitId,
- "spatiallySampledMetrics": self.visitId,
- })
- pipelineTests.runTestQuantum(task, self.butler, quantum, mockRun=False)
-
- def testMockRBTransiNetTask(self):
- task = MockRBTransiNetTask()
- pipelineTests.assertValidInitOutput(task)
- result = task.run(template=afwImage.ExposureF(),
- science=afwImage.ExposureF(),
- difference=afwImage.ExposureF(),
- diaSources=afwTable.SourceCatalog(),
- )
- pipelineTests.assertValidOutput(task, result)
-
- self.butler.put(afwImage.ExposureF(), "calexp", self.visitId)
- self.butler.put(afwImage.ExposureF(), "deepDiff_differenceExp", self.visitId)
- self.butler.put(afwImage.ExposureF(), "deepDiff_templateExp", self.visitId)
- self.butler.put(afwTable.SourceCatalog(), "deepDiff_candidateDiaSrc", self.visitId)
- quantum = pipelineTests.makeQuantum(
- task, self.butler, self.visitId,
- {"template": self.visitId,
- "science": self.visitId,
- "difference": self.visitId,
- "diaSources": self.visitId,
- "pretrainedModel": self.emptyId,
- "classifications": self.visitId,
- })
- pipelineTests.runTestQuantum(task, self.butler, quantum, mockRun=False)
-
- def testMockTransformDiaSourceCatalogTask(self):
- task = MockTransformDiaSourceCatalogTask(initInputs=afwTable.SourceCatalog())
- pipelineTests.assertValidInitOutput(task)
- result = task.run(afwTable.SourceCatalog(), afwImage.ExposureF(), 'k')
- pipelineTests.assertValidOutput(task, result)
-
- self.butler.put(afwTable.SourceCatalog(), "deepDiff_candidateDiaSrc", self.visitId)
- self.butler.put(afwImage.ExposureF(), "deepDiff_differenceExp", self.visitId)
- quantum = pipelineTests.makeQuantum(
- task, self.butler, self.visitId,
- {"diaSourceCat": self.visitId,
- "diffIm": self.visitId,
- "diaSourceTable": self.visitId,
- })
- pipelineTests.runTestQuantum(task, self.butler, quantum, mockRun=False)
-
- def testMockDiaPipelineTask(self):
- config = MockDiaPipelineTask.ConfigClass()
- config.doConfigureApdb = False
- config.apdb_config_url = "testing_only"
- task = MockDiaPipelineTask(config=config)
- pipelineTests.assertValidInitOutput(task)
- result = task.run(pandas.DataFrame(), pandas.DataFrame(), afwImage.ExposureF(),
- afwImage.ExposureF(), afwImage.ExposureF(),
- pandas.DataFrame(), pandas.DataFrame(), pandas.DataFrame(),
- 'k', IdGenerator())
- pipelineTests.assertValidOutput(task, result)
-
- self.butler.put(pandas.DataFrame(), "preloaded_diaObjects", self.groupId)
- self.butler.put(pandas.DataFrame(), "preloaded_diaSources", self.groupId)
- self.butler.put(pandas.DataFrame(), "preloaded_diaForcedSources", self.groupId)
- self.butler.put(pandas.DataFrame(), "deepDiff_diaSrcTable", self.visitId)
- self.butler.put(pandas.DataFrame(), "visitSsObjects", self.visitId)
- self.butler.put(afwImage.ExposureF(), "deepDiff_differenceExp", self.visitId)
- self.butler.put(afwImage.ExposureF(), "calexp", self.visitId)
- self.butler.put(afwImage.ExposureF(), "deepDiff_templateExp", self.visitId)
- quantum = pipelineTests.makeQuantum(
- task, self.butler, self.visitId,
- {"diaSourceTable": self.visitId,
- "solarSystemObjectTable": self.visitId,
- "diffIm": self.visitId,
- "exposure": self.visitId,
- "template": self.visitId,
- "preloadedDiaObjects": self.groupId,
- "preloadedDiaSources": self.groupId,
- "preloadedDiaForcedSources": self.groupId,
- "apdbMarker": self.visitId,
- "associatedDiaSources": self.visitId,
- "diaForcedSources": self.visitId,
- "diaObjects": self.visitId,
- })
- pipelineTests.runTestQuantum(task, self.butler, quantum, mockRun=False)
-
-
-class MemoryTester(lsst.utils.tests.MemoryTestCase):
- pass
-
-
-def setup_module(module):
- lsst.utils.tests.init()
-
-
-if __name__ == "__main__":
- lsst.utils.tests.init()
- unittest.main()
diff --git a/ups/ap_verify.build b/ups/ap_verify.build
deleted file mode 100644
index 994ee85b..00000000
--- a/ups/ap_verify.build
+++ /dev/null
@@ -1,2 +0,0 @@
-@LSST BUILD@ &&
-build_lsst @PRODUCT@ @VERSION@ @REPOVERSION@
\ No newline at end of file
diff --git a/ups/ap_verify.cfg b/ups/ap_verify.cfg
deleted file mode 100644
index 4f9558de..00000000
--- a/ups/ap_verify.cfg
+++ /dev/null
@@ -1,12 +0,0 @@
-# -*- python -*-
-
-import lsst.sconsUtils
-
-dependencies = {
-}
-
-config = lsst.sconsUtils.Configuration(
- __file__,
- hasDoxygenInclude=False,
- hasSwigFiles=False,
-)
\ No newline at end of file
diff --git a/ups/ap_verify.table b/ups/ap_verify.table
index 24dbda7c..692cec1e 100644
--- a/ups/ap_verify.table
+++ b/ups/ap_verify.table
@@ -1,13 +1,12 @@
setupRequired(utils)
-setupRequired(afw)
setupRequired(verify)
setupRequired(ap_pipe)
setupRequired(ctrl_mpexec)
# For testing
setupOptional(ap_verify_testdata)
-setupOptional(obs_lsst)
+setupOptional(obs_lsst) # NOT declared by ap_verify_testdata
# For default metric configs
setupRequired(ip_diffim)