lsst.afw  14.0-35-g29d3a87a7
Classes | Functions
lsst.afw.cameraGeom.utils Namespace Reference

Classes

class  ButlerImage
 
class  FakeImageDataSource
 

Functions

def prepareWcsData (wcs, amp, isTrimmed=True)
 Put Wcs from an Amp image into CCD coordinates. More...
 
def plotFocalPlane (camera, fieldSizeDeg_x=0, fieldSizeDeg_y=None, dx=0.1, dy=0.1, figsize=(10., 10.), useIds=False, showFig=True, savePath=None)
 Make a plot of the focal plane along with a set points that sample the field of view. More...
 
def makeImageFromAmp (amp, imValue=None, imageFactory=afwImage.ImageU, markSize=10, markValue=0, scaleGain=lambda gain:(gain *1000)//10)
 Make an image from an amp object. More...
 
def calcRawCcdBBox (ccd)
 Calculate the raw ccd bounding box. More...
 
def makeImageFromCcd (ccd, isTrimmed=True, showAmpGain=True, imageFactory=afwImage.ImageU, rcMarkSize=10, binSize=1)
 Make an Image of a Ccd. More...
 
def rawCallback (im, ccd=None, imageSource=None, correctGain=False, subtractBias=False, convertToFloat=False)
 A callback function that may or may not subtract bias/correct gain/trim a raw image. More...
 
def overlayCcdBoxes (ccd, untrimmedCcdBbox=None, nQuarter=0, isTrimmed=False, ccdOrigin=(0, 0), display=None, binSize=1)
 Overlay bounding boxes on an image display. More...
 
def showAmp (amp, imageSource=FakeImageDataSource(isTrimmed=False), display=None, overlay=True, imageFactory=afwImage.ImageU)
 Show an amp in an image display. More...
 
def showCcd (ccd, imageSource=FakeImageDataSource(), display=None, frame=None, overlay=True, imageFactory=afwImage.ImageF, binSize=1, inCameraCoords=False)
 Show a CCD on display. More...
 
def getCcdInCamBBoxList (ccdList, binSize, pixelSize_o, origin)
 Get the bounding boxes of a list of Detectors within a camera sized pixel grid. More...
 
def getCameraImageBBox (camBbox, pixelSize, bufferSize)
 Get the bounding box of a camera sized image in pixels. More...
 
def makeImageFromCamera (camera, detectorNameList=None, background=numpy.nan, bufferSize=10, imageSource=FakeImageDataSource(), imageFactory=afwImage.ImageU, binSize=1)
 Make an Image of a Camera. More...
 
def showCamera (camera, imageSource=FakeImageDataSource(), imageFactory=afwImage.ImageF, detectorNameList=None, binSize=10, bufferSize=10, frame=None, overlay=True, title="", showWcs=None, ctype=afwDisplay.GREEN, textSize=1.25, originAtCenter=True, display=None, kwargs)
 Show a Camera on display, with the specified display. More...
 
def makeFocalPlaneWcs (pixelSize, referencePixel)
 Make a WCS for the focal plane geometry (i.e. More...
 
def findAmp (ccd, pixelPosition)
 Find the Amp with the specified pixel position within the composite. More...
 

Function Documentation

◆ calcRawCcdBBox()

def lsst.afw.cameraGeom.utils.calcRawCcdBBox (   ccd)

Calculate the raw ccd bounding box.

Parameters
[in]ccdDetector for with to calculate the un-trimmed bounding box
Returns
Box2I of the un-trimmed Detector, or None if there is not enough information to calculate raw BBox

Definition at line 202 of file utils.py.

◆ findAmp()

def lsst.afw.cameraGeom.utils.findAmp (   ccd,
  pixelPosition 
)

Find the Amp with the specified pixel position within the composite.

Parameters
[in]ccdDetector to look in
[in]pixelPositionPoint2I containing the pixel position
Returns
Amp record in which pixelPosition falls or None if no Amp found.

Definition at line 857 of file utils.py.

◆ getCameraImageBBox()

def lsst.afw.cameraGeom.utils.getCameraImageBBox (   camBbox,
  pixelSize,
  bufferSize 
)

Get the bounding box of a camera sized image in pixels.

Parameters
[in]camBboxCamera bounding box in focal plane coordinates (mm)
[in]pixelSizeSize of a detector pixel in mm
[in]bufferSizeBuffer around edge of image in pixels
Returns
the resulting bounding box

Definition at line 677 of file utils.py.

◆ getCcdInCamBBoxList()

def lsst.afw.cameraGeom.utils.getCcdInCamBBoxList (   ccdList,
  binSize,
  pixelSize_o,
  origin 
)

Get the bounding boxes of a list of Detectors within a camera sized pixel grid.

Parameters
[in]ccdListList of Detector
[in]binSizeBinning factor
[in]pixelSize_oSize of the pixel in mm.
[in]originorigin of the camera pixel grid in pixels
Returns
a list of bounding boxes in camera pixel coordinates

Definition at line 643 of file utils.py.

◆ makeFocalPlaneWcs()

def lsst.afw.cameraGeom.utils.makeFocalPlaneWcs (   pixelSize,
  referencePixel 
)

Make a WCS for the focal plane geometry (i.e.

returning positions in "mm")

Parameters
[in]pixelSizeSize of the image pixels in physical units
[in]referencePixelPixel for origin of WCS
Returns
Wcs object for mapping between pixels and focal plane.

Definition at line 833 of file utils.py.

◆ makeImageFromAmp()

def lsst.afw.cameraGeom.utils.makeImageFromAmp (   amp,
  imValue = None,
  imageFactory = afwImage.ImageU,
  markSize = 10,
  markValue = 0,
  scaleGain = lambda gain: (gain*1000)//10 
)

Make an image from an amp object.

Since images are integer images by default, the gain needs to be scaled to give enough dynamic range to see variation from amp to amp. The scaling algorithm is assignable.

Parameters
[in]ampAmp record to use for constructing the raw amp image
[in]imValueValue to assign to the constructed image scaleGain(gain) is used if not set
[in]imageFactoryType of image to construct
[in]markSizeSize of mark at read corner in pixels
[in]markValueValue of pixels in the read corner mark
[in]scaleGainThe function by which to scale the gain
Returns
an untrimmed amp image

Definition at line 154 of file utils.py.

◆ makeImageFromCamera()

def lsst.afw.cameraGeom.utils.makeImageFromCamera (   camera,
  detectorNameList = None,
  background = numpy.nan,
  bufferSize = 10,
  imageSource = FakeImageDataSource(),
  imageFactory = afwImage.ImageU,
  binSize = 1 
)

Make an Image of a Camera.

Parameters
[in]cameraCamera object to use to make the image
[in]detectorNameListList of detector names to use in building the image. Use all Detectors if None.
[in]backgroundValue to use where there is no Detector
[in]bufferSizeSize of border in binned pixels to make around the camera image
[in]imageSourceSource to get ccd images. Must have a getCcdImage method
[in]imageFactoryType of image to build
[in]binSizebin factor
Returns
an image of the camera

Definition at line 695 of file utils.py.

◆ makeImageFromCcd()

def lsst.afw.cameraGeom.utils.makeImageFromCcd (   ccd,
  isTrimmed = True,
  showAmpGain = True,
  imageFactory = afwImage.ImageU,
  rcMarkSize = 10,
  binSize = 1 
)

Make an Image of a Ccd.

Parameters
[in]ccdDetector to use in making the image
[in]isTrimmedAssemble a trimmed Detector image if True
[in]showAmpGainUse the per amp gain to color the pixels in the image
[in]imageFactoryImage type to generate
[in]rcMarkSizeSize of the mark to make in the amp images at the read corner
[in]binSizeBin the image by this factor in both dimensions
Returns
Image of the Detector

Definition at line 220 of file utils.py.

◆ overlayCcdBoxes()

def lsst.afw.cameraGeom.utils.overlayCcdBoxes (   ccd,
  untrimmedCcdBbox = None,
  nQuarter = 0,
  isTrimmed = False,
  ccdOrigin = (0, 0),
  display = None,
  binSize = 1 
)

Overlay bounding boxes on an image display.

Parameters
[in]ccdDetector to iterate for the amp bounding boxes
[in]untrimmedCcdBboxBounding box of the un-trimmed Detector
[in]nQuarternumber of 90 degree rotations to apply to the bounding boxes (used for rotated chips)
[in]isTrimmedIs the Detector image over which the boxes are layed trimmed?
[in]ccdOriginDetector origin relative to the parent origin if in a larger pixel grid
[in]displayimage display to display on
[in]binSizebinning factor

The colours are: Entire detector GREEN All data for amp GREEN HorizontalPrescan YELLOW HorizontalOverscan RED Data BLUE VerticalOverscan MAGENTA VerticalOverscan MAGENTA

Definition at line 469 of file utils.py.

◆ plotFocalPlane()

def lsst.afw.cameraGeom.utils.plotFocalPlane (   camera,
  fieldSizeDeg_x = 0,
  fieldSizeDeg_y = None,
  dx = 0.1,
  dy = 0.1,
  figsize = (10., 10.),
  useIds = False,
  showFig = True,
  savePath = None 
)

Make a plot of the focal plane along with a set points that sample the field of view.

Parameters
[in]cameraa camera object
[in]fieldSizeDeg_xAmount of the field to sample in x in degrees
[in]fieldSizeDeg_yAmount of the field to sample in y in degrees
[in]dxSpacing of sample points in x in degrees
[in]dySpacing of sample points in y in degrees
[in]figsizematplotlib style tuple indicating the size of the figure in inches
[in]useIdsLabel detectors by name, not id
[in]showFigDisplay the figure on the screen?
[in]savePathIf not None, save a copy of the figure to this name

Definition at line 73 of file utils.py.

◆ prepareWcsData()

def lsst.afw.cameraGeom.utils.prepareWcsData (   wcs,
  amp,
  isTrimmed = True 
)

Put Wcs from an Amp image into CCD coordinates.

Parameters
[in,out]wcsWCS object to modify in place
[in]ampAmp object to use
[in]isTrimmedIs the image to which the WCS refers trimmed of non-imaging pixels?

Definition at line 49 of file utils.py.

◆ rawCallback()

def lsst.afw.cameraGeom.utils.rawCallback (   im,
  ccd = None,
  imageSource = None,
  correctGain = False,
  subtractBias = False,
  convertToFloat = False 
)

A callback function that may or may not subtract bias/correct gain/trim a raw image.

Parameters
imAn image of a chip, ready to be binned and maybe rotated. Maybe an Exposure, a MaskedImage or an Image
ccdThe Detector; if None assume that im is an exposure and extract it's Detector
imageSourceAn object derived from FakeImageDataSource (typically ButlerImage)
correctGainCorrect each amplifier for its gain
subtractBiasSubtract the bias from each amplifier
convertToFloatConvert im to floating point if possible

N.b. if imageSource is derived from ButlerImage, imageSource.butler is available

Definition at line 417 of file utils.py.

◆ showAmp()

def lsst.afw.cameraGeom.utils.showAmp (   amp,
  imageSource = FakeImageDataSource(isTrimmed=False),
  display = None,
  overlay = True,
  imageFactory = afwImage.ImageU 
)

Show an amp in an image display.

Parameters
[in]ampamp record to use in display
[in]imageSourceSource for getting the amp image. Must have a getAmpImage method.
[in]displayimage display to use
[in]overlayOverlay bounding boxes?
[in]imageFactoryType of image to display (only used if ampImage is None)

Definition at line 558 of file utils.py.

◆ showCamera()

def lsst.afw.cameraGeom.utils.showCamera (   camera,
  imageSource = FakeImageDataSource(),
  imageFactory = afwImage.ImageF,
  detectorNameList = None,
  binSize = 10,
  bufferSize = 10,
  frame = None,
  overlay = True,
  title = "",
  showWcs = None,
  ctype = afwDisplay.GREEN,
  textSize = 1.25,
  originAtCenter = True,
  display = None,
  kwargs 
)

Show a Camera on display, with the specified display.

The rotation of the sensors is snapped to the nearest multiple of 90 deg. Also note that the pixel size is constant over the image array. The lower left corner (LLC) of each sensor amp is snapped to the LLC of the pixel containing the LLC of the image. if overlay show the IDs and detector boundaries

Parameters
[in]cameraCamera to show
[in]imageSourceSource to get Ccd images from. Must have a getCcdImage method.
[in]imageFactoryType of image to make
[in]detectorNameListList of names of Detectors to use. If None use all
[in]binSizebin factor
[in]bufferSizesize of border in binned pixels to make around camera image.
[in]framespecify image display (
Deprecated:
; new code should use display)
Parameters
[in]overlayOverlay Detector IDs and boundaries?
[in]titleTitle in display
[in]showWcswhether to include a WCS in the display
[in]ctypeColor to use when drawing Detector boundaries
[in]textSizeSize of detector labels
[in]originAtCenterPut origin of the camera WCS at the center of the image? Else it will be LL
[in]displayimage display on which to display
[in]**kwargsall remaining keyword arguments are passed to makeImageFromCamera
Returns
the mosaic image

Definition at line 752 of file utils.py.

◆ showCcd()

def lsst.afw.cameraGeom.utils.showCcd (   ccd,
  imageSource = FakeImageDataSource(),
  display = None,
  frame = None,
  overlay = True,
  imageFactory = afwImage.ImageF,
  binSize = 1,
  inCameraCoords = False 
)

Show a CCD on display.

Parameters
[in]ccdDetector to use in display
[in]imageSourceSource for producing images to display. Must have a getCcdImage method.
[in]displayimage display to use
[in]frameframe ID on which to display
[in]overlayShow amp bounding boxes on the displayed image?
[in]imageFactoryThe image factory to use in generating the images.
[in]binSizeBinning factor
[in]inCameraCoordsShow the Detector in camera coordinates?

Definition at line 601 of file utils.py.