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
Conversation
python/lsst/ip/diffim/getTemplate.py
Outdated
default=10, | ||
doc="Number of pixels to grow the requested template image to account for warping" | ||
) | ||
coaddName = pexConfig.Field( |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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.
python/lsst/ip/diffim/getTemplate.py
Outdated
# SkyMap only needed for filtering without | ||
inputs.pop('skyMap') | ||
outputs = self.run(**inputs) | ||
coaddExposuresRefs, patchList = self.getOverlappingExposures(inputs['coaddExposures'], |
There was a problem hiding this comment.
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 actualexposures
(not deferredDatasetHandles). (6 patches is an acceptable number to have in memory) - Keep
run
responsible for just the warping +CoaddPsf
construction part.
python/lsst/ip/diffim/getTemplate.py
Outdated
finalBBox = bbox | ||
tempBBox = geom.Box2I(bbox.getBegin(), bbox.getDimensions()) |
There was a problem hiding this comment.
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.
615a0fe
to
bd644a5
Compare
python/lsst/ip/diffim/getTemplate.py
Outdated
@@ -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"]: |
There was a problem hiding this comment.
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 "
.
python/lsst/ip/diffim/getTemplate.py
Outdated
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) |
There was a problem hiding this comment.
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
.
python/lsst/ip/diffim/getTemplate.py
Outdated
ConfigClass = GetDcrTemplateConfig | ||
_DefaultName = "getDcrTemplateTask" | ||
|
||
def __init__(self, *args, **kwargs): |
There was a problem hiding this comment.
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
python/lsst/ip/diffim/getTemplate.py
Outdated
|
||
class GetDcrTemplateTask(GetTemplateTask): | ||
ConfigClass = GetDcrTemplateConfig | ||
_DefaultName = "getDcrTemplateTask" |
There was a problem hiding this comment.
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"
python/lsst/ip/diffim/getTemplate.py
Outdated
_DefaultName = "getMultiTractCoaddTemplateTask" | ||
class GetTemplateTask(pipeBase.PipelineTask): | ||
ConfigClass = GetTemplateConfig | ||
_DefaultName = "getTemplateTask" |
There was a problem hiding this comment.
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"
python/lsst/ip/diffim/getTemplate.py
Outdated
super().__init__(*args, **kwargs) | ||
|
||
def getOverlappingExposures(self, inputs): | ||
"""Return list of coaddExposure DeferredDatasetHandles that overlap detector |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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.
bd644a5
to
af55a3d
Compare
This PR changes the name of
GetMultiTractCoaddTemplateTask
to be simplyGetTemplateTask
, adds support for creating templates from DCR coadds, and adds deprecation warnings to tasks with the old names (which inherit from the new tasks).