Skip to content

Commit

Permalink
Make IsrTask a valid CmdLineTask.
Browse files Browse the repository at this point in the history
The IsrTask was not usable as a CmdLineTask, as it was written to be
called as a subtask of ProcessCcdTask.  This allows the default
IsrTask to be retargeted to camera-specific versions of the ISR
processing.  A new IsrWrapperTask now exists to hold IsrTask for
retargetting in standalone processing, and both processCcd.py and
runIsr.py now read from the same configuration files for each obs_
package.  This has involved migrating configuration values from
config/processCcd.py to config/isr.py for many obs_ packages.
  • Loading branch information
czwa committed Sep 10, 2018
1 parent cc4efb7 commit 7809aa2
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
26 changes: 26 additions & 0 deletions bin.src/runIsr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env python
#
# This file is part of ip_isr.
#
# Developed for the LSST Data Management System.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
# for details of code ownership.

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
from lsst.ip.isr.isrTask import IsrWrapperTask

IsrWrapperTask.parseAndRun()
47 changes: 47 additions & 0 deletions python/lsst/ip/isr/isrTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -1225,3 +1225,50 @@ def getSaturation(self):

def getSuspectLevel(self):
return float("NaN")


class IsrWrapperConfig(pexConfig.Config):
isr = pexConfig.ConfigurableField(target=IsrTask, doc="Instrument signature removal")

## @addtogroup LSST_task_documentation
## @{
## @page IsrWrapperTask
## @ref IsrWrapperTask_ "IsrWrapperTask"
## @copybrief IsrWrapperTask
## @}


class IsrWrapperTask(pipeBase.CmdLineTask):
"""Task to wrap the default IsrTask to allow it to be retargeted.
The standard IsrTask can be called directly from a command line
program, but doing so removes the ability of the task to be
retargeted. As most cameras override some set of the IsrTask
methods, this would remove those data-specific methods in the
output post-ISR images. This wrapping class fixes the issue,
allowing identical post-ISR images to be generated by both the
processCcd and isrTask code.
"""
ConfigClass = IsrWrapperConfig
_DefaultName = "isrWrap"

def __init__(self, *args, **kwargs):
pipeBase.Task.__init__(self, *args, **kwargs)
self.makeSubtask("isr")

def runDataRef(self, dataRef):
"""
Parameters
----------
dataRef : `lsst.daf.persistence.ButlerDataRef`
data reference of the detector data to be processed
Returns
-------
result : `pipeBase.Struct`
Result struct with component:
- exposure : `lsst.afw.image.Exposure`
Post-ISR processed exposure.
"""
return self.isr.runDataRef(dataRef)

0 comments on commit 7809aa2

Please sign in to comment.