LSSTApplications  1.1.2+25,10.0+13,10.0+132,10.0+133,10.0+224,10.0+41,10.0+8,10.0-1-g0f53050+14,10.0-1-g4b7b172+19,10.0-1-g61a5bae+98,10.0-1-g7408a83+3,10.0-1-gc1e0f5a+19,10.0-1-gdb4482e+14,10.0-11-g3947115+2,10.0-12-g8719d8b+2,10.0-15-ga3f480f+1,10.0-2-g4f67435,10.0-2-gcb4bc6c+26,10.0-28-gf7f57a9+1,10.0-3-g1bbe32c+14,10.0-3-g5b46d21,10.0-4-g027f45f+5,10.0-4-g86f66b5+2,10.0-4-gc4fccf3+24,10.0-40-g4349866+2,10.0-5-g766159b,10.0-5-gca2295e+25,10.0-6-g462a451+1
LSSTDataManagementBasePackage
Functions
lsst.ip.isr.isr Namespace Reference

Functions

def createPsf
 
def calcEffectiveGain
 
def transposeMaskedImage
 
def interpolateDefectList
 
def defectListFromFootprintList
 
def transposeDefectList
 
def maskPixelsFromDefectList
 
def getDefectListFromMask
 
def makeThresholdMask
 
def interpolateFromMask
 
def saturationCorrection
 
def biasCorrection
 
def darkCorrection
 
def updateVariance
 
def flatCorrection
 
def illuminationCorrection
 
def overscanCorrection
 

Function Documentation

def lsst.ip.isr.isr.biasCorrection (   maskedImage,
  biasMaskedImage 
)
Apply bias correction in place

@param[in,out] maskedImage  masked image to correct
@param[in] biasMaskedImage  bias, as a masked image

Definition at line 206 of file isr.py.

207 def biasCorrection(maskedImage, biasMaskedImage):
208  """Apply bias correction in place
209 
210  @param[in,out] maskedImage masked image to correct
211  @param[in] biasMaskedImage bias, as a masked image
212  """
213  maskedImage -= biasMaskedImage
def biasCorrection
Definition: isr.py:206
def lsst.ip.isr.isr.calcEffectiveGain (   maskedImage)
Calculate effective gain

@param[in] maskedImage  afw.image.MaskedImage to process
@return (median gain, mean gain) in e-/ADU

Definition at line 42 of file isr.py.

42 
43 def calcEffectiveGain(maskedImage):
44  """Calculate effective gain
45 
46  @param[in] maskedImage afw.image.MaskedImage to process
47  @return (median gain, mean gain) in e-/ADU
48  """
49  im = afwImage.ImageF(maskedImage.getImage(), True)
50  var = maskedImage.getVariance()
51  im /= var
52  medgain = afwMath.makeStatistics(im, afwMath.MEDIAN).getValue()
53  meangain = afwMath.makeStatistics(im, afwMath.MEANCLIP).getValue()
54  return medgain, meangain
def calcEffectiveGain
Definition: isr.py:42
Statistics makeStatistics(afwImage::Mask< afwImage::MaskPixel > const &msk, int const flags, StatisticsControl const &sctrl)
Specialization to handle Masks.
Definition: Statistics.cc:1023
def lsst.ip.isr.isr.createPsf (   fwhm)
Make a double Gaussian PSF

@param[in] fwhm  FWHM of double Gaussian smoothing kernel
@return measAlg.DoubleGaussianPsf

Definition at line 33 of file isr.py.

33 
34 def createPsf(fwhm):
35  """Make a double Gaussian PSF
36 
37  @param[in] fwhm FWHM of double Gaussian smoothing kernel
38  @return measAlg.DoubleGaussianPsf
39  """
40  ksize = 4*int(fwhm) + 1
41  return measAlg.DoubleGaussianPsf(ksize, ksize, fwhm/(2*math.sqrt(2*math.log(2))))
Represent a Psf as a circularly symmetrical double Gaussian.
def createPsf
Definition: isr.py:33
def lsst.ip.isr.isr.darkCorrection (   maskedImage,
  darkMaskedImage,
  expScale,
  darkScale 
)
Apply dark correction in place

maskedImage -= dark * expScaling / darkScaling

@param[in,out] maskedImage  afw.image.MaskedImage to correct
@param[in] darkMaskedImage  dark afw.image.MaskedImage
@param[in] expScale  exposure scale
@param[in] darkScale  dark scale

Definition at line 214 of file isr.py.

215 def darkCorrection(maskedImage, darkMaskedImage, expScale, darkScale):
216  """Apply dark correction in place
217 
218  maskedImage -= dark * expScaling / darkScaling
219 
220  @param[in,out] maskedImage afw.image.MaskedImage to correct
221  @param[in] darkMaskedImage dark afw.image.MaskedImage
222  @param[in] expScale exposure scale
223  @param[in] darkScale dark scale
224  """
225  if maskedImage.getBBox(afwImage.LOCAL) != darkMaskedImage.getBBox(afwImage.LOCAL):
226  raise RuntimeError("maskedImage bbox %s != darkMaskedImage bbox %s" % \
227  (maskedImage.getBBox(afwImage.LOCAL), darkMaskedImage.getBBox(afwImage.LOCAL)))
228 
229  scale = expScale / darkScale
230  maskedImage.scaledMinus(scale, darkMaskedImage)
def darkCorrection
Definition: isr.py:214
def lsst.ip.isr.isr.defectListFromFootprintList (   fpList,
  growFootprints = 1 
)
Compute a defect list from a footprint list, optionally growing the footprints

@param[in] fpList  footprint list
@param[in] growFootprints  amount by which to grow footprints of detected regions
@return meas.algorithms.DefectListT

Definition at line 83 of file isr.py.

83 
84 def defectListFromFootprintList(fpList, growFootprints=1):
85  """Compute a defect list from a footprint list, optionally growing the footprints
86 
87  @param[in] fpList footprint list
88  @param[in] growFootprints amount by which to grow footprints of detected regions
89  @return meas.algorithms.DefectListT
90  """
91  defectList = measAlg.DefectListT()
92  for fp in fpList:
93  if growFootprints > 0:
94  # if "True", growing requires a convolution
95  # if "False", its faster
96  fpGrow = afwDetection.growFootprint(fp, growFootprints, False)
97  else:
98  fpGrow = fp
99  for bbox in afwDetection.footprintToBBoxList(fpGrow):
100  defect = measAlg.Defect(bbox)
101  defectList.push_back(defect)
102  return defectList
boost::shared_ptr< Footprint > growFootprint(Footprint const &foot, int nGrow, bool left, bool right, bool up, bool down)
Grow a Footprint in at least one of the cardinal directions, returning a new Footprint.
std::vector< lsst::afw::geom::Box2I > footprintToBBoxList(Footprint const &foot)
Encapsulate information about a bad portion of a detector.
Definition: Interp.h:70
def defectListFromFootprintList
Definition: isr.py:83
def lsst.ip.isr.isr.flatCorrection (   maskedImage,
  flatMaskedImage,
  scalingType,
  userScale = 1.0 
)
Apply flat correction in place

@param[in,out] maskedImage  afw.image.MaskedImage to correct
@param[in] flatMaskedImage  flat field afw.image.MaskedImage
@param[in] scalingType  how to compute flat scale; one of 'MEAN', 'MEDIAN' or 'USER'
@param[in] userScale  scale to use if scalingType is 'USER', else ignored

Definition at line 243 of file isr.py.

244 def flatCorrection(maskedImage, flatMaskedImage, scalingType, userScale=1.0):
245  """Apply flat correction in place
246 
247  @param[in,out] maskedImage afw.image.MaskedImage to correct
248  @param[in] flatMaskedImage flat field afw.image.MaskedImage
249  @param[in] scalingType how to compute flat scale; one of 'MEAN', 'MEDIAN' or 'USER'
250  @param[in] userScale scale to use if scalingType is 'USER', else ignored
251  """
252  if maskedImage.getBBox(afwImage.LOCAL) != flatMaskedImage.getBBox(afwImage.LOCAL):
253  raise RuntimeError("maskedImage bbox %s != flatMaskedImage bbox %s" % \
254  (maskedImage.getBBox(afwImage.LOCAL), flatMaskedImage.getBBox(afwImage.LOCAL)))
255 
256  # Figure out scale from the data
257  # Ideally the flats are normalized by the calibration product pipelin, but this allows some flexibility
258  # in the case that the flat is created by some other mechanism.
259  if scalingType == 'MEAN':
260  flatScale = afwMath.makeStatistics(flatMaskedImage.getImage(), afwMath.MEAN).getValue(afwMath.MEAN)
261  elif scalingType == 'MEDIAN':
262  flatScale = afwMath.makeStatistics(flatMaskedImage.getImage(), afwMath.MEDIAN).getValue(afwMath.MEDIAN)
263  elif scalingType == 'USER':
264  flatScale = userScale
265  else:
266  raise pexExcept.Exception, '%s : %s not implemented' % ("flatCorrection", scalingType)
267 
268  maskedImage.scaledDivides(1.0/flatScale, flatMaskedImage)
def flatCorrection
Definition: isr.py:243
Statistics makeStatistics(afwImage::Mask< afwImage::MaskPixel > const &msk, int const flags, StatisticsControl const &sctrl)
Specialization to handle Masks.
Definition: Statistics.cc:1023
def lsst.ip.isr.isr.getDefectListFromMask (   maskedImage,
  maskName,
  growFootprints = 1 
)
Compute a defect list from a specified mask plane

@param[in] maskedImage  masked image to process
@param[in] maskName  mask plane name
@param[in] growFootprints  amount by which to grow footprints of detected regions
@return meas.algrithms.DefectListT of regions in mask

Definition at line 131 of file isr.py.

132 def getDefectListFromMask(maskedImage, maskName, growFootprints=1):
133  """Compute a defect list from a specified mask plane
134 
135  @param[in] maskedImage masked image to process
136  @param[in] maskName mask plane name
137  @param[in] growFootprints amount by which to grow footprints of detected regions
138  @return meas.algrithms.DefectListT of regions in mask
139  """
140  mask = maskedImage.getMask()
141  workmask = afwImage.MaskU(mask, True)
142  workmask &= mask.getPlaneBitMask(maskName)
143  thresh = afwDetection.Threshold(0.5)
144  maskimg = afwImage.ImageU(workmask.getBBox())
145  maskimg <<= workmask
146  ds = afwDetection.FootprintSet(maskimg, thresh)
147  fpList = ds.getFootprints()
148  return defectListFromFootprintList(fpList, growFootprints)
A Threshold is used to pass a threshold value to detection algorithms.
Definition: Threshold.h:44
def getDefectListFromMask
Definition: isr.py:131
A set of Footprints, associated with a MaskedImage.
Definition: FootprintSet.h:53
def defectListFromFootprintList
Definition: isr.py:83
def lsst.ip.isr.isr.illuminationCorrection (   maskedImage,
  illumMaskedImage,
  illumScale 
)
Apply illumination correction in place

@param[in,out] maskedImage  afw.image.MaskedImage to correct
@param[in] illumMaskedImage  illumination correction masked image
@param[in] illumScale  scale value for illumination correction

Definition at line 269 of file isr.py.

270 def illuminationCorrection(maskedImage, illumMaskedImage, illumScale):
271  """Apply illumination correction in place
272 
273  @param[in,out] maskedImage afw.image.MaskedImage to correct
274  @param[in] illumMaskedImage illumination correction masked image
275  @param[in] illumScale scale value for illumination correction
276  """
277  if maskedImage.getBBox(afwImage.LOCAL) != illumMaskedImage.getBBox(afwImage.LOCAL):
278  raise RuntimeError("maskedImage bbox %s != illumMaskedImage bbox %s" % \
279  (maskedImage.getBBox(afwImage.LOCAL), illumMaskedImage.getBBox(afwImage.LOCAL)))
280 
281  maskedImage.scaledDivides(1./illumScale, illumMaskedImage)
def illuminationCorrection
Definition: isr.py:269
def lsst.ip.isr.isr.interpolateDefectList (   maskedImage,
  defectList,
  fwhm,
  fallbackValue = None 
)
Interpolate over defects specified in a defect list

@param[in,out] maskedImage  masked image to process
@param[in] defectList  defect list
@param[in] fwhm  FWHM of double Gaussian smoothing kernel
@param[in] fallbackValue  fallback value if an interpolated value cannot be determined;
                          if None then use clipped mean image value

Definition at line 67 of file isr.py.

67 
68 def interpolateDefectList(maskedImage, defectList, fwhm, fallbackValue=None):
69  """Interpolate over defects specified in a defect list
70 
71  @param[in,out] maskedImage masked image to process
72  @param[in] defectList defect list
73  @param[in] fwhm FWHM of double Gaussian smoothing kernel
74  @param[in] fallbackValue fallback value if an interpolated value cannot be determined;
75  if None then use clipped mean image value
76  """
77  psf = createPsf(fwhm)
78  if fallbackValue is None:
79  fallbackValue = afwMath.makeStatistics(maskedImage.getImage(), afwMath.MEANCLIP).getValue()
80  if 'INTRP' not in maskedImage.getMask().getMaskPlaneDict().keys():
81  maskedImage.getMask.addMaskPlane('INTRP')
82  measAlg.interpolateOverDefects(maskedImage, psf, defectList, fallbackValue, True)
void interpolateOverDefects(MaskedImageT &image, lsst::afw::detection::Psf const &psf, std::vector< Defect::Ptr > &badList, double fallbackValue=0.0, bool useFallbackValueAtEdge=false)
Process a set of known bad pixels in an image.
Definition: Interp.cc:2058
def interpolateDefectList
Definition: isr.py:67
def createPsf
Definition: isr.py:33
Statistics makeStatistics(afwImage::Mask< afwImage::MaskPixel > const &msk, int const flags, StatisticsControl const &sctrl)
Specialization to handle Masks.
Definition: Statistics.cc:1023
def lsst.ip.isr.isr.interpolateFromMask (   maskedImage,
  fwhm,
  growFootprints = 1,
  maskName = 'SAT',
  fallbackValue = None 
)
Interpolate over defects identified by a particular mask plane

@param[in,out] maskedImage  afw.image.MaskedImage to process
@param[in] fwhm  FWHM of double Gaussian smoothing kernel
@param[in] growFootprints  amount by which to grow footprints of detected regions
@param[in] maskName  mask plane name
@param[in] fallbackValue  value of last resort for interpolation

Definition at line 173 of file isr.py.

174 def interpolateFromMask(maskedImage, fwhm, growFootprints=1, maskName='SAT', fallbackValue=None):
175  """Interpolate over defects identified by a particular mask plane
176 
177  @param[in,out] maskedImage afw.image.MaskedImage to process
178  @param[in] fwhm FWHM of double Gaussian smoothing kernel
179  @param[in] growFootprints amount by which to grow footprints of detected regions
180  @param[in] maskName mask plane name
181  @param[in] fallbackValue value of last resort for interpolation
182  """
183  defectList = getDefectListFromMask(maskedImage, maskName, growFootprints)
184  interpolateDefectList(maskedImage, defectList, fwhm, fallbackValue=fallbackValue)
def interpolateDefectList
Definition: isr.py:67
def getDefectListFromMask
Definition: isr.py:131
def interpolateFromMask
Definition: isr.py:173
def lsst.ip.isr.isr.makeThresholdMask (   maskedImage,
  threshold,
  growFootprints = 1,
  maskName = 'SAT' 
)
Mask pixels based on threshold detection

@param[in,out] maskedImage  afw.image.MaskedImage to process; the mask is altered
@param[in] threshold  detection threshold
@param[in] growFootprints  amount by which to grow footprints of detected regions
@param[in] maskName  mask plane name
@return meas.algorihtms.DefectListT of regions set in the mask.

Definition at line 149 of file isr.py.

150 def makeThresholdMask(maskedImage, threshold, growFootprints=1, maskName = 'SAT'):
151  """Mask pixels based on threshold detection
152 
153  @param[in,out] maskedImage afw.image.MaskedImage to process; the mask is altered
154  @param[in] threshold detection threshold
155  @param[in] growFootprints amount by which to grow footprints of detected regions
156  @param[in] maskName mask plane name
157  @return meas.algorihtms.DefectListT of regions set in the mask.
158  """
159  # find saturated regions
160  thresh = afwDetection.Threshold(threshold)
161  fs = afwDetection.FootprintSet(maskedImage, thresh)
162 
163  if growFootprints > 0:
164  fs = afwDetection.FootprintSet(fs, growFootprints)
165 
166  fpList = fs.getFootprints()
167  # set mask
168  mask = maskedImage.getMask()
169  bitmask = mask.getPlaneBitMask(maskName)
170  afwDetection.setMaskFromFootprintList(mask, fpList, bitmask)
171 
172  return defectListFromFootprintList(fpList, growFootprints=0)
A Threshold is used to pass a threshold value to detection algorithms.
Definition: Threshold.h:44
def makeThresholdMask
Definition: isr.py:149
A set of Footprints, associated with a MaskedImage.
Definition: FootprintSet.h:53
MaskT setMaskFromFootprintList(lsst::afw::image::Mask< MaskT > *mask, boost::shared_ptr< std::vector< boost::shared_ptr< Footprint >> const > const &footprints, MaskT const bitmask)
OR bitmask into all the Mask&#39;s pixels which are in the set of Footprints.
def defectListFromFootprintList
Definition: isr.py:83
def lsst.ip.isr.isr.maskPixelsFromDefectList (   maskedImage,
  defectList,
  maskName = 'BAD' 
)
Set mask plane based on a defect list

@param[in,out] maskedImage  afw.image.MaskedImage to process; mask plane is updated
@param[in] defectList  meas.algorithms.DefectListT
@param[in] maskName  mask plane name

Definition at line 117 of file isr.py.

118 def maskPixelsFromDefectList(maskedImage, defectList, maskName='BAD'):
119  """Set mask plane based on a defect list
120 
121  @param[in,out] maskedImage afw.image.MaskedImage to process; mask plane is updated
122  @param[in] defectList meas.algorithms.DefectListT
123  @param[in] maskName mask plane name
124  """
125  # mask bad pixels
126  mask = maskedImage.getMask()
127  bitmask = mask.getPlaneBitMask(maskName)
128  for defect in defectList:
129  bbox = defect.getBBox()
def maskPixelsFromDefectList
Definition: isr.py:117
A set of pixels in an Image.
Definition: Footprint.h:70
MaskT setMaskFromFootprint(lsst::afw::image::Mask< MaskT > *mask, Footprint const &footprint, MaskT const bitmask)
OR bitmask into all the Mask&#39;s pixels that are in the Footprint.
def lsst.ip.isr.isr.overscanCorrection (   ampMaskedImage,
  overscanImage,
  fitType = 'MEDIAN',
  order = 1,
  collapseRej = 3.0,
  statControl = None 
)
Apply overscan correction in place

@param[in,out] ampMaskedImage  masked image to correct
@param[in] overscanImage  overscan data as an afw.image.IMage
@param[in] fitType  type of fit for overscan correction; one of:
                    - 'MEAN'
                    - 'MEDIAN'
                    - 'POLY' (ordinary polynomial)
                    - 'CHEB' (Chebyshev polynomial)
                    - 'LEG' (Legendre polynomial)
                    - 'NATURAL_SPLINE', 'CUBIC_SPLINE', 'AKIMA_SPLINE' (splines)
@param[in] order  polynomial order or spline knots (ignored unless fitType
                  indicates a polynomial or spline)
@param[in] collapseRej  Rejection threshold (sigma) for collapsing dimension of overscan
@param[in] statControl  Statistics control object

Definition at line 283 of file isr.py.

284  statControl=None):
285  """Apply overscan correction in place
286 
287  @param[in,out] ampMaskedImage masked image to correct
288  @param[in] overscanImage overscan data as an afw.image.IMage
289  @param[in] fitType type of fit for overscan correction; one of:
290  - 'MEAN'
291  - 'MEDIAN'
292  - 'POLY' (ordinary polynomial)
293  - 'CHEB' (Chebyshev polynomial)
294  - 'LEG' (Legendre polynomial)
295  - 'NATURAL_SPLINE', 'CUBIC_SPLINE', 'AKIMA_SPLINE' (splines)
296  @param[in] order polynomial order or spline knots (ignored unless fitType
297  indicates a polynomial or spline)
298  @param[in] collapseRej Rejection threshold (sigma) for collapsing dimension of overscan
299  @param[in] statControl Statistics control object
300  """
301  ampImage = ampMaskedImage.getImage()
302  if statControl is None:
303  statControl = afwMath.StatisticsControl()
304  if fitType == 'MEAN':
305  offImage = afwMath.makeStatistics(overscanImage, afwMath.MEAN, statControl).getValue(afwMath.MEAN)
306  elif fitType == 'MEDIAN':
307  offImage = afwMath.makeStatistics(overscanImage, afwMath.MEDIAN, statControl).getValue(afwMath.MEDIAN)
308  elif fitType in ('POLY', 'CHEB', 'LEG', 'NATURAL_SPLINE', 'CUBIC_SPLINE', 'AKIMA_SPLINE'):
309  if hasattr(overscanImage, "getImage"):
310  biasArray = overscanImage.getImage().getArray()
311  biasArray = numpy.ma.masked_where(overscanImage.getMask().getArray() & statControl.getAndMask(),
312  biasArray)
313  else:
314  biasArray = overscanImage.getArray()
315  # Fit along the long axis, so collapse along each short row and fit the resulting array
316  shortInd = numpy.argmin(biasArray.shape)
317  if shortInd == 0:
318  # Convert to some 'standard' representation to make things easier
319  biasArray = numpy.transpose(biasArray)
320 
321  # Do a single round of clipping to weed out CR hits and signal leaking into the overscan
322  percentiles = numpy.percentile(biasArray, [25.0, 50.0, 75.0], axis=1)
323  medianBiasArr = percentiles[1]
324  stdevBiasArr = 0.74*(percentiles[2] - percentiles[0]) # robust stdev
325  diff = numpy.abs(biasArray - medianBiasArr[:,numpy.newaxis])
326  biasMaskedArr = numpy.ma.masked_where(diff > collapseRej*stdevBiasArr[:,numpy.newaxis], biasArray)
327  collapsed = numpy.mean(biasMaskedArr, axis=1)
328  del biasArray, percentiles, stdevBiasArr, diff, biasMaskedArr
329 
330  if shortInd == 0:
331  collapsed = numpy.transpose(collapsed)
332 
333  num = len(collapsed)
334  indices = 2.0*numpy.arange(num)/float(num) - 1.0
335 
336  if fitType in ('POLY', 'CHEB', 'LEG'):
337  # A numpy polynomial
338  poly = numpy.polynomial
339  fitter, evaler = {"POLY": (poly.polynomial.polyfit, poly.polynomial.polyval),
340  "CHEB": (poly.chebyshev.chebfit, poly.chebyshev.chebval),
341  "LEG": (poly.legendre.legfit, poly.legendre.legval),
342  }[fitType]
343 
344  coeffs = fitter(indices, collapsed, order)
345  fitBiasArr = evaler(indices, coeffs)
346  elif 'SPLINE' in fitType:
347  # An afw interpolation
348  numBins = order
349  #
350  # numpy.histogram needs a real array for the mask, but numpy.ma "optimises" the case
351  # no-values-are-masked by replacing the mask array by a scalar, numpy.ma.nomask
352  #
353  # Issue DM-415
354  #
355  collapsedMask = collapsed.mask
356  try:
357  if collapsedMask == numpy.ma.nomask:
358  collapsedMask = numpy.array(len(collapsed)*[numpy.ma.nomask])
359  except ValueError: # If collapsedMask is an array the test fails [needs .all()]
360  pass
361 
362  numPerBin, binEdges = numpy.histogram(indices, bins=numBins,
363  weights=1-collapsedMask.astype(int))
364  # Binning is just a histogram, with weights equal to the values.
365  # Use a similar trick to get the bin centers (this deals with different numbers per bin).
366  values = numpy.histogram(indices, bins=numBins, weights=collapsed)[0]/numPerBin
367  binCenters = numpy.histogram(indices, bins=numBins, weights=indices)[0]/numPerBin
368  interp = afwMath.makeInterpolate(binCenters.astype(float),
369  values.astype(float),
371  fitBiasArr = numpy.array([interp.interpolate(i) for i in indices])
372 
373  import lsstDebug
374  if lsstDebug.Info(__name__).display:
375  import matplotlib.pyplot as plot
376  figure = plot.figure(1)
377  figure.clear()
378  axes = figure.add_axes((0.1, 0.1, 0.8, 0.8))
379  axes.plot(indices, collapsed, 'k+')
380  axes.plot(indices, fitBiasArr, 'r-')
381  figure.show()
382  prompt = "Press Enter or c to continue [chp]... "
383  while True:
384  ans = raw_input(prompt).lower()
385  if ans in ("", "c",):
386  break
387  if ans in ("p",):
388  import pdb; pdb.set_trace()
389  elif ans in ("h", ):
390  print "h[elp] c[ontinue] p[db]"
391  figure.close()
392 
393  offImage = ampImage.Factory(ampImage.getDimensions())
394  offArray = offImage.getArray()
395  if shortInd == 1:
396  offArray[:,:] = fitBiasArr[:,numpy.newaxis]
397  else:
398  offArray[:,:] = fitBiasArr[numpy.newaxis,:]
399  else:
400  raise pexExcept.Exception, '%s : %s an invalid overscan type' % \
401  ("overscanCorrection", fitType)
402  ampImage -= offImage
403 
Interpolate::Style stringToInterpStyle(std::string const &style)
Conversion function to switch a string to an Interpolate::Style.
Definition: Interpolate.cc:264
boost::shared_ptr< Interpolate > makeInterpolate(std::vector< double > const &x, std::vector< double > const &y, Interpolate::Style const style=Interpolate::AKIMA_SPLINE)
Definition: Interpolate.cc:355
Pass parameters to a Statistics objectA class to pass parameters which control how the stats are calc...
Definition: Statistics.h:92
Statistics makeStatistics(afwImage::Mask< afwImage::MaskPixel > const &msk, int const flags, StatisticsControl const &sctrl)
Specialization to handle Masks.
Definition: Statistics.cc:1023
def lsst.ip.isr.isr.saturationCorrection (   maskedImage,
  saturation,
  fwhm,
  growFootprints = 1,
  interpolate = True,
  maskName = 'SAT',
  fallbackValue = None 
)
Mark saturated pixels and optionally interpolate over them

@param[in,out] maskedImage  afw.image.MaskedImage to process
@param[in] saturation  saturation level (used as a detection threshold)
@param[in] fwhm  FWHM of double Gaussian smoothing kernel
@param[in] growFootprints  amount by which to grow footprints of detected regions
@param[in] interpolate  interpolate over saturated pixels?
@param[in] maskName  mask plane name
@param[in] fallbackValue  value of last resort for interpolation

Definition at line 186 of file isr.py.

187  fallbackValue=None):
188  """Mark saturated pixels and optionally interpolate over them
189 
190  @param[in,out] maskedImage afw.image.MaskedImage to process
191  @param[in] saturation saturation level (used as a detection threshold)
192  @param[in] fwhm FWHM of double Gaussian smoothing kernel
193  @param[in] growFootprints amount by which to grow footprints of detected regions
194  @param[in] interpolate interpolate over saturated pixels?
195  @param[in] maskName mask plane name
196  @param[in] fallbackValue value of last resort for interpolation
197  """
198  defectList = makeThresholdMask(
199  maskedImage = maskedImage,
200  threshold = saturation,
201  growFootprints = growFootprints,
202  maskName = maskName,
203  )
204  if interpolate:
205  interpolateDefectList(maskedImage, defectList, fwhm, fallbackValue=fallbackValue)
def interpolateDefectList
Definition: isr.py:67
def makeThresholdMask
Definition: isr.py:149
def lsst.ip.isr.isr.transposeDefectList (   defectList)
Make a transposed copy of a defect list

@param[in] defectList  defect list
@return meas.algorithms.DefectListT with transposed defects

Definition at line 103 of file isr.py.

104 def transposeDefectList(defectList):
105  """Make a transposed copy of a defect list
106 
107  @param[in] defectList defect list
108  @return meas.algorithms.DefectListT with transposed defects
109  """
110  retDefectList = measAlg.DefectListT()
111  for defect in defectList:
112  bbox = defect.getBBox()
113  nbbox = afwGeom.Box2I(afwGeom.Point2I(bbox.getMinY(), bbox.getMinX()),
114  afwGeom.Extent2I(bbox.getDimensions()[1], bbox.getDimensions()[0]))
115  retDefectList.push_back(measAlg.Defect(nbbox))
116  return retDefectList
def transposeDefectList
Definition: isr.py:103
An integer coordinate rectangle.
Definition: Box.h:53
Encapsulate information about a bad portion of a detector.
Definition: Interp.h:70
def lsst.ip.isr.isr.transposeMaskedImage (   maskedImage)
Make a transposed copy of a masked image

@param[in] maskedImage  afw.image.MaskedImage to process
@return transposed masked image

Definition at line 55 of file isr.py.

55 
56 def transposeMaskedImage(maskedImage):
57  """Make a transposed copy of a masked image
58 
59  @param[in] maskedImage afw.image.MaskedImage to process
60  @return transposed masked image
61  """
62  transposed = maskedImage.Factory(afwGeom.Extent2I(maskedImage.getHeight(), maskedImage.getWidth()))
63  transposed.getImage().getArray()[:] = maskedImage.getImage().getArray().T
64  transposed.getMask().getArray()[:] = maskedImage.getMask().getArray().T
65  transposed.getVariance().getArray()[:] = maskedImage.getVariance().getArray().T
66  return transposed
def transposeMaskedImage
Definition: isr.py:55
def lsst.ip.isr.isr.updateVariance (   maskedImage,
  gain,
  readNoise 
)
Set the variance plane based on the image plane

@param[in,out] maskedImage  afw.image.MaskedImage; image plane is read and variance plane is written
@param[in] gain  amplifier gain (e-/ADU)
@param[in] readNoise  amplifier read noise (ADU/pixel)

Definition at line 231 of file isr.py.

232 def updateVariance(maskedImage, gain, readNoise):
233  """Set the variance plane based on the image plane
234 
235  @param[in,out] maskedImage afw.image.MaskedImage; image plane is read and variance plane is written
236  @param[in] gain amplifier gain (e-/ADU)
237  @param[in] readNoise amplifier read noise (ADU/pixel)
238  """
239  var = maskedImage.getVariance()
240  var <<= maskedImage.getImage()
241  var /= gain
242  var += readNoise**2
def updateVariance
Definition: isr.py:231