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-33745: Refactor getTemplate pipelineTask #211

Merged
merged 2 commits into from Mar 25, 2022
Merged

Conversation

isullivan
Copy link
Contributor

This PR changes the name of GetMultiTractCoaddTemplateTask to be simply GetTemplateTask, adds support for creating templates from DCR coadds, and adds deprecation warnings to tasks with the old names (which inherit from the new tasks).

default=10,
doc="Number of pixels to grow the requested template image to account for warping"
)
coaddName = pexConfig.Field(
Copy link
Contributor

Choose a reason for hiding this comment

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

You can delete the configs coaddName and warpType now. In Gen3 they are templates in the connection names, not configs.

pass


class GetMultiTractCoaddTemplateTask(GetTemplateTask):
Copy link
Contributor

Choose a reason for hiding this comment

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

Would you also do a search the stack for GetMultiTractCoaddTemplateTask and replace our invocations of it too? I know you'll find it in ap_pipe and drp_pipe. Without that, this will just add warnings to our logs.

# SkyMap only needed for filtering without
inputs.pop('skyMap')
outputs = self.run(**inputs)
coaddExposuresRefs, patchList = self.getOverlappingExposures(inputs['coaddExposures'],
Copy link
Contributor

Choose a reason for hiding this comment

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

You free for paircoding tomorrow? I have an idea:

  • Have getOverlappingExposures take the deferredDatasetHandles, construct the DCR models, and return actual exposures (not deferredDatasetHandles). (6 patches is an acceptable number to have in memory)
  • Keep run responsible for just the warping + CoaddPsf construction part.

finalBBox = bbox
tempBBox = geom.Box2I(bbox.getBegin(), bbox.getDimensions())
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious why you changed the template to have the bbox of the original calexp bbox rather the grown one.

@isullivan isullivan force-pushed the tickets/DM-33745 branch 2 times, most recently from 615a0fe to bd644a5 Compare March 23, 2022 23:19
@@ -582,7 +573,8 @@ def getOverlappingExposures(self, inputs):
detectorPolygon = geom.Box2D(inputs['bbox'])
overlappingArea = 0
coaddExposureList = []
for coaddRef in inputs['coaddExposures']:
dataIds = []
for coaddRef in inputs["coaddExposures"]:
Copy link
Contributor

Choose a reason for hiding this comment

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

The only difference on this line is ' to ".

continue

exp = afwImage.ExposureF(finalBBox, finalWcs)
exp.maskedImage.set(np.nan, afwImage.Mask.getPlaneBitMask("NO_DATA"), np.nan)
exp.maskedImage.assign(warped.maskedImage, warped.getBBox())
warpedBBox = warped.getBBox()
warpedBBox.clip(finalBBox)
Copy link
Contributor

Choose a reason for hiding this comment

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

These 2 added lines (and mod one line under) are not necessary: warpExposure clips the destination BBox to the maxBBox=finalBBox.

ConfigClass = GetDcrTemplateConfig
_DefaultName = "getDcrTemplateTask"

def __init__(self, *args, **kwargs):
Copy link
Contributor

Choose a reason for hiding this comment

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

This __init__ method does nothing more than its parent


class GetDcrTemplateTask(GetTemplateTask):
ConfigClass = GetDcrTemplateConfig
_DefaultName = "getDcrTemplateTask"
Copy link
Contributor

Choose a reason for hiding this comment

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

My fault for including the Task in the original getTemplate Tasks. Should be _DefaultName = "getDcrTemplate"

_DefaultName = "getMultiTractCoaddTemplateTask"
class GetTemplateTask(pipeBase.PipelineTask):
ConfigClass = GetTemplateConfig
_DefaultName = "getTemplateTask"
Copy link
Contributor

Choose a reason for hiding this comment

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

My fault for including the Task in the original getTemplate Tasks' DefaultName. Should be _DefaultName = "getTemplate"

super().__init__(*args, **kwargs)

def getOverlappingExposures(self, inputs):
"""Return list of coaddExposure DeferredDatasetHandles that overlap detector
Copy link
Contributor

Choose a reason for hiding this comment

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

Agh, we made this summary doc string not true anymore. How about "Return coadds that overlap detector" or if you want a longer one: "Return lists of coadds and their corresponding dataIds that overlap the detector"

for this one and the parent's getOverlappingExposures too

@@ -644,31 +634,32 @@ def run(self, coaddExposures, bbox, wcs):
maskedImageList = []
weightList = []

for coaddExposure in coaddExposures:
coaddPatch = coaddExposure.get()
for coaddExposure, dataId in zip(coaddExposures, dataIds):
Copy link
Contributor

Choose a reason for hiding this comment

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

calling it coaddExposure instead of coaddPatch adds 7 extra lines to your PR.

@isullivan isullivan merged commit 7800087 into main Mar 25, 2022
@isullivan isullivan deleted the tickets/DM-33745 branch March 25, 2022 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants