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-10765: Replace existing WCS classes with SkyWcs #42

Merged
merged 8 commits into from
Feb 16, 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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ config.log
*.so
*.cfgc
*.pyc
.cache
pytest_session.txt
doc/html
doc/*.tag
doc/*.inc
Expand Down
6 changes: 4 additions & 2 deletions examples/exampleUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,10 @@ def makeFakeWcs():
'''!Make a wcs to put in an exposure
\return a Wcs object
'''
return afwImage.makeWcs(afwCoord.IcrsCoord(45.0*afwGeom.degrees, 45.0*afwGeom.degrees),
afwGeom.Point2D(0.0, 0.0), 1.0, 0.0, 0.0, 1.0)
return afwGeom.makeSkyWcs(crpix=afwGeom.Point2D(0.0, 0.0),
crval=afwCoord.IcrsCoord(45.0*afwGeom.degrees, 45.0*afwGeom.degrees),
cdMatrix=afwGeom.makeCdMatrix(scale=1.0*afwGeom.degrees),
)


def makeExpFromIm(im, detector):
Expand Down
94 changes: 47 additions & 47 deletions python/lsst/ip/isr/assembleCcdTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,30 +43,30 @@ class AssembleCcdConfig(pexConfig.Config):
default=(),
)

## \addtogroup LSST_task_documentation
## \{
## \page AssembleCcdTask
## \ref AssembleCcdTask_ "AssembleCcdTask"
## \copybrief AssembleCcdTask
## \}
## @addtogroup LSST_task_documentation
## @{
## @page AssembleCcdTask
## @ref AssembleCcdTask_ "AssembleCcdTask"
## @copybrief AssembleCcdTask
## @}


class AssembleCcdTask(pipeBase.Task):
"""!
\anchor AssembleCcdTask_
@anchor AssembleCcdTask_

\brief Assemble a set of amplifier images into a full detector size set of pixels.
@brief Assemble a set of amplifier images into a full detector size set of pixels.

\section ip_isr_assemble_Contents Contents
@section ip_isr_assemble_Contents Contents

- \ref ip_isr_assemble_Purpose
- \ref ip_isr_assemble_Initialize
- \ref ip_isr_assemble_IO
- \ref ip_isr_assemble_Config
- \ref ip_isr_assemble_Debug
- \ref ip_isr_assemble_Example
- @ref ip_isr_assemble_Purpose
- @ref ip_isr_assemble_Initialize
- @ref ip_isr_assemble_IO
- @ref ip_isr_assemble_Config
- @ref ip_isr_assemble_Debug
- @ref ip_isr_assemble_Example

\section ip_isr_assemble_Purpose Description
@section ip_isr_assemble_Purpose Description

This task assembles sections of an image into a larger mosaic. The sub-sections
are typically amplifier sections and are to be assembled into a detector size pixel grid.
Expand All @@ -75,61 +75,61 @@ class AssembleCcdTask(pipeBase.Task):
renormalize the pixel values to a nominal gain of 1. The task also removes exposure metadata that
has context in raw amps, but not in trimmed detectors (e.g. 'BIASSEC').

\section ip_isr_assemble_Initialize Task initialization
@section ip_isr_assemble_Initialize Task initialization

\copydoc \_\_init\_\_
@copydoc \_\_init\_\_

\section ip_isr_assemble_IO Inputs/Outputs to the assembleCcd method
@section ip_isr_assemble_IO Inputs/Outputs to the assembleCcd method

\copydoc assembleCcd
@copydoc assembleCcd

\section ip_isr_assemble_Config Configuration parameters
@section ip_isr_assemble_Config Configuration parameters

See \ref AssembleCcdConfig
See @ref AssembleCcdConfig

\section ip_isr_assemble_Debug Debug variables
@section ip_isr_assemble_Debug Debug variables

The \link lsst.pipe.base.cmdLineTask.CmdLineTask command line task\endlink interface supports a
flag \c -d to import \b debug.py from your \c PYTHONPATH; see <a
The @link lsst.pipe.base.cmdLineTask.CmdLineTask command line task@endlink interface supports a
flag @c -d to import @b debug.py from your @c PYTHONPATH; see <a
href="http://lsst-web.ncsa.illinois.edu/~buildbot/doxygen/x_masterDoxyDoc/base_debug.html">
Using lsstDebug to control debugging output</a> for more about \b debug.py files.
Using lsstDebug to control debugging output</a> for more about @b debug.py files.

The available variables in AssembleCcdTask are:
<DL>
<DT> \c display
<DT> @c display
<DD> A dictionary containing debug point names as keys with frame number as value. Valid keys are:
<DL>
<DT> assembledExposure
<DD> display assembled exposure
</DL>
</DL>

\section ip_isr_assemble_Example A complete example of using AssembleCcdTask
@section ip_isr_assemble_Example A complete example of using AssembleCcdTask

This code is in runAssembleTask.py in the examples directory, and can be run as \em e.g.
\code
This code is in runAssembleTask.py in the examples directory, and can be run as @em e.g.
@code
python examples/runAssembleTask.py
\endcode
@endcode

\dontinclude runAssembleTask.py
@dontinclude runAssembleTask.py
Import the task. There are other imports. Read the source file for more info.
\skipline AssembleCcdTask
@skipline AssembleCcdTask

\dontinclude exampleUtils.py
@dontinclude exampleUtils.py
Create some input images with the help of some utilities in examples/exampleUtils.py
\skip makeAssemblyInput
@skip makeAssemblyInput
@until inputData
The above numbers can be changed. The assumption that the readout corner is flipped on every other amp is
hardcoded in createDetector.

\dontinclude runAssembleTask.py
@dontinclude runAssembleTask.py
Run the assembler task
\skip runAssembler
@skip runAssembler
@until frame += 1

<HR>
To investigate the \ref ip_isr_assemble_Debug, put something like
\code{.py}
To investigate the @ref ip_isr_assemble_Debug, put something like
@code{.py}
import lsstDebug
def DebugInfo(name):
di = lsstDebug.getInfo(name) # N.b. lsstDebug.Info(name) would call us recursively
Expand All @@ -138,8 +138,8 @@ def DebugInfo(name):
return di

lsstDebug.Info = DebugInfo
\endcode
into your debug.py file and run runAssembleTask.py with the \c --debug flag.
@endcode
into your debug.py file and run runAssembleTask.py with the @c --debug flag.


Conversion notes:
Expand All @@ -160,20 +160,20 @@ def __init__(self, **kwargs):

def assembleCcd(self, assembleInput):
"""!Assemble a set of amps into a single CCD size image
\param[in] assembleInput -- Either a dictionary of amp lsst.afw.image.Exposures or a single
@param[in] assembleInput -- Either a dictionary of amp lsst.afw.image.Exposures or a single
lsst.afw.image.Exposure containing all raw
amps. If a dictionary of amp exposures,
the key should be the amp name.
\return assembledCcd -- An lsst.afw.image.Exposure of the assembled amp sections.
@return assembledCcd -- An lsst.afw.image.Exposure of the assembled amp sections.

\throws TypeError with the following string:
@throws TypeError with the following string:

<DL>
<DT> Expected either a dictionary of amp exposures or a single raw exposure
<DD> The input exposures to be assembled do not adhere to the required format.
</DL>

\throws RuntimeError with the following string:
@throws RuntimeError with the following string:

<DL>
<DT> No ccd detector found
Expand Down Expand Up @@ -267,5 +267,5 @@ def setWcs(self, outExposure, inExposure):
amp0 = ccd[0]
if amp0 is None:
raise RuntimeError("No amplifier detector information found")
cameraGeomUtils.prepareWcsData(wcs, amp0, isTrimmed=self.config.doTrim)
outExposure.setWcs(wcs)
adjustedWcs = cameraGeomUtils.prepareWcsData(wcs, amp0, isTrimmed=self.config.doTrim)
outExposure.setWcs(adjustedWcs)