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

Make coadd template warp type configurable #75

Merged
merged 1 commit into from
Sep 22, 2017
Merged
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
20 changes: 19 additions & 1 deletion python/lsst/ip/diffim/getTemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ class GetCoaddAsTemplateConfig(pexConfig.Config):
dtype=str,
default="deep",
)
warpType = pexConfig.Field(
doc="Warp type of the coadd template: one of 'direct' or 'psfMatched'",
dtype=str,
default="direct",
)


class GetCoaddAsTemplateTask(pipeBase.Task):
Expand Down Expand Up @@ -100,7 +105,7 @@ def run(self, exposure, sensorRef, templateIdList=None):
patchSubBBox = patchInfo.getOuterBBox()
patchSubBBox.clip(coaddBBox)
patchArgDict = dict(
datasetType=self.config.coaddName + "Coadd_sub",
datasetType=self.getCoaddDatasetName() + "_sub",
bbox=patchSubBBox,
tract=tractInfo.getId(),
patch="%s,%s" % (patchInfo.getIndex()[0], patchInfo.getIndex()[1]),
Expand Down Expand Up @@ -135,6 +140,19 @@ def run(self, exposure, sensorRef, templateIdList=None):
return pipeBase.Struct(exposure=coaddExposure,
sources=None)

def getCoaddDatasetName(self):
"""Return coadd name for given task config

Returns
-------
CoaddDatasetName : `string`

TODO: This nearly duplicates a method in CoaddBaseTask (DM-11985)
"""
warpType = self.config.warpType
suffix = "" if warpType == "direct" else warpType[0].upper() + warpType[1:]
Copy link
Contributor

Choose a reason for hiding this comment

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

This is probably the most efficient way of doing this, but using warpType .title() would be more clear.

Copy link
Contributor Author

@yalsayyad yalsayyad Sep 22, 2017

Choose a reason for hiding this comment

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

Would have been more clear, if it did what I wanted.

>>> 'psfMatched'.title()
'Psfmatched'  :( 

Copy link
Contributor

Choose a reason for hiding this comment

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

Oops. Yes, I didn't realize that would un-capitalize letters in the rest of the word. Good catch.

return self.config.coaddName + "Coadd" + suffix


class GetCalexpAsTemplateConfig(pexConfig.Config):
doAddCalexpBackground = pexConfig.Field(
Expand Down