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-2639: {{Standardize primary method names, run/runDataRef, across PipeTasks}} #39

Merged
merged 1 commit into from
Aug 3, 2018
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
4 changes: 2 additions & 2 deletions python/lsst/meas/mosaic/calibrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def _makeArgumentParser(cls):
ContainerClass=PerTractCcdDataIdContainer)
return parser

def run(self, dataRef):
def runDataRef(self, dataRef):
catalog = dataRef.get("src", immediate=True)
calexp_md = dataRef.get('calexp_md', immediate=True)
# Check if we are looking at HSC stack outputs
Expand Down Expand Up @@ -59,7 +59,7 @@ def _makeArgumentParser(cls):
ContainerClass=PerTractCcdDataIdContainer)
return parser

def run(self, dataRef):
def runDataRef(self, dataRef):
results = applyMosaicResultsExposure(dataRef)
dataRef.put(results.exposure, "calibrated_exp")

Expand Down
6 changes: 3 additions & 3 deletions python/lsst/meas/mosaic/checkMosaicTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ def writeCatalog(self, allSource, wcsDic, calibDic, ffpDic):
outHdu.writeto("catalog_check.fits", clobber=True)


def check(self, dataRefList, ct=None, debug=False, verbose=False):
def run(self, dataRefList, ct=None, debug=False, verbose=False):
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't you also need to update the call to self.check(...), below?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. Amended the commit to include this.

ccdSet = self.readCcd(dataRefList)
self.removeNonExistCcd(dataRefList, ccdSet)

Expand Down Expand Up @@ -548,7 +548,7 @@ def check(self, dataRefList, ct=None, debug=False, verbose=False):
self.plotPosAsMag(m0_s, dx_s, dy_s)
self.writeCatalog(allSource, wcsDic, calibDic, ffpDic)

def run(self, camera, butler, tract, dataRefList, debug):
def runDataRef(self, dataRefList, camera, butler, tract, debug):

colorterms = ColortermLibrary()
name = os.path.join(os.environ["OBS_SUBARU_DIR"], "config", camera, "colorterms.py")
Expand All @@ -566,7 +566,7 @@ def run(self, camera, butler, tract, dataRefList, debug):

ct = colorterms.getColorterm(butler.mapper.filters[filters[0]], self.config.photoCatName)

return self.check(dataRefList, ct, debug)
return self.run(dataRefList, ct, debug)

if __name__ == '__main__':

Expand Down
25 changes: 13 additions & 12 deletions python/lsst/meas/mosaic/mosaicTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@
class MosaicRunner(pipeBase.TaskRunner):
"""Subclass of TaskRunner for MosaicTask

MosaicTask.run() takes a number of arguments, one of which is a list of dataRefs
extracted from the command line (whereas most CmdLineTasks' run methods take
MosaicTask.runDataRef() takes a number of arguments, one of which is a list of dataRefs
extracted from the command line (whereas most CmdLineTasks' runDataRef methods take
single dataRef, are are called repeatedly). This class transforms the processed
arguments generated by the ArgumentParser into the arguments expected by
MosaicTask.run().
MosaicTask.runDataRef().

See pipeBase.TaskRunner for more information, but note that the multiprocessing
code path does not apply, because MosaicTask.canMultiprocess == False.
Expand All @@ -63,10 +63,10 @@ def getTargetList(parsedCmd, **kwargs):
for ref in parsedCmd.id.refList:
refListDict.setdefault(ref.dataId["tract"], []).append(ref)
# we call run() once with each tract
return [(parsedCmd.camera,
return [(refListDict[tract],
parsedCmd.camera,
parsedCmd.butler,
tract,
refListDict[tract],
parsedCmd.debug,
parsedCmd.diagDir,
parsedCmd.diagnostics,
Expand All @@ -77,7 +77,7 @@ def getTargetList(parsedCmd, **kwargs):

def __call__(self, args):
task = self.TaskClass(config=self.config, log=self.log)
result = task.run(*args)
result = task.runDataRef(*args)
return pipeBase.Struct(exitStatus=0)

class MosaicConfig(pexConfig.Config):
Expand Down Expand Up @@ -849,8 +849,8 @@ def checkOverlapWithTract(self, tractInfo, dataRefList, verbose=False):

return dataRefListOverlapWithTract, dataRefListToUse

def mosaic(self, dataRefList, tractInfo, ct=None, debug=False, diagDir=".",
diagnostics=False, snapshots=False, numCoresForReadSource=1, readTimeout=9999, verbose=False):
def run(self, dataRefList, tractInfo, ct=None, debug=False, diagDir=".",
diagnostics=False, snapshots=False, numCoresForReadSource=1, readTimeout=9999, verbose=False):

self.log.info(str(self.config))

Expand Down Expand Up @@ -1025,8 +1025,9 @@ def mosaic(self, dataRefList, tractInfo, ct=None, debug=False, diagDir=".",
return list(wcsDic.keys())


def run(self, camera, butler, tract, dataRefList, debug, diagDir=".",
diagnostics=False, snapshots=False, numCoresForReadSource=1, readTimeout=9999, verbose=False):
def runDataRef(self, dataRefList, camera, butler, tract, debug, diagDir=".",
diagnostics=False, snapshots=False, numCoresForReadSource=1,
readTimeout=9999, verbose=False):
self.log.info("Running self-calibration for tract %d" % tract)
skyMap = butler.get("deepCoadd_skyMap", immediate=True)
tractInfo = skyMap[tract]
Expand All @@ -1050,5 +1051,5 @@ def run(self, camera, butler, tract, dataRefList, debug, diagDir=".",
ct = None
self.log.info("Not applying color term")

return self.mosaic(dataRefList, tractInfo, ct, debug, diagDir, diagnostics, snapshots,
numCoresForReadSource, readTimeout, verbose)
return self.run(dataRefList, tractInfo, ct, debug, diagDir, diagnostics, snapshots,
numCoresForReadSource, readTimeout, verbose)