Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-26553: Create gen3 unittests and test CreateApFakes pipeline tasks on data. #409

Merged
merged 3 commits into from
Sep 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions python/lsst/pipe/tasks/insertFakes.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class InsertFakesConnections(PipelineTaskConnections, defaultTemplates={"CoaddNa
fakeCat = cT.Input(
doc="Catalog of fake sources to draw inputs from.",
name="{CoaddName}Coadd_fakeSourceCat",
storageClass="Parquet",
storageClass="DataFrame",
dimensions=("tract", "skymap")
)

Expand Down Expand Up @@ -336,7 +336,7 @@ def run(self, fakeCat, image, wcs, photoCalib):

fakeCat = self.addPixCoords(fakeCat, wcs)
fakeCat = self.trimFakeCat(fakeCat, image, wcs)
band = image.getFilter().getName()
band = image.getFilter().getCanonicalName()[0]
psf = image.getPsf()
pixelScale = wcs.getPixelScale().asArcseconds()

Expand Down Expand Up @@ -369,7 +369,6 @@ def run(self, fakeCat, image, wcs, photoCalib):

image = self.addFakeSources(image, galImages, "galaxy")
image = self.addFakeSources(image, starImages, "star")

elif len(fakeCat) == 0 and self.config.doProcessAllDataIds:
self.log.warn("No fakes found for this dataRef; processing anyway.")
else:
Expand Down
27 changes: 17 additions & 10 deletions python/lsst/pipe/tasks/processCcdWithFakes.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
__all__ = ["ProcessCcdWithFakesConfig", "ProcessCcdWithFakesTask"]


class ProcessCcdWithFakesConnections(PipelineTaskConnections, dimensions=("instrument", "visit", "detector"),
class ProcessCcdWithFakesConnections(PipelineTaskConnections,
dimensions=("skymap", "tract", "instrument", "visit", "detector"),
defaultTemplates={"CoaddName": "deep"}):

exposure = cT.Input(
Expand All @@ -52,36 +53,36 @@ class ProcessCcdWithFakesConnections(PipelineTaskConnections, dimensions=("instr
fakeCat = cT.Input(
doc="Catalog of fake sources to draw inputs from.",
name="{CoaddName}Coadd_fakeSourceCat",
storageClass="Parquet",
storageClass="DataFrame",
dimensions=("tract", "skymap")
Comment on lines 53 to 57
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sr525, just to make sure, is it ok for the Gen 3 code to only take a tract-level *Coadd_fakeSourceCat, and not a detector-level fakeSourceCat? That seems to be the only substantial difference between the Gen 2 and Gen 3 versions of the task at the moment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, so I get what you're asking now. The catalogs are not different in how they are stored really. Both will be at the tract level, they just have different fluxes for the visit data vs coadd data.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not? The visit level catalogues are needed for the variable sources, where the current way of using them is to make a catalogue specific to each calexp.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait so are you saying we are going to produce specific catalogs for each ccdVisit vs cutting out the sources from a tract level catalog?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, this conversation doesn't seem to be continuing so I'm going to go ahead and merge the ticket.

)

wcs = cT.Input(
doc="WCS information for the input exposure.",
name="jointcal_wcs",
storageClass="Wcs",
dimensions=("Tract", "SkyMap", "Instrument", "Visit", "Detector")
dimensions=("tract", "skymap", "instrument", "visit", "detector")
)

photoCalib = cT.Input(
doc="Calib information for the input exposure.",
name="jointcal_photoCalib",
storageClass="PhotoCalib",
dimensions=("Tract", "SkyMap", "Instrument", "Visit", "Detector")
dimensions=("tract", "skymap", "instrument", "visit", "detector")
)

icSourceCat = cT.Input(
doc="Catalog of calibration sources",
name="icSrc",
storageClass="sourceCatalog",
dimensions=("tract", "skymap", "instrument", "visit", "detector")
storageClass="SourceCatalog",
dimensions=("instrument", "visit", "detector")
)

sfdSourceCat = cT.Input(
doc="Catalog of calibration sources",
name="src",
storageClass="sourceCatalog",
dimensions=("tract", "skymap", "instrument", "visit", "detector")
storageClass="SourceCatalog",
dimensions=("instrument", "visit", "detector")
)

outputExposure = cT.Output(
Expand All @@ -98,6 +99,13 @@ class ProcessCcdWithFakesConnections(PipelineTaskConnections, dimensions=("instr
dimensions=("instrument", "visit", "detector"),
)
kfindeisen marked this conversation as resolved.
Show resolved Hide resolved

def __init__(self, *, config=None):
super().__init__(config=config)

if not config.useUpdatedCalibs:
self.inputs.remove("wcs")
self.inputs.remove("photoCalib")


class ProcessCcdWithFakesConfig(PipelineTaskConfig,
pipelineConnections=ProcessCcdWithFakesConnections):
Expand Down Expand Up @@ -251,9 +259,8 @@ def runQuantum(self, butlerQC, inputRefs, outputRefs):
expId, expBits = butlerQC.quantum.dataId.pack("visit_detector", returnMaxBits=True)
inputs['exposureIdInfo'] = ExposureIdInfo(expId, expBits)

if inputs["wcs"] is None:
if self.config.useUpdatedCalibs:
inputs["wcs"] = inputs["image"].getWcs()
if inputs["photoCalib"] is None:
inputs["photoCalib"] = inputs["image"].getPhotoCalib()

outputs = self.run(**inputs)
Expand Down