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 | Private Attributes | List of all members
lsst.afw.cameraGeom.detectorCollection.DetectorCollection Class Reference

An immutable collection of Detectors that can be accessed by name or ID. More...

Inheritance diagram for lsst.afw.cameraGeom.detectorCollection.DetectorCollection:

Public Member Functions

def __init__
 Construct a DetectorCollection. More...
 
def __iter__
 Support the iter function: return an iterator over all detectors in this collection. More...
 
def __len__
 Support the len function: return the number of detectors. More...
 
def __getitem__
 Support the [key] operator: return the specified detector. More...
 
def __contains__
 Implement the "in" operator: return true if the specified detector is in the collection. More...
 
def getNameIter
 Get an iterator over detector names. More...
 
def getIdIter
 Get an iterator over detector IDs. More...
 
def getFpBBox
 Return a focal plane bounding box that encompasses all detectors. More...
 

Private Attributes

 _idDetectorDict
 
 _nameDetectorDict
 
 _fpBBox
 

Detailed Description

An immutable collection of Detectors that can be accessed by name or ID.

Definition at line 26 of file detectorCollection.py.

Constructor & Destructor Documentation

def lsst.afw.cameraGeom.detectorCollection.DetectorCollection.__init__ (   self,
  detectorList 
)

Construct a DetectorCollection.

Parameters
[in]detectorLista sequence of detectors in index order

Definition at line 29 of file detectorCollection.py.

29 
30  def __init__(self, detectorList):
31  """!Construct a DetectorCollection
32 
33  @param[in] detectorList a sequence of detectors in index order
34  """
35  self._idDetectorDict = dict((d.getId(), d) for d in detectorList)
36  self._nameDetectorDict = dict((d.getName(), d) for d in detectorList)
37  self._fpBBox = Box2D()
38  for detector in detectorList:
39  for corner in detector.getCorners(FOCAL_PLANE):
40  self._fpBBox.include(corner)
41  if len(self._idDetectorDict) < len(detectorList):
42  raise RuntimeError("Detector IDs are not unique")
43  if len(self._nameDetectorDict) < len(detectorList):
44  raise RuntimeError("Detector names are not unique")
A floating-point coordinate rectangle geometry.
Definition: Box.h:271

Member Function Documentation

def lsst.afw.cameraGeom.detectorCollection.DetectorCollection.__contains__ (   self,
  key 
)

Implement the "in" operator: return true if the specified detector is in the collection.

Parameters
[in]keydetector name or ID

Definition at line 65 of file detectorCollection.py.

65 
66  def __contains__(self, key):
67  """!Implement the "in" operator: return true if the specified detector is in the collection
68 
69  @param[in] key detector name or ID
70  """
71  if isinstance(key, basestring):
72  return key in self._nameDetectorDict
73  else:
74  return key in self._idDetectorDict
def __contains__
Implement the &quot;in&quot; operator: return true if the specified detector is in the collection.
def lsst.afw.cameraGeom.detectorCollection.DetectorCollection.__getitem__ (   self,
  key 
)

Support the [key] operator: return the specified detector.

Parameters
[in]keydetector name or ID

Definition at line 55 of file detectorCollection.py.

55 
56  def __getitem__(self, key):
57  """!Support the [key] operator: return the specified detector
58 
59  @param[in] key detector name or ID
60  """
61  if isinstance(key, basestring):
62  return self._nameDetectorDict[key]
63  else:
64  return self._idDetectorDict[key]
def __getitem__
Support the [key] operator: return the specified detector.
def lsst.afw.cameraGeom.detectorCollection.DetectorCollection.__iter__ (   self)

Support the iter function: return an iterator over all detectors in this collection.

Definition at line 45 of file detectorCollection.py.

45 
46  def __iter__(self):
47  """!Support the iter function: return an iterator over all detectors in this collection
48  """
49  return self._idDetectorDict.itervalues()
def __iter__
Support the iter function: return an iterator over all detectors in this collection.
def lsst.afw.cameraGeom.detectorCollection.DetectorCollection.__len__ (   self)

Support the len function: return the number of detectors.

Definition at line 50 of file detectorCollection.py.

50 
51  def __len__(self):
52  """!Support the len function: return the number of detectors
53  """
54  return len(self._idDetectorDict)
def __len__
Support the len function: return the number of detectors.
def lsst.afw.cameraGeom.detectorCollection.DetectorCollection.getFpBBox (   self)

Return a focal plane bounding box that encompasses all detectors.

Definition at line 85 of file detectorCollection.py.

85 
86  def getFpBBox(self):
87  """!Return a focal plane bounding box that encompasses all detectors
88  """
89  return self._fpBBox
def getFpBBox
Return a focal plane bounding box that encompasses all detectors.
def lsst.afw.cameraGeom.detectorCollection.DetectorCollection.getIdIter (   self)

Get an iterator over detector IDs.

Definition at line 80 of file detectorCollection.py.

80 
81  def getIdIter(self):
82  """!Get an iterator over detector IDs
83  """
84  return self._idDetectorDict.iterkeys()
def lsst.afw.cameraGeom.detectorCollection.DetectorCollection.getNameIter (   self)

Get an iterator over detector names.

Definition at line 75 of file detectorCollection.py.

75 
76  def getNameIter(self):
77  """!Get an iterator over detector names
78  """
79  return self._nameDetectorDict.iterkeys()
def getNameIter
Get an iterator over detector names.

Member Data Documentation

lsst.afw.cameraGeom.detectorCollection.DetectorCollection._fpBBox
private

Definition at line 36 of file detectorCollection.py.

lsst.afw.cameraGeom.detectorCollection.DetectorCollection._idDetectorDict
private

Definition at line 34 of file detectorCollection.py.

lsst.afw.cameraGeom.detectorCollection.DetectorCollection._nameDetectorDict
private

Definition at line 35 of file detectorCollection.py.


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