LSSTApplications  17.0+115,17.0+12,17.0+65,18.0.0+14,18.0.0+29,18.0.0+6,18.0.0+70,18.0.0-4-g68ffd23+1,18.1.0-1-g0001055+9,18.1.0-1-g03d53ef+2,18.1.0-1-g1349e88+44,18.1.0-1-g2505f39+35,18.1.0-1-g5315e5e+2,18.1.0-1-g5e4b7ea+11,18.1.0-1-g7e8fceb+2,18.1.0-1-g85f8cd4+38,18.1.0-1-gd55f500+25,18.1.0-13-gfe4edf0b,18.1.0-14-g259bd21+9,18.1.0-14-gd04256d+35,18.1.0-2-g4903023+12,18.1.0-2-g5f9922c+13,18.1.0-2-gd3b74e5+3,18.1.0-2-gfbf3545+22,18.1.0-2-gfefb8b5+34,18.1.0-22-g936f6a9b4,18.1.0-23-g364d03b8,18.1.0-23-g52ab674,18.1.0-3-g52aa583+17,18.1.0-3-g8f4a2b1+32,18.1.0-3-gb69f684+30,18.1.0-4-g1ee41a7+2,18.1.0-5-g6dbcb01+31,18.1.0-5-gc286bb7+4,18.1.0-6-g857e778+4,18.1.0-7-gae09a6d+18,18.1.0-8-g42b2ab3+10,18.1.0-8-gc69d46e+17,18.1.0-9-gee19f03+2,w.2019.44
LSSTDataManagementBasePackage
Public Member Functions | Public Attributes | List of all members
lsst.afw.cameraGeom.fitsUtils.DetectorBuilder Class Reference

Public Member Functions

def __init__ (self, detectorFileName, ampFileNameList, inAmpCoords=True, plateScale=1., radialCoeffs=(0., 1.), clobberMetadata=False, doRaise=True)
 
def buildDetector (self)
 
def makeExposure (self, im, mask=None, variance=None)
 

Public Attributes

 inAmpCoords
 
 defaultAmpMap
 
 defaultDetectorMap
 
 detectorMetadata
 
 ampMetadataList
 
 detector
 
 doRaise
 
 plateScale
 
 focalPlaneToField
 

Detailed Description

Parameters
----------
detectorFileName : `str`
    FITS file containing the detector description.
    May use [] notation to specify an extension in an MEF.
ampFileNameList : `list` of `str`
    List of FITS file names to use in building the amps.
    May contain duplicate entries if the raw data are assembled.
inAmpCoords : `bool`
    True if raw data are in amp coordinates, False if raw data
    are assembled into pseudo detector pixel arrays.
plateScale : `float`
    Nominal platescale (arcsec/mm).
radialCoeffs : `iterable` of `float`
    Radial distortion coefficients for a radial polynomial in
    normalized units.
clobberMetadata : `bool`
    Clobber metadata from input files if overridden in
    _sanitizeMetadata().
doRaise : `bool`
    Raise exception if not all non-defaulted keywords are defined?

Definition at line 155 of file fitsUtils.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.afw.cameraGeom.fitsUtils.DetectorBuilder.__init__ (   self,
  detectorFileName,
  ampFileNameList,
  inAmpCoords = True,
  plateScale = 1.,
  radialCoeffs = (0., 1.),
  clobberMetadata = False,
  doRaise = True 
)

Definition at line 180 of file fitsUtils.py.

180  radialCoeffs=(0., 1.), clobberMetadata=False, doRaise=True):
181  self.inAmpCoords = inAmpCoords
182  self.defaultAmpMap = self._makeDefaultAmpMap()
183  self.defaultDetectorMap = self._makeDefaultDetectorMap()
184  self.detectorMetadata = readMetadata(detectorFileName)
185  self._sanitizeHeaderMetadata(
186  self.detectorMetadata, clobber=clobberMetadata)
187  self.ampMetadataList = []
188  self.detector = None
189  self.doRaise = doRaise
190  for fileName in ampFileNameList:
191  self.ampMetadataList.append(readMetadata(fileName))
192  self._sanitizeHeaderMetadata(
193  self.ampMetadataList[-1], clobber=clobberMetadata)
194  self.plateScale = plateScale
195  self.focalPlaneToField = self._makeRadialTransform(radialCoeffs)
196 
std::shared_ptr< FrameSet > append(FrameSet const &first, FrameSet const &second)
Construct a FrameSet that performs two transformations in series.
Definition: functional.cc:33

Member Function Documentation

◆ buildDetector()

def lsst.afw.cameraGeom.fitsUtils.DetectorBuilder.buildDetector (   self)
Take all the information and build a Detector object.
The Detector object is necessary for doing things like assembly.

Returns
-------
detector : `lsst.afw.cameraGeom.Detector`
     The detector.

Definition at line 405 of file fitsUtils.py.

405  def buildDetector(self):
406  """Take all the information and build a Detector object.
407  The Detector object is necessary for doing things like assembly.
408 
409  Returns
410  -------
411  detector : `lsst.afw.cameraGeom.Detector`
412  The detector.
413  """
414  if self.detector is not None:
415  return self.detector
416 
417  schema = afwTable.AmpInfoTable.makeMinimalSchema()
418  ampInfo = afwTable.AmpInfoCatalog(schema)
419  for ampMetadata in self.ampMetadataList:
420  record = ampInfo.addNew()
421  self.defaultAmpMap.setAttributes(record, ampMetadata, self.doRaise)
422  record.setHasRawInfo(True)
423 
424  detConfig = afwCameraGeom.DetectorConfig()
425  self.defaultDetectorMap.setAttributes(
426  detConfig, self.detectorMetadata, self.doRaise)
427  self.detector = afwCameraGeom.makeDetector(
428  detConfig, ampInfo, self.focalPlaneToField)
429  return self.detector
430 

◆ makeExposure()

def lsst.afw.cameraGeom.fitsUtils.DetectorBuilder.makeExposure (   self,
  im,
  mask = None,
  variance = None 
)
Method for constructing an exposure object from an image and the
information contained in this class to construct the Detector.

Parameters
----------
im : `lsst.afw.image.Image`
    Image used to construct the exposure.
mask : `lsst.afw.image.MaskU`
    Optional mask plane.
variance : `lsst.afw.image.Image`
    Optional variance plance as an image of the same type as im.

Returns
-------
exposure : `lsst.afw.image.Exposure`
    Constructed exposure (specific type will match that of ``im``).

Definition at line 431 of file fitsUtils.py.

431  def makeExposure(self, im, mask=None, variance=None):
432  """Method for constructing an exposure object from an image and the
433  information contained in this class to construct the Detector.
434 
435  Parameters
436  ----------
437  im : `lsst.afw.image.Image`
438  Image used to construct the exposure.
439  mask : `lsst.afw.image.MaskU`
440  Optional mask plane.
441  variance : `lsst.afw.image.Image`
442  Optional variance plance as an image of the same type as im.
443 
444  Returns
445  -------
446  exposure : `lsst.afw.image.Exposure`
447  Constructed exposure (specific type will match that of ``im``).
448  """
449  if mask is None:
450  mask = afwImage.Mask(im.getDimensions())
451  if variance is None:
452  variance = im
453  mi = afwImage.makeMaskedImage(im, mask, variance)
454  detector = self.buildDetector()
455 
456  exp = afwImage.makeExposure(mi)
457  exp.setDetector(detector)
458  return exp
459 
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > * makeMaskedImage(typename std::shared_ptr< Image< ImagePixelT >> image, typename std::shared_ptr< Mask< MaskPixelT >> mask=Mask< MaskPixelT >(), typename std::shared_ptr< Image< VariancePixelT >> variance=Image< VariancePixelT >())
A function to return a MaskedImage of the correct type (cf.
Definition: MaskedImage.h:1277
std::shared_ptr< Exposure< ImagePixelT, MaskPixelT, VariancePixelT > > makeExposure(MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > &mimage, std::shared_ptr< geom::SkyWcs const > wcs=std::shared_ptr< geom::SkyWcs const >())
A function to return an Exposure of the correct type (cf.
Definition: Exposure.h:453
Represent a 2-dimensional array of bitmask pixels.
Definition: Mask.h:77

Member Data Documentation

◆ ampMetadataList

lsst.afw.cameraGeom.fitsUtils.DetectorBuilder.ampMetadataList

Definition at line 187 of file fitsUtils.py.

◆ defaultAmpMap

lsst.afw.cameraGeom.fitsUtils.DetectorBuilder.defaultAmpMap

Definition at line 182 of file fitsUtils.py.

◆ defaultDetectorMap

lsst.afw.cameraGeom.fitsUtils.DetectorBuilder.defaultDetectorMap

Definition at line 183 of file fitsUtils.py.

◆ detector

lsst.afw.cameraGeom.fitsUtils.DetectorBuilder.detector

Definition at line 188 of file fitsUtils.py.

◆ detectorMetadata

lsst.afw.cameraGeom.fitsUtils.DetectorBuilder.detectorMetadata

Definition at line 184 of file fitsUtils.py.

◆ doRaise

lsst.afw.cameraGeom.fitsUtils.DetectorBuilder.doRaise

Definition at line 189 of file fitsUtils.py.

◆ focalPlaneToField

lsst.afw.cameraGeom.fitsUtils.DetectorBuilder.focalPlaneToField

Definition at line 195 of file fitsUtils.py.

◆ inAmpCoords

lsst.afw.cameraGeom.fitsUtils.DetectorBuilder.inAmpCoords

Definition at line 181 of file fitsUtils.py.

◆ plateScale

lsst.afw.cameraGeom.fitsUtils.DetectorBuilder.plateScale

Definition at line 194 of file fitsUtils.py.


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