LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
lsst.ip.isr.assembleCcdTask.AssembleCcdTask Class Reference

More...

Inheritance diagram for lsst.ip.isr.assembleCcdTask.AssembleCcdTask:

Public Member Functions

def __init__ (self, **kwargs)
 Initialize the AssembleCcdTask. More...
 
def assembleCcd (self, assembleInput)
 Assemble a set of amps into a single CCD size image. More...
 
def postprocessExposure (self, outExposure, inExposure)
 

Public Attributes

 allKeysToRemove
 

Static Public Attributes

 ConfigClass = AssembleCcdConfig
 

Detailed Description

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

Contents

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. The assembly is driven by the entries in the raw amp information. The task can be configured to return a detector image with non-data (e.g. overscan) pixels included. The task can also 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').

Task initialization

Initialize the AssembleCcdTask.

    The keys for removal specified in the config are added to a default set:
    ('DATASEC', 'BIASSEC', 'TRIMSEC', 'GAIN')

Inputs/Outputs to the assembleCcd method

Assemble a set of amps into a single CCD size image.

Parameters
[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.
Returns
assembledCcd – An lsst.afw.image.Exposure of the assembled amp sections.
Exceptions
TypeErrorwith the following string:
Expected either a dictionary of amp exposures or a single raw exposure
The input exposures to be assembled do not adhere to the required format.
Exceptions
RuntimeErrorwith the following string:
No ccd detector found
The detector set on the input exposure is not set.

Configuration parameters

See AssembleCcdConfig

Debug variables

The command line task interface supports a flag -d to import debug.py from your PYTHONPATH; see Debugging Tasks with lsstDebug for more about debug.py files.

The available variables in AssembleCcdTask are:

display
A dictionary containing debug point names as keys with frame number as value. Valid keys are:
assembledExposure
display assembled exposure

A complete example of using AssembleCcdTask


To investigate the Debug variables, put something like

import lsstDebug
def DebugInfo(name):
di = lsstDebug.getInfo(name) # N.b. lsstDebug.Info(name) would call us recursively
if name == "lsst.ip.isr.assembleCcdTask":
di.display = {'assembledExposure':2}
return di
lsstDebug.Info = DebugInfo

into your debug.py file and run runAssembleTask.py with the –debug flag.

Conversion notes:
    Display code should be updated once we settle on a standard way of controlling what is displayed.

Definition at line 53 of file assembleCcdTask.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.ip.isr.assembleCcdTask.AssembleCcdTask.__init__ (   self,
**  kwargs 
)

Initialize the AssembleCcdTask.

    The keys for removal specified in the config are added to a default set:
    ('DATASEC', 'BIASSEC', 'TRIMSEC', 'GAIN')

Definition at line 129 of file assembleCcdTask.py.

129  def __init__(self, **kwargs):
130  """!Initialize the AssembleCcdTask
131 
132  The keys for removal specified in the config are added to a default set:
133  ('DATASEC', 'BIASSEC', 'TRIMSEC', 'GAIN')
134  """
135  pipeBase.Task.__init__(self, **kwargs)
136 
137  self.allKeysToRemove = ('DATASEC', 'BIASSEC', 'TRIMSEC', 'GAIN') + tuple(self.config.keysToRemove)
138 

Member Function Documentation

◆ assembleCcd()

def lsst.ip.isr.assembleCcdTask.AssembleCcdTask.assembleCcd (   self,
  assembleInput 
)

Assemble a set of amps into a single CCD size image.

Parameters
[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.
Returns
assembledCcd – An lsst.afw.image.Exposure of the assembled amp sections.
Exceptions
TypeErrorwith the following string:
Expected either a dictionary of amp exposures or a single raw exposure
The input exposures to be assembled do not adhere to the required format.
Exceptions
RuntimeErrorwith the following string:
No ccd detector found
The detector set on the input exposure is not set.

Definition at line 139 of file assembleCcdTask.py.

139  def assembleCcd(self, assembleInput):
140  """!Assemble a set of amps into a single CCD size image
141  @param[in] assembleInput -- Either a dictionary of amp lsst.afw.image.Exposures or a single
142  lsst.afw.image.Exposure containing all raw
143  amps. If a dictionary of amp exposures,
144  the key should be the amp name.
145  @return assembledCcd -- An lsst.afw.image.Exposure of the assembled amp sections.
146 
147  @throws TypeError with the following string:
148 
149  <DL>
150  <DT> Expected either a dictionary of amp exposures or a single raw exposure
151  <DD> The input exposures to be assembled do not adhere to the required format.
152  </DL>
153 
154  @throws RuntimeError with the following string:
155 
156  <DL>
157  <DT> No ccd detector found
158  <DD> The detector set on the input exposure is not set.
159  </DL>
160  """
161  ccd = None
162  if isinstance(assembleInput, dict):
163  # assembleInput is a dictionary of amp name: amp exposure
164 
165  # Assume all amps have the same detector, so get the detector from an arbitrary amp
166  ccd = next(iter(assembleInput.values())).getDetector()
167 
168  def getNextExposure(amp):
169  return assembleInput[amp.getName()]
170  elif hasattr(assembleInput, "getMaskedImage"):
171  # assembleInput is a single exposure
172  ccd = assembleInput.getDetector()
173 
174  def getNextExposure(amp):
175  return assembleInput
176  else:
177  raise TypeError("Expected either a dictionary of amp exposures or a single raw exposure")
178 
179  if ccd is None:
180  raise RuntimeError("No ccd detector found")
181 
182  if not self.config.doTrim:
183  outBox = cameraGeomUtils.calcRawCcdBBox(ccd)
184  else:
185  outBox = ccd.getBBox()
186  outExposure = afwImage.ExposureF(outBox)
187  outMI = outExposure.getMaskedImage()
188 
189  if self.config.doTrim:
190  assemble = cameraGeom.assembleAmplifierImage
191  else:
192  assemble = cameraGeom.assembleAmplifierRawImage
193 
194  for amp in ccd:
195  inMI = getNextExposure(amp).getMaskedImage()
196  assemble(outMI, inMI, amp)
197  #
198  # If we are returning an "untrimmed" image (with overscans and extended register) we
199  # need to update the ampInfo table in the Detector as we've moved the amp images into
200  # place in a single Detector image
201  #
202  if not self.config.doTrim:
203  ccd = cameraGeom.makeUpdatedDetector(ccd)
204 
205  outExposure.setDetector(ccd)
206  self.postprocessExposure(outExposure=outExposure, inExposure=getNextExposure(ccd[0]))
207 
208  return outExposure
209 

◆ postprocessExposure()

def lsst.ip.isr.assembleCcdTask.AssembleCcdTask.postprocessExposure (   self,
  outExposure,
  inExposure 
)
Set exposure non-image attributes, including wcs and metadata and display exposure (if requested)

Call after assembling the pixels

@param[in,out]  outExposure assembled exposure:
                            - removes unwanted keywords
                            - sets wcs, filter, and detector
@param[in]      inExposure  input exposure

Definition at line 210 of file assembleCcdTask.py.

210  def postprocessExposure(self, outExposure, inExposure):
211  """Set exposure non-image attributes, including wcs and metadata and display exposure (if requested)
212 
213  Call after assembling the pixels
214 
215  @param[in,out] outExposure assembled exposure:
216  - removes unwanted keywords
217  - sets wcs, filter, and detector
218  @param[in] inExposure input exposure
219  """
220  if inExposure.hasWcs():
221  outExposure.setWcs(inExposure.getWcs())
222 
223  exposureMetadata = inExposure.getMetadata()
224  for key in self.allKeysToRemove:
225  if exposureMetadata.exists(key):
226  exposureMetadata.remove(key)
227  outExposure.setMetadata(exposureMetadata)
228 
229  # note: don't copy PhotoCalib, because it is assumed to be unknown in raw data
230  outExposure.info.id = inExposure.info.id
231  outExposure.setFilterLabel(inExposure.getFilterLabel())
232  outExposure.getInfo().setVisitInfo(inExposure.getInfo().getVisitInfo())
233 
234  frame = getDebugFrame(self._display, "assembledExposure")
235  if frame:
236  afwDisplay.Display(frame=frame).mtv(outExposure, title="postprocessExposure")
def mtv(data, frame=None, title="", wcs=None, *args, **kwargs)
Definition: ds9.py:92
def getDebugFrame(debugDisplay, name)
Definition: lsstDebug.py:95

Member Data Documentation

◆ allKeysToRemove

lsst.ip.isr.assembleCcdTask.AssembleCcdTask.allKeysToRemove

Definition at line 137 of file assembleCcdTask.py.

◆ ConfigClass

lsst.ip.isr.assembleCcdTask.AssembleCcdTask.ConfigClass = AssembleCcdConfig
static

Definition at line 126 of file assembleCcdTask.py.


The documentation for this class was generated from the following file: