LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Public Member Functions | Static Public Attributes | Static Private Attributes | List of all members
lsst.ip.isr.isrTask.IsrTask Class Reference

Apply common instrument signature correction algorithms to a raw frame. More...

Inheritance diagram for lsst.ip.isr.isrTask.IsrTask:

Public Member Functions

def __init__
 Constructor for IsrTask. More...
 
def readIsrData
 Retrieve necessary frames for instrument signature removal. More...
 
def run
 Perform instrument signature removal on an exposure. More...
 
def runDataRef
 Perform instrument signature removal on a ButlerDataRef of a Sensor. More...
 
def convertIntToFloat
 
def biasCorrection
 Apply bias correction in place. More...
 
def darkCorrection
 Apply dark correction in place. More...
 
def updateVariance
 Set the variance plane based on the image plane, plus amplifier gain and read noise. More...
 
def flatCorrection
 Apply flat correction in place. More...
 
def getIsrExposure
 Retrieve a calibration dataset for removing instrument signature. More...
 
def saturationDetection
 Detect saturated pixels and mask them using mask plane "SAT", in place. More...
 
def saturationInterpolation
 Interpolate over saturated pixels, in place. More...
 
def maskAndInterpDefect
 Mask defects using mask plane "BAD" and interpolate over them, in place. More...
 
def maskAndInterpNan
 Mask NaNs using mask plane "UNMASKEDNAN" and interpolate over them, in place. More...
 
def overscanCorrection
 Apply overscan correction, in place. More...
 

Static Public Attributes

 ConfigClass = IsrTaskConfig
 

Static Private Attributes

string _DefaultName = "isr"
 

Detailed Description

Apply common instrument signature correction algorithms to a raw frame.

Contents

Description

The process for correcting imaging data is very similar from camera to camera. This task provides a vanilla implementation of doing these corrections, including the ability to turn certain corrections off if they are not needed. The inputs to the primary method, run, are a raw exposure to be corrected and the calibration data products. The raw input is a single chip sized mosaic of all amps including overscans and other non-science pixels. The method runDataRef() is intended for use by a lsst.pipe.base.cmdLineTask.CmdLineTask and takes as input only a daf.persistence.butlerSubset.ButlerDataRef. This task may not meet all needs and it is expected that it will be subclassed for specific applications.

Task initialization

Constructor for IsrTask.

Parameters
[in]*args– a list of positional arguments passed on to the Task constructor
[in]**kwargs– a dictionary of keyword arguments passed on to the Task constructor Call the lsst.pipe.base.task.Task.__init__ method Then setup the assembly and fringe correction subtasks

Inputs/Outputs to the run method

Perform instrument signature removal on an exposure. Steps include:

Parameters
[in]ccdExposure– lsst.afw.image.exposure of detector data
[in]bias– exposure of bias frame
[in]dark– exposure of dark frame
[in]flat– exposure of flatfield
[in]defects– list of detects
[in]fringes– exposure of fringe frame or list of fringe exposure
Returns
a pipeBase.Struct with field:
  • exposure

Configuration parameters

See IsrTaskConfig

Debug variables

The command line task interface supports a flag –debug, -d to import debug.py from your PYTHONPATH; see Using lsstDebug to control debugging output for more about debug.py files.

The available variables in IsrTask are:

display
A dictionary containing debug point names as keys with frame number as value. Valid keys are:
postISRCCD
display exposure after ISR has been applied

For example, put something like

1 import lsstDebug
2 def DebugInfo(name):
3  di = lsstDebug.getInfo(name) # N.b. lsstDebug.Info(name) would call us recursively
4  if name == "lsst.ip.isr.isrTask":
5  di.display = {'postISRCCD':2}
6  return di
7 lsstDebug.Info = DebugInfo

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

A complete example of using IsrTask

This code is in runIsrTask.py in the examples directory and can be run as e.g.

1 python examples/runIsrTask.py
2 
3 # optional arguments:
4 # --debug, -d Load debug.py?
5 # --ds9 Display the result?
6 # --write Write the result?

Stepping through the example:

Import the task. There are other imports. Read the source file for more info.
1 from lsst.ip.isr import IsrTask
1 import exampleUtils

Create the raw input data with the help of some utilities in exampleUtils.py also in the examples directory. We will only do overscan, dark and flat correction. The data are constructed by hand so that all effects will be corrected for essentially perfectly.

1  DARKVAL = 2. #e-/sec
2  OSCAN = 1000. #DN
3  GRADIENT = .10
4  EXPTIME = 15 #seconds
5  DARKEXPTIME = 40. #seconds
6 
7  darkExposure = exampleUtils.makeDark(DARKVAL, DARKEXPTIME)
8  flatExposure = exampleUtils.makeFlat(GRADIENT)
9  rawExposure = exampleUtils.makeRaw(DARKVAL, OSCAN, GRADIENT, EXPTIME)
The above numbers can be changed to modify the gradient in the flat, for example. For the parameters in this particular example, the image after ISR will be a constant 5000 counts (with some variation in floating point represenation).

Note
Alternatively, images can be read from disk, either using the Butler or manually:
1 import lsst.afw.image as afwImage
2 darkExposure = afwImage.ExposureF("/path/to/dark.fits")
3 flatExposure = afwImage.ExposureF("/path/to/flat.fits")
4 rawExposure = afwImage.ExposureF("/path/to/raw.fits")
In order to perform overscanCorrection IsrTask.run() requires Exposures which have a lsst.afw.cameraGeom.Detector. Detector objects describe details such as data dimensions, number of amps, orientation and overscan dimensions. If requesting images from the Butler, Exposures will automatically have detector information. If running IsrTask on arbitrary images from a camera without an obs_ package, a lsst.afw.cameraGeom.Detector can be generated using lsst.afw.cameraGeom.fitsUtils.DetectorBuilder and set by calling
1 rawExposure.setDetector(myDetectorObject)
See lsst.afw.cameraGeom.fitsUtils.DetectorBuilder for more details.
The updateVariance and saturationDetection steps are not run for Exposures without a lsst.afw.cameraGeom.Detector, unless IsrTaskConfig.gain, IsrTaskConfig.readNoise, and/or IsrTaskConfig.saturation are set in the config, in which case they are applied to the entire image rather than per amp.
Construct the task and set some config parameters. Specifically, we don't want to do zero or fringe correction. We also don't want the assembler messing with the gain.
1  #Create the isr task with modified config
2  isrConfig = IsrTask.ConfigClass()
3  isrConfig.doBias = False #We didn't make a zero frame
4  isrConfig.doDark = True
5  isrConfig.doFlat = True
6  isrConfig.doFringe = False #There is no fringe frame for this example
7 
8  isrConfig.assembleCcd.doRenorm = False #We'll take care of gain in the flats
9  isrConfig.assembleCcd.setGain = False
10  isrTask = IsrTask(config=isrConfig)

Finally, run the exposures through ISR.

1  output = isrTask.run(rawExposure, dark=darkExposure, flat=flatExposure)


Definition at line 176 of file isrTask.py.

Constructor & Destructor Documentation

def lsst.ip.isr.isrTask.IsrTask.__init__ (   self,
  args,
  kwargs 
)

Constructor for IsrTask.

Parameters
[in]*args– a list of positional arguments passed on to the Task constructor
[in]**kwargs– a dictionary of keyword arguments passed on to the Task constructor Call the lsst.pipe.base.task.Task.__init__ method Then setup the assembly and fringe correction subtasks

Definition at line 317 of file isrTask.py.

318  def __init__(self, *args, **kwargs):
319  '''!Constructor for IsrTask
320  \param[in] *args -- a list of positional arguments passed on to the Task constructor
321  \param[in] **kwargs -- a dictionary of keyword arguments passed on to the Task constructor
322  Call the lsst.pipe.base.task.Task.__init__ method
323  Then setup the assembly and fringe correction subtasks
324  '''
325  pipeBase.Task.__init__(self, *args, **kwargs)
326  self.makeSubtask("assembleCcd")
327  self.makeSubtask("fringe")
328 
def __init__
Constructor for IsrTask.
Definition: isrTask.py:317

Member Function Documentation

def lsst.ip.isr.isrTask.IsrTask.biasCorrection (   self,
  exposure,
  biasExposure 
)

Apply bias correction in place.

Parameters
[in,out]exposureexposure to process
[in]biasExposurebias exposure of same size as exposure

Definition at line 485 of file isrTask.py.

486  def biasCorrection(self, exposure, biasExposure):
487  """!Apply bias correction in place
488 
489  \param[in,out] exposure exposure to process
490  \param[in] biasExposure bias exposure of same size as exposure
491  """
492  isr.biasCorrection(exposure.getMaskedImage(), biasExposure.getMaskedImage())
def biasCorrection
Apply bias correction in place.
Definition: isrTask.py:485
def lsst.ip.isr.isrTask.IsrTask.convertIntToFloat (   self,
  exposure 
)
Convert an exposure from uint16 to float, set variance plane to 1 and mask plane to 0

Definition at line 468 of file isrTask.py.

469  def convertIntToFloat(self, exposure):
470  """Convert an exposure from uint16 to float, set variance plane to 1 and mask plane to 0
471  """
472  if isinstance(exposure, afwImage.ExposureF):
473  # Nothing to be done
474  return exposure
475  if not hasattr(exposure, "convertF"):
476  raise RuntimeError("Unable to convert exposure (%s) to float" % type(exposure))
477 
478  newexposure = exposure.convertF()
479  maskedImage = newexposure.getMaskedImage()
480  varArray = maskedImage.getVariance().getArray()
481  varArray[:,:] = 1
482  maskArray = maskedImage.getMask().getArray()
483  maskArray[:,:] = 0
484  return newexposure
def lsst.ip.isr.isrTask.IsrTask.darkCorrection (   self,
  exposure,
  darkExposure 
)

Apply dark correction in place.

Parameters
[in,out]exposureexposure to process
[in]darkExposuredark exposure of same size as exposure

Definition at line 493 of file isrTask.py.

494  def darkCorrection(self, exposure, darkExposure):
495  """!Apply dark correction in place
496 
497  \param[in,out] exposure exposure to process
498  \param[in] darkExposure dark exposure of same size as exposure
499  """
500  darkCalib = darkExposure.getCalib()
501  isr.darkCorrection(
502  maskedImage = exposure.getMaskedImage(),
503  darkMaskedImage = darkExposure.getMaskedImage(),
504  expScale = exposure.getCalib().getExptime(),
505  darkScale = darkCalib.getExptime(),
506  )
def darkCorrection
Apply dark correction in place.
Definition: isrTask.py:493
def lsst.ip.isr.isrTask.IsrTask.flatCorrection (   self,
  exposure,
  flatExposure 
)

Apply flat correction in place.

Parameters
[in,out]exposureexposure to process
[in]flatExposureflatfield exposure same size as exposure

Definition at line 520 of file isrTask.py.

521  def flatCorrection(self, exposure, flatExposure):
522  """!Apply flat correction in place
523 
524  \param[in,out] exposure exposure to process
525  \param[in] flatExposure flatfield exposure same size as exposure
526  """
527  isr.flatCorrection(
528  maskedImage = exposure.getMaskedImage(),
529  flatMaskedImage = flatExposure.getMaskedImage(),
530  scalingType = self.config.flatScalingType,
531  userScale = self.config.flatUserScale,
532  )
def flatCorrection
Apply flat correction in place.
Definition: isrTask.py:520
def lsst.ip.isr.isrTask.IsrTask.getIsrExposure (   self,
  dataRef,
  datasetType,
  immediate = True 
)

Retrieve a calibration dataset for removing instrument signature.

Parameters
[in]dataRefdata reference for exposure
[in]datasetTypetype of dataset to retrieve (e.g. 'bias', 'flat')
[in]immediateif True, disable butler proxies to enable error handling within this routine
Returns
exposure

Definition at line 533 of file isrTask.py.

534  def getIsrExposure(self, dataRef, datasetType, immediate=True):
535  """!Retrieve a calibration dataset for removing instrument signature
536 
537  \param[in] dataRef data reference for exposure
538  \param[in] datasetType type of dataset to retrieve (e.g. 'bias', 'flat')
539  \param[in] immediate if True, disable butler proxies to enable error
540  handling within this routine
541  \return exposure
542  """
543  try:
544  exp = dataRef.get(datasetType, immediate=immediate)
545  except Exception, e:
546  raise RuntimeError("Unable to retrieve %s for %s: %s" % (datasetType, dataRef.dataId, e))
547  if self.config.doAssembleIsrExposures:
548  exp = self.assembleCcd.assembleCcd(exp)
549  return exp
def getIsrExposure
Retrieve a calibration dataset for removing instrument signature.
Definition: isrTask.py:533
def lsst.ip.isr.isrTask.IsrTask.maskAndInterpDefect (   self,
  ccdExposure,
  defectBaseList 
)

Mask defects using mask plane "BAD" and interpolate over them, in place.

Parameters
[in,out]ccdExposureexposure to process
[in]defectBaseLista list of defects to mask and interpolate
Warning
: call this after CCD assembly, since defects may cross amplifier boundaries

Definition at line 582 of file isrTask.py.

583  def maskAndInterpDefect(self, ccdExposure, defectBaseList):
584  """!Mask defects using mask plane "BAD" and interpolate over them, in place
585 
586  \param[in,out] ccdExposure exposure to process
587  \param[in] defectBaseList a list of defects to mask and interpolate
588 
589  \warning: call this after CCD assembly, since defects may cross amplifier boundaries
590  """
591  maskedImage = ccdExposure.getMaskedImage()
592  defectList = measAlg.DefectListT()
593  for d in defectBaseList:
594  bbox = d.getBBox()
595  nd = measAlg.Defect(bbox)
596  defectList.append(nd)
597  isr.maskPixelsFromDefectList(maskedImage, defectList, maskName='BAD')
598  isr.interpolateDefectList(
599  maskedImage = maskedImage,
600  defectList = defectList,
601  fwhm = self.config.fwhm,
602  )
def maskAndInterpDefect
Mask defects using mask plane "BAD" and interpolate over them, in place.
Definition: isrTask.py:582
Encapsulate information about a bad portion of a detector.
Definition: Interp.h:70
def lsst.ip.isr.isrTask.IsrTask.maskAndInterpNan (   self,
  exposure 
)

Mask NaNs using mask plane "UNMASKEDNAN" and interpolate over them, in place.

We mask and interpolate over all NaNs, including those that are masked with other bits (because those may or may not be interpolated over later, and we want to remove all NaNs). Despite this behaviour, the "UNMASKEDNAN" mask plane is used to preserve the historical name.

Parameters
[in,out]exposureexposure to process

Definition at line 603 of file isrTask.py.

604  def maskAndInterpNan(self, exposure):
605  """!Mask NaNs using mask plane "UNMASKEDNAN" and interpolate over them, in place
606 
607  We mask and interpolate over all NaNs, including those
608  that are masked with other bits (because those may or may
609  not be interpolated over later, and we want to remove all
610  NaNs). Despite this behaviour, the "UNMASKEDNAN" mask plane
611  is used to preserve the historical name.
612 
613  \param[in,out] exposure exposure to process
614  """
615  maskedImage = exposure.getMaskedImage()
616 
617  # Find and mask NaNs
618  maskedImage.getMask().addMaskPlane("UNMASKEDNAN")
619  maskVal = maskedImage.getMask().getPlaneBitMask("UNMASKEDNAN")
620  numNans = maskNans(maskedImage, maskVal)
621  self.metadata.set("NUMNANS", numNans)
622 
623  # Interpolate over these previously-unmasked NaNs
624  if numNans > 0:
625  self.log.log(self.log.WARN, "There were %i unmasked NaNs" % (numNans,))
626  nanDefectList = isr.getDefectListFromMask(
627  maskedImage = maskedImage,
628  maskName = 'UNMASKEDNAN',
629  growFootprints = 0,
630  )
631  isr.interpolateDefectList(
632  maskedImage = exposure.getMaskedImage(),
633  defectList = nanDefectList,
634  fwhm = self.config.fwhm,
635  )
def maskAndInterpNan
Mask NaNs using mask plane "UNMASKEDNAN" and interpolate over them, in place.
Definition: isrTask.py:603
size_t maskNans(afw::image::MaskedImage< PixelT > const &mi, afw::image::MaskPixel maskVal, afw::image::MaskPixel allow=0)
Definition: Isr.cc:61
def lsst.ip.isr.isrTask.IsrTask.overscanCorrection (   self,
  exposure,
  amp 
)

Apply overscan correction, in place.

Parameters
[in,out]exposureexposure to process; must include both DataSec and BiasSec pixels
[in]ampamplifier device data

Definition at line 636 of file isrTask.py.

637  def overscanCorrection(self, exposure, amp):
638  """!Apply overscan correction, in place
639 
640  \param[in,out] exposure exposure to process; must include both DataSec and BiasSec pixels
641  \param[in] amp amplifier device data
642  """
643  if not amp.getHasRawInfo():
644  raise RuntimeError("This method must be executed on an amp with raw information.")
645 
646  if amp.getRawHorizontalOverscanBBox().isEmpty():
647  self.log.info("No Overscan region. Not performing Overscan Correction.")
648  return None
649 
650  maskedImage = exposure.getMaskedImage()
651  dataView = maskedImage.Factory(maskedImage, amp.getRawDataBBox())
652 
653  expImage = exposure.getMaskedImage().getImage()
654  overscanImage = expImage.Factory(expImage, amp.getRawHorizontalOverscanBBox())
655 
656  isr.overscanCorrection(
657  ampMaskedImage = dataView,
658  overscanImage = overscanImage,
659  fitType = self.config.overscanFitType,
660  order = self.config.overscanOrder,
661  collapseRej = self.config.overscanRej,
662  )
def overscanCorrection
Apply overscan correction, in place.
Definition: isrTask.py:636
def lsst.ip.isr.isrTask.IsrTask.readIsrData (   self,
  dataRef 
)

Retrieve necessary frames for instrument signature removal.

Parameters
[in]dataRef– a daf.persistence.butlerSubset.ButlerDataRef of the detector data to be processed
Returns
a pipeBase.Struct with fields containing kwargs expected by run()
  • bias: exposure of bias frame
  • dark: exposure of dark frame
  • flat: exposure of flat field
  • defects: list of detects
  • fringes: exposure of fringe frame or list of fringe exposure

Definition at line 329 of file isrTask.py.

330  def readIsrData(self, dataRef):
331  """!Retrieve necessary frames for instrument signature removal
332  \param[in] dataRef -- a daf.persistence.butlerSubset.ButlerDataRef
333  of the detector data to be processed
334  \return a pipeBase.Struct with fields containing kwargs expected by run()
335  - bias: exposure of bias frame
336  - dark: exposure of dark frame
337  - flat: exposure of flat field
338  - defects: list of detects
339  - fringes: exposure of fringe frame or list of fringe exposure
340  """
341  biasExposure = self.getIsrExposure(dataRef, "bias") if self.config.doBias else None
342  darkExposure = self.getIsrExposure(dataRef, "dark") if self.config.doDark else None
343  flatExposure = self.getIsrExposure(dataRef, "flat") if self.config.doFlat else None
344 
345  defectList = dataRef.get("defects")
346 
347  if self.config.doFringe:
348  fringes = self.fringe.readFringes(dataRef, assembler=self.assembleCcd \
349  if self.config.doAssembleIsrExposures else None)
350  else:
351  fringes = None
352 
353  #Struct should include only kwargs to run()
354  return pipeBase.Struct(bias = biasExposure,
355  dark = darkExposure,
356  flat = flatExposure,
357  defects = defectList,
358  fringes = fringes,
359  )
def getIsrExposure
Retrieve a calibration dataset for removing instrument signature.
Definition: isrTask.py:533
def readIsrData
Retrieve necessary frames for instrument signature removal.
Definition: isrTask.py:329
def lsst.ip.isr.isrTask.IsrTask.run (   self,
  ccdExposure,
  bias = None,
  dark = None,
  flat = None,
  defects = None,
  fringes = None 
)

Perform instrument signature removal on an exposure.

Steps include:

Parameters
[in]ccdExposure– lsst.afw.image.exposure of detector data
[in]bias– exposure of bias frame
[in]dark– exposure of dark frame
[in]flat– exposure of flatfield
[in]defects– list of detects
[in]fringes– exposure of fringe frame or list of fringe exposure
Returns
a pipeBase.Struct with field:
  • exposure

Definition at line 361 of file isrTask.py.

362  def run(self, ccdExposure, bias=None, dark=None, flat=None, defects=None, fringes=None):
363  """!Perform instrument signature removal on an exposure
364 
365  Steps include:
366  - Detect saturation, apply overscan correction, bias, dark and flat
367  - Perform CCD assembly
368  - Interpolate over defects, saturated pixels and all NaNs
369 
370  \param[in] ccdExposure -- lsst.afw.image.exposure of detector data
371  \param[in] bias -- exposure of bias frame
372  \param[in] dark -- exposure of dark frame
373  \param[in] flat -- exposure of flatfield
374  \param[in] defects -- list of detects
375  \param[in] fringes -- exposure of fringe frame or list of fringe exposure
376 
377  \return a pipeBase.Struct with field:
378  - exposure
379  """
380 
381  #Validate Input
382  if self.config.doBias and bias is None:
383  raise RuntimeError("Must supply a bias exposure if config.doBias True")
384  if self.config.doDark and dark is None:
385  raise RuntimeError("Must supply a dark exposure if config.doDark True")
386  if self.config.doFlat and flat is None:
387  raise RuntimeError("Must supply a flat exposure if config.doFlat True")
388  if self.config.doFringe and fringes is None:
389  raise RuntimeError("Must supply fringe list or exposure if config.doFringe True")
390 
391  defects = [] if defects is None else defects
392 
393  ccd = ccdExposure.getDetector()
394  ccdExposure = self.convertIntToFloat(ccdExposure)
395 
396  if not ccd:
397  assert not self.config.doAssembleCcd, "You need a Detector to run assembleCcd"
398  ccd = [FakeAmp(ccdExposure, self.config)]
399 
400  for amp in ccd:
401  #if ccdExposure is one amp, check for coverage to prevent performing ops multiple times
402  if ccdExposure.getBBox().contains(amp.getBBox()):
403  self.saturationDetection(ccdExposure, amp)
404  self.overscanCorrection(ccdExposure, amp)
405 
406  if self.config.doAssembleCcd:
407  ccdExposure = self.assembleCcd.assembleCcd(ccdExposure)
408 
409  if self.config.doBias:
410  self.biasCorrection(ccdExposure, bias)
411 
412  if self.config.doDark:
413  self.darkCorrection(ccdExposure, dark)
414 
415  for amp in ccd:
416  #if ccdExposure is one amp, check for coverage to prevent performing ops multiple times
417  if ccdExposure.getBBox().contains(amp.getBBox()):
418  ampExposure = ccdExposure.Factory(ccdExposure, amp.getBBox())
419  self.updateVariance(ampExposure, amp)
420 
421  if self.config.doFringe and not self.config.fringeAfterFlat:
422  self.fringe.removeFringe(ccdExposure, fringes)
423 
424  if self.config.doFlat:
425  self.flatCorrection(ccdExposure, flat)
426 
427  self.maskAndInterpDefect(ccdExposure, defects)
428 
429  self.saturationInterpolation(ccdExposure)
430 
431  self.maskAndInterpNan(ccdExposure)
432 
433  if self.config.doFringe and self.config.fringeAfterFlat:
434  self.fringe.removeFringe(ccdExposure, fringes)
435 
436  ccdExposure.getCalib().setFluxMag0(self.config.fluxMag0T1 * ccdExposure.getCalib().getExptime())
437 
438  self.display("postISRCCD", ccdExposure)
439 
440  return pipeBase.Struct(
441  exposure = ccdExposure,
442  )
443 
def maskAndInterpNan
Mask NaNs using mask plane &quot;UNMASKEDNAN&quot; and interpolate over them, in place.
Definition: isrTask.py:603
def flatCorrection
Apply flat correction in place.
Definition: isrTask.py:520
def run
Perform instrument signature removal on an exposure.
Definition: isrTask.py:361
def updateVariance
Set the variance plane based on the image plane, plus amplifier gain and read noise.
Definition: isrTask.py:507
def maskAndInterpDefect
Mask defects using mask plane &quot;BAD&quot; and interpolate over them, in place.
Definition: isrTask.py:582
def overscanCorrection
Apply overscan correction, in place.
Definition: isrTask.py:636
def saturationDetection
Detect saturated pixels and mask them using mask plane &quot;SAT&quot;, in place.
Definition: isrTask.py:550
def darkCorrection
Apply dark correction in place.
Definition: isrTask.py:493
def saturationInterpolation
Interpolate over saturated pixels, in place.
Definition: isrTask.py:566
def biasCorrection
Apply bias correction in place.
Definition: isrTask.py:485
def lsst.ip.isr.isrTask.IsrTask.runDataRef (   self,
  sensorRef 
)

Perform instrument signature removal on a ButlerDataRef of a Sensor.

Parameters
[in]sensorRef– daf.persistence.butlerSubset.ButlerDataRef of the detector data to be processed
Returns
a pipeBase.Struct with fields:
  • exposure: the exposure after application of ISR

Definition at line 445 of file isrTask.py.

446  def runDataRef(self, sensorRef):
447  """!Perform instrument signature removal on a ButlerDataRef of a Sensor
448 
449  - Read in necessary detrending/isr/calibration data
450  - Process raw exposure in run()
451  - Persist the ISR-corrected exposure as "postISRCCD" if config.doWrite is True
452 
453  \param[in] sensorRef -- daf.persistence.butlerSubset.ButlerDataRef of the
454  detector data to be processed
455  \return a pipeBase.Struct with fields:
456  - exposure: the exposure after application of ISR
457  """
458  self.log.info("Performing ISR on sensor %s" % (sensorRef.dataId))
459  ccdExposure = sensorRef.get('raw')
460  isrData = self.readIsrData(sensorRef)
461 
462  result = self.run(ccdExposure, **isrData.getDict())
463 
464  if self.config.doWrite:
465  sensorRef.put(result.exposure, "postISRCCD")
466 
467  return result
def run
Perform instrument signature removal on an exposure.
Definition: isrTask.py:361
def runDataRef
Perform instrument signature removal on a ButlerDataRef of a Sensor.
Definition: isrTask.py:445
def readIsrData
Retrieve necessary frames for instrument signature removal.
Definition: isrTask.py:329
def lsst.ip.isr.isrTask.IsrTask.saturationDetection (   self,
  exposure,
  amp 
)

Detect saturated pixels and mask them using mask plane "SAT", in place.

Parameters
[in,out]exposureexposure to process; only the amp DataSec is processed
[in]ampamplifier device data

Definition at line 550 of file isrTask.py.

551  def saturationDetection(self, exposure, amp):
552  """!Detect saturated pixels and mask them using mask plane "SAT", in place
553 
554  \param[in,out] exposure exposure to process; only the amp DataSec is processed
555  \param[in] amp amplifier device data
556  """
557  if not math.isnan(amp.getSaturation()):
558  maskedImage = exposure.getMaskedImage()
559  dataView = maskedImage.Factory(maskedImage, amp.getRawBBox())
560  isr.makeThresholdMask(
561  maskedImage = dataView,
562  threshold = amp.getSaturation(),
563  growFootprints = 0,
564  maskName = self.config.saturatedMaskName,
565  )
def saturationDetection
Detect saturated pixels and mask them using mask plane &quot;SAT&quot;, in place.
Definition: isrTask.py:550
def lsst.ip.isr.isrTask.IsrTask.saturationInterpolation (   self,
  ccdExposure 
)

Interpolate over saturated pixels, in place.

Parameters
[in,out]ccdExposureexposure to process
Warning
:
  • Call saturationDetection first, so that saturated pixels have been identified in the "SAT" mask.
  • Call this after CCD assembly, since saturated regions may cross amplifier boundaries

Definition at line 566 of file isrTask.py.

567  def saturationInterpolation(self, ccdExposure):
568  """!Interpolate over saturated pixels, in place
569 
570  \param[in,out] ccdExposure exposure to process
571 
572  \warning:
573  - Call saturationDetection first, so that saturated pixels have been identified in the "SAT" mask.
574  - Call this after CCD assembly, since saturated regions may cross amplifier boundaries
575  """
576  isr.interpolateFromMask(
577  maskedImage = ccdExposure.getMaskedImage(),
578  fwhm = self.config.fwhm,
579  growFootprints = self.config.growSaturationFootprintSize,
580  maskName = self.config.saturatedMaskName,
581  )
def saturationInterpolation
Interpolate over saturated pixels, in place.
Definition: isrTask.py:566
def lsst.ip.isr.isrTask.IsrTask.updateVariance (   self,
  ampExposure,
  amp 
)

Set the variance plane based on the image plane, plus amplifier gain and read noise.

Parameters
[in,out]ampExposureexposure to process
[in]ampamplifier detector information

Definition at line 507 of file isrTask.py.

508  def updateVariance(self, ampExposure, amp):
509  """!Set the variance plane based on the image plane, plus amplifier gain and read noise
510 
511  \param[in,out] ampExposure exposure to process
512  \param[in] amp amplifier detector information
513  """
514  if not math.isnan(amp.getGain()):
515  isr.updateVariance(
516  maskedImage = ampExposure.getMaskedImage(),
517  gain = amp.getGain(),
518  readNoise = amp.getReadNoise(),
519  )
def updateVariance
Set the variance plane based on the image plane, plus amplifier gain and read noise.
Definition: isrTask.py:507

Member Data Documentation

string lsst.ip.isr.isrTask.IsrTask._DefaultName = "isr"
staticprivate

Definition at line 315 of file isrTask.py.

lsst.ip.isr.isrTask.IsrTask.ConfigClass = IsrTaskConfig
static

Definition at line 314 of file isrTask.py.


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