Skip to content

Commit

Permalink
Use InMemoryDatasetHandle for assemble coadd rather than special subc…
Browse files Browse the repository at this point in the history
…lass
  • Loading branch information
timj committed May 4, 2023
1 parent c902e61 commit ad3aa6a
Showing 1 changed file with 11 additions and 37 deletions.
48 changes: 11 additions & 37 deletions tests/assembleCoaddTestUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,40 +42,7 @@

from astro_metadata_translator import makeObservationInfo

__all__ = ["MockWarpReference", "makeMockSkyInfo", "MockCoaddTestData"]


class MockWarpReference(pipeBase.InMemoryDatasetHandle):
"""Very simple object that looks like a Gen 3 data reference to a warped
exposure.
Parameters
----------
exposure : `lsst.afw.image.Exposure`
The exposure to be retrieved by the data reference.
"""
def get(self, *, component=None, parameters=None):
"""Retrieve the specified dataset using the API of the Gen 3 Butler.
Parameters
----------
component : `str`, optional
If supplied, return the named metadata of the exposure.
parameters : `dict`, optional
If supplied, use the parameters to modify the exposure,
typically by taking a subset.
Returns
-------
`lsst.afw.image.Exposure` or `lsst.afw.image.VisitInfo`
or `lsst.meas.algorithms.SingleGaussianPsf`
Either the exposure or its metadata, depending on the component
requested.
"""
exp = super().get(component=component, parameters=parameters)
if isinstance(exp, afwImage.ExposureF):
exp = exp.clone()
return exp
__all__ = ["makeMockSkyInfo", "MockCoaddTestData"]


def makeMockSkyInfo(bbox, wcs, patch):
Expand Down Expand Up @@ -419,7 +386,7 @@ def makeDataRefList(exposures, matchedExposures, warpType, tract=0, patch=42, co
Returns
-------
dataRefList : `list` of `MockWarpReference`
dataRefList : `list` of `~lsst.pipe.base.InMemoryDatasetHandle`
The data references.
Raises
Expand All @@ -435,7 +402,14 @@ def makeDataRefList(exposures, matchedExposures, warpType, tract=0, patch=42, co
exposure = matchedExposures[expId]
else:
raise ValueError("warpType must be one of 'direct' or 'psfMatched'")
dataRef = MockWarpReference(exposure, storageClass="ExposureF",
tract=tract, patch=patch, visit=expId, coaddName=coaddName)
dataRef = pipeBase.InMemoryDatasetHandle(
exposure,
storageClass="ExposureF",
copy=True,
tract=tract,
patch=patch,
visit=expId,
coaddName=coaddName
)
dataRefList.append(dataRef)
return dataRefList

0 comments on commit ad3aa6a

Please sign in to comment.