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 Types | Private Member Functions | Private Attributes | List of all members
lsst::afw::cameraGeom::Detector Class Reference

#include <Detector.h>

Public Member Functions

 Detector (std::string const &name, int id, DetectorType type, std::string const &serial, geom::Box2I const &bbox, lsst::afw::table::AmpInfoCatalog const &ampInfoCatalog, Orientation const &orientation, geom::Extent2D const &pixelSize, CameraTransformMap::Transforms const &transforms)
 
 ~Detector ()
 
std::string getName () const
 
int getId () const
 
DetectorType getType () const
 
std::string getSerial () const
 
lsst::afw::geom::Box2I getBBox () const
 
std::vector< geom::Point2DgetCorners (CameraSys const &cameraSys) const
 
std::vector< geom::Point2DgetCorners (CameraSysPrefix const &cameraSysPrefix) const
 
CameraPoint getCenter (CameraSys const &cameraSys) const
 
CameraPoint getCenter (CameraSysPrefix const &cameraSysPrefix) const
 
lsst::afw::table::AmpInfoCatalog
const 
getAmpInfoCatalog () const
 
Orientation const getOrientation () const
 
geom::Extent2D getPixelSize () const
 
CameraTransformMap const getTransformMap () const
 
lsst::afw::table::AmpInfoCatalog::const_iterator begin () const
 
lsst::afw::table::AmpInfoCatalog::const_iterator end () const
 
lsst::afw::table::AmpInfoRecord
const & 
operator[] (size_t i) const
 
lsst::afw::table::AmpInfoRecord
const & 
operator[] (std::string const &name) const
 
size_t size () const
 
bool hasTransform (CameraSys const &cameraSys) const
 
bool hasTransform (CameraSysPrefix const &cameraSysPrefix) const
 
boost::shared_ptr
< afw::geom::XYTransform const > 
getTransform (CameraSys const &cameraSys) const
 
boost::shared_ptr
< afw::geom::XYTransform const > 
getTransform (CameraSysPrefix const &cameraSysPrefix) const
 
CameraPoint makeCameraPoint (geom::Point2D point, CameraSys cameraSys) const
 
CameraPoint makeCameraPoint (geom::Point2D point, CameraSysPrefix cameraSysPrefix) const
 
CameraSys const makeCameraSys (CameraSys const &cameraSys) const
 
CameraSys const makeCameraSys (CameraSysPrefix const &cameraSysPrefix) const
 
CameraPoint transform (CameraPoint const &fromCameraPoint, CameraSys const &toSys) const
 
CameraPoint transform (CameraPoint const &fromCameraPoint, CameraSysPrefix const &toSys) const
 

Private Types

typedef boost::unordered_map
< std::string,
table::AmpInfoCatalog::const_iterator
_AmpInfoMap
 

Private Member Functions

void _init ()
 

Private Attributes

std::string _name
 name of detector's location in the camera More...
 
int _id
 detector numeric ID More...
 
DetectorType _type
 type of detectorsize_t More...
 
std::string _serial
 serial "number" that identifies the physical detector More...
 
geom::Box2I _bbox
 bounding box More...
 
table::AmpInfoCatalog _ampInfoCatalog
 list of amplifier data More...
 
_AmpInfoMap _ampNameIterMap
 map of amplifier name: catalog iterator More...
 
Orientation _orientation
 position and orientation of detector in focal plane More...
 
geom::Extent2D _pixelSize
 pixel size (mm) More...
 
CameraTransformMap _transformMap
 registry of coordinate transforms More...
 

Detailed Description

Information about a CCD or other imaging detector

Supports conversion of CameraPoint between FOCAL_PLANE and pixel-based coordinate systems. Also an iterator over amplifiers (in C++ use begin(), end(), in Python use "for amplifier in detector").

Todo:
: this would probably be a bit more robust if it used a ConstAmpInfoCatalog (a catalog with const records) but I don't think const catalogs really work yet; for instance it is not possible to construct one from a non-const catalog, so I don't know how to construct one.
Note
: code definitions use lsst::afw::table:: instead of table:: because the latter confused swig when I tried it. This is a known issue: ticket #2461.

Definition at line 64 of file Detector.h.

Member Typedef Documentation

typedef boost::unordered_map<std::string, table::AmpInfoCatalog::const_iterator> lsst::afw::cameraGeom::Detector::_AmpInfoMap
private

Definition at line 247 of file Detector.h.

Constructor & Destructor Documentation

lsst::afw::cameraGeom::Detector::Detector ( std::string const &  name,
int  id,
DetectorType  type,
std::string const &  serial,
geom::Box2I const &  bbox,
lsst::afw::table::AmpInfoCatalog const &  ampInfoCatalog,
Orientation const &  orientation,
geom::Extent2D const &  pixelSize,
CameraTransformMap::Transforms const &  transforms 
)
explicit

Make a Detector

Warning
  • The keys for the detector-specific coordinate systems in the transform registry must include the detector name (even though this is redundant).
Exceptions
lsst::pex::exceptions::InvalidParameterErrorif:
  • any amplifier names are not unique
  • any CamerSys in transformMap has a detector name other than "" or this detector's name
Parameters
namename of detector's location in the camera
iddetector integer ID; used as keys in some tables
typetype of detector
serialserial "number" that identifies the physical detector
bboxbounding box
ampInfoCatalogcatalog of amplifier information
orientationdetector position and orientation in focal plane
pixelSizepixel size (mm)
transformsmap of CameraSys: lsst::afw::geom::XYTransform, where each transform's "forwardTransform" method transforms from PIXELS to the specified camera system

Definition at line 31 of file Detector.cc.

41  :
42  _name(name),
43  _id(id),
44  _type(type),
45  _serial(serial),
46  _bbox(bbox),
47  _ampInfoCatalog(ampInfoCatalog),
49  _orientation(orientation),
50  _pixelSize(pixelSize),
51  _transformMap(CameraSys(PIXELS.getSysName(), name), transforms)
52 {
53  _init();
54 }
table::Key< std::string > name
Definition: ApCorrMap.cc:71
geom::Box2I _bbox
bounding box
Definition: Detector.h:264
CameraSysPrefix const PIXELS
Definition: CameraSys.cc:33
CameraTransformMap _transformMap
registry of coordinate transforms
Definition: Detector.h:269
DetectorType _type
type of detectorsize_t
Definition: Detector.h:262
table::AmpInfoCatalog _ampInfoCatalog
list of amplifier data
Definition: Detector.h:265
Orientation _orientation
position and orientation of detector in focal plane
Definition: Detector.h:267
geom::Extent2D _pixelSize
pixel size (mm)
Definition: Detector.h:268
_AmpInfoMap _ampNameIterMap
map of amplifier name: catalog iterator
Definition: Detector.h:266
std::string _name
name of detector&#39;s location in the camera
Definition: Detector.h:260
std::string _serial
serial &quot;number&quot; that identifies the physical detector
Definition: Detector.h:263
int _id
detector numeric ID
Definition: Detector.h:261
std::string getSysName() const
Definition: CameraSys.h:55
lsst::afw::cameraGeom::Detector::~Detector ( )
inline

Definition at line 91 of file Detector.h.

91 {}

Member Function Documentation

void lsst::afw::cameraGeom::Detector::_init ( )
private

Finish constructing this object

Set _ampNameIterMap from _ampInfoCatalog Check detector name in the CoordSys in the transform registry

Exceptions
lsst::pex::exceptions::InvalidParameterErrorif:
  • any amplifier names are not unique
  • any CamerSys in transformMap has a detector name other than "" or this detector's name

Definition at line 101 of file Detector.cc.

101  {
102  // make _ampNameIterMap
104  ampIter != _ampInfoCatalog.end(); ++ampIter) {
105  _ampNameIterMap.insert(std::make_pair(ampIter->getName(), ampIter));
106  }
107  if (_ampNameIterMap.size() != _ampInfoCatalog.size()) {
108  throw LSST_EXCEPT(pexExcept::InvalidParameterError,
109  "Invalid ampInfoCatalog: not all amplifier names are unique");
110  }
111 
112  // check detector name in CoordSys in transform registry
113  for (CameraTransformMap::Transforms::const_iterator trIter = _transformMap.begin();
114  trIter != _transformMap.end(); ++trIter) {
115  if (trIter->first.hasDetectorName() && trIter->first.getDetectorName() != _name) {
116  std::ostringstream os;
117  os << "Invalid transformMap: " << trIter->first << " detector name != \"" << _name << "\"";
118  throw LSST_EXCEPT(pexExcept::InvalidParameterError, os.str());
119  }
120  }
121 }
Transforms::const_iterator end() const
Definition: TransformMap.h:144
size_type size() const
Return the number of elements in the catalog.
Definition: Catalog.h:401
CameraTransformMap _transformMap
registry of coordinate transforms
Definition: Detector.h:269
table::AmpInfoCatalog _ampInfoCatalog
list of amplifier data
Definition: Detector.h:265
CatalogIterator< typename Internal::const_iterator > const_iterator
Definition: Catalog.h:108
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
Transforms::const_iterator begin() const
Definition: TransformMap.h:142
_AmpInfoMap _ampNameIterMap
map of amplifier name: catalog iterator
Definition: Detector.h:266
std::string _name
name of detector&#39;s location in the camera
Definition: Detector.h:260
lsst::afw::table::AmpInfoCatalog::const_iterator lsst::afw::cameraGeom::Detector::begin ( ) const
inline

Get iterator to beginning of amplifier list

Definition at line 132 of file Detector.h.

132 { return _ampInfoCatalog.begin(); }
table::AmpInfoCatalog _ampInfoCatalog
list of amplifier data
Definition: Detector.h:265
lsst::afw::table::AmpInfoCatalog::const_iterator lsst::afw::cameraGeom::Detector::end ( ) const
inline

Get iterator to end of amplifier list

Definition at line 135 of file Detector.h.

135 { return _ampInfoCatalog.end(); }
table::AmpInfoCatalog _ampInfoCatalog
list of amplifier data
Definition: Detector.h:265
lsst::afw::table::AmpInfoCatalog const lsst::afw::cameraGeom::Detector::getAmpInfoCatalog ( ) const
inline

Get the amplifier information catalog

Definition at line 120 of file Detector.h.

120 { return _ampInfoCatalog; }
table::AmpInfoCatalog _ampInfoCatalog
list of amplifier data
Definition: Detector.h:265
lsst::afw::geom::Box2I lsst::afw::cameraGeom::Detector::getBBox ( ) const
inline

Get the bounding box

Definition at line 105 of file Detector.h.

105 { return _bbox; }
geom::Box2I _bbox
bounding box
Definition: Detector.h:264
CameraPoint lsst::afw::cameraGeom::Detector::getCenter ( CameraSys const &  cameraSys) const

Get the center of the detector in the specified coordinate system

Definition at line 65 of file Detector.cc.

65  {
67  return transform(ctrPix, cameraSys);
68 }
geom::Box2I _bbox
bounding box
Definition: Detector.h:264
CoordSysT getNativeCoordSys() const
Definition: TransformMap.h:112
CameraPoint transform(CameraPoint const &fromCameraPoint, CameraSys const &toSys) const
Definition: Detector.h:223
CameraPoint getCenter(CameraSys const &cameraSys) const
Definition: Detector.cc:65
CameraPoint makeCameraPoint(geom::Point2D point, CameraSys cameraSys) const
Definition: Detector.h:187
CameraTransformMap _transformMap
registry of coordinate transforms
Definition: Detector.h:269
A floating-point coordinate rectangle geometry.
Definition: Box.h:271
CameraPoint lsst::afw::cameraGeom::Detector::getCenter ( CameraSysPrefix const &  cameraSysPrefix) const

Get the center of the detector in the specified coordinate system prefix

Definition at line 70 of file Detector.cc.

70  {
71  return getCenter(makeCameraSys(cameraSysPrefix));
72 }
CameraPoint getCenter(CameraSys const &cameraSys) const
Definition: Detector.cc:65
CameraSys const makeCameraSys(CameraSys const &cameraSys) const
Definition: Detector.h:209
std::vector< geom::Point2D > lsst::afw::cameraGeom::Detector::getCorners ( CameraSys const &  cameraSys) const

Get the corners of the detector in the specified coordinate system

Definition at line 56 of file Detector.cc.

56  {
57  std::vector<geom::Point2D> fromVec = geom::Box2D(_bbox).getCorners();
58  return _transformMap.transform(fromVec, _transformMap.getNativeCoordSys(), cameraSys);
59 }
geom::Box2I _bbox
bounding box
Definition: Detector.h:264
CoordSysT getNativeCoordSys() const
Definition: TransformMap.h:112
CameraTransformMap _transformMap
registry of coordinate transforms
Definition: Detector.h:269
Point2D transform(Point2D const &fromPoint, CoordSysT const &fromSys, CoordSysT const &toCoordSys) const
std::vector< Point2D > getCorners() const
A floating-point coordinate rectangle geometry.
Definition: Box.h:271
std::vector< geom::Point2D > lsst::afw::cameraGeom::Detector::getCorners ( CameraSysPrefix const &  cameraSysPrefix) const

Get the corners of the detector in the specified coordinate system prefix

Definition at line 61 of file Detector.cc.

61  {
62  return getCorners(makeCameraSys(cameraSysPrefix));
63 }
std::vector< geom::Point2D > getCorners(CameraSys const &cameraSys) const
Definition: Detector.cc:56
CameraSys const makeCameraSys(CameraSys const &cameraSys) const
Definition: Detector.h:209
int lsst::afw::cameraGeom::Detector::getId ( ) const
inline

Get the detector ID

Definition at line 97 of file Detector.h.

97 { return _id; }
int _id
detector numeric ID
Definition: Detector.h:261
std::string lsst::afw::cameraGeom::Detector::getName ( ) const
inline

Get the detector name

Definition at line 94 of file Detector.h.

94 { return _name; }
std::string _name
name of detector&#39;s location in the camera
Definition: Detector.h:260
Orientation const lsst::afw::cameraGeom::Detector::getOrientation ( ) const
inline

Get detector's orientation in the focal plane

Definition at line 123 of file Detector.h.

123 { return _orientation; }
Orientation _orientation
position and orientation of detector in focal plane
Definition: Detector.h:267
geom::Extent2D lsst::afw::cameraGeom::Detector::getPixelSize ( ) const
inline

Get size of pixel along (mm)

Definition at line 126 of file Detector.h.

126 { return _pixelSize; }
geom::Extent2D _pixelSize
pixel size (mm)
Definition: Detector.h:268
std::string lsst::afw::cameraGeom::Detector::getSerial ( ) const
inline

Get the detector serial "number"

Definition at line 102 of file Detector.h.

102 { return _serial; }
std::string _serial
serial &quot;number&quot; that identifies the physical detector
Definition: Detector.h:263
boost::shared_ptr< afw::geom::XYTransform const > lsst::afw::cameraGeom::Detector::getTransform ( CameraSys const &  cameraSys) const

Get an XYTransform that transforms from cameraSys to the native system in the forward direction

Parameters
[in]cameraSyscamera coordinate system
Returns
a shared_ptr to an lsst::afw::XYTransform
Exceptions
pexExcept::InvalidParameterErrorif coordSys is unknown

Definition at line 92 of file Detector.cc.

92  {
93  return _transformMap[cameraSys];
94 }
CameraTransformMap _transformMap
registry of coordinate transforms
Definition: Detector.h:269
boost::shared_ptr< afw::geom::XYTransform const > lsst::afw::cameraGeom::Detector::getTransform ( CameraSysPrefix const &  cameraSysPrefix) const

Get an XYTransform that transforms from cameraSysPrefix to the native system in the forward direction

Parameters
[in]cameraSysPrefixcamera coordinate system prefix
Returns
a shared_ptr to an lsst::afw::geom::XYTransform
Exceptions
pexExcept::InvalidParameterErrorif coordSys is unknown

Definition at line 96 of file Detector.cc.

96  {
97  return getTransform(makeCameraSys(cameraSysPrefix));
98 }
CameraSys const makeCameraSys(CameraSys const &cameraSys) const
Definition: Detector.h:209
boost::shared_ptr< afw::geom::XYTransform const > getTransform(CameraSys const &cameraSys) const
Definition: Detector.cc:92
CameraTransformMap const lsst::afw::cameraGeom::Detector::getTransformMap ( ) const
inline

Get the transform registry

Definition at line 129 of file Detector.h.

129 { return _transformMap; }
CameraTransformMap _transformMap
registry of coordinate transforms
Definition: Detector.h:269
DetectorType lsst::afw::cameraGeom::Detector::getType ( ) const
inline

Definition at line 99 of file Detector.h.

99 { return _type; }
DetectorType _type
type of detectorsize_t
Definition: Detector.h:262
bool lsst::afw::cameraGeom::Detector::hasTransform ( CameraSys const &  cameraSys) const

Does the specified CameraSys exist in the transform registry

Definition at line 84 of file Detector.cc.

84  {
85  return _transformMap.contains(cameraSys);
86 }
bool contains(CoordSysT const &coordSys) const
CameraTransformMap _transformMap
registry of coordinate transforms
Definition: Detector.h:269
bool lsst::afw::cameraGeom::Detector::hasTransform ( CameraSysPrefix const &  cameraSysPrefix) const

Does the specified CameraSysPrefix exist in the transform registry

Definition at line 88 of file Detector.cc.

88  {
89  return hasTransform(makeCameraSys(cameraSysPrefix));
90 }
CameraSys const makeCameraSys(CameraSys const &cameraSys) const
Definition: Detector.h:209
bool hasTransform(CameraSys const &cameraSys) const
Definition: Detector.cc:84
CameraPoint lsst::afw::cameraGeom::Detector::makeCameraPoint ( geom::Point2D  point,
CameraSys  cameraSys 
) const
inline

Make a CameraPoint from a point and a camera system

Note
the CameraSysPrefix version needs the detector name, which is why this is not static.
Parameters
point2-d point
cameraSyscoordinate system

Definition at line 187 of file Detector.h.

190  {
191  return CameraPoint(point, cameraSys);
192  }
CameraPoint lsst::afw::cameraGeom::Detector::makeCameraPoint ( geom::Point2D  point,
CameraSysPrefix  cameraSysPrefix 
) const
inline

Make a CameraPoint from a point and a camera system prefix

Parameters
point2-d point
cameraSysPrefixcoordinate system prefix

Definition at line 197 of file Detector.h.

200  {
201  return CameraPoint(point, makeCameraSys(cameraSysPrefix));
202  }
CameraSys const makeCameraSys(CameraSys const &cameraSys) const
Definition: Detector.h:209
CameraSys const lsst::afw::cameraGeom::Detector::makeCameraSys ( CameraSys const &  cameraSys) const
inline

Get a coordinate system from a coordinate system (return input unchanged and untested)

Note
the CameraSysPrefix version needs the detector name, which is why this is not static.

Definition at line 209 of file Detector.h.

209 { return cameraSys; }
CameraSys const lsst::afw::cameraGeom::Detector::makeCameraSys ( CameraSysPrefix const &  cameraSysPrefix) const
inline

Get a coordinate system from a detector system prefix (add detector name)

Definition at line 214 of file Detector.h.

214  {
215  return CameraSys(cameraSysPrefix.getSysName(), _name);
216  }
std::string _name
name of detector&#39;s location in the camera
Definition: Detector.h:260
lsst::afw::table::AmpInfoRecord const& lsst::afw::cameraGeom::Detector::operator[] ( size_t  i) const
inline

Get the amplifier specified by index

Exceptions
std::out_of_range)if index is out of range

Definition at line 142 of file Detector.h.

142 { return _ampInfoCatalog.at(i); }
reference at(size_type i) const
Return the record at index i (throws std::out_of_range).
Definition: Catalog.h:430
table::AmpInfoCatalog _ampInfoCatalog
list of amplifier data
Definition: Detector.h:265
const table::AmpInfoRecord & lsst::afw::cameraGeom::Detector::operator[] ( std::string const &  name) const

Get the amplifier specified by name

Exceptions
lst::pex::exceptions::InvalidParameterErrorif no such amplifier

Definition at line 74 of file Detector.cc.

74  {
75  _AmpInfoMap::const_iterator ampIter = _ampNameIterMap.find(name);
76  if (ampIter == _ampNameIterMap.end()) {
77  std::ostringstream os;
78  os << "Unknown amplifier \"" << name << "\"";
79  throw LSST_EXCEPT(pexExcept::InvalidParameterError, os.str());
80  }
81  return *(ampIter->second);
82 }
table::Key< std::string > name
Definition: ApCorrMap.cc:71
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
_AmpInfoMap _ampNameIterMap
map of amplifier name: catalog iterator
Definition: Detector.h:266
size_t lsst::afw::cameraGeom::Detector::size ( ) const
inline

Get number of amplifiers. Renamed to len in Python.

Definition at line 154 of file Detector.h.

154 {return _ampInfoCatalog.size(); }
size_type size() const
Return the number of elements in the catalog.
Definition: Catalog.h:401
table::AmpInfoCatalog _ampInfoCatalog
list of amplifier data
Definition: Detector.h:265
CameraPoint lsst::afw::cameraGeom::Detector::transform ( CameraPoint const &  fromCameraPoint,
CameraSys const &  toSys 
) const
inline

Convert a CameraPoint from one coordinate system to another

Exceptions
pexExcept::InvalidParameterErrorif from or to coordinate system is unknown
Parameters
fromCameraPointcamera point to transform
toSyscoordinate system to which to transform

Definition at line 223 of file Detector.h.

226  {
227  return CameraPoint(
228  _transformMap.transform(fromCameraPoint.getPoint(), fromCameraPoint.getCameraSys(), toSys),
229  toSys);
230  }
CameraTransformMap _transformMap
registry of coordinate transforms
Definition: Detector.h:269
Point2D transform(Point2D const &fromPoint, CoordSysT const &fromSys, CoordSysT const &toCoordSys) const
CameraPoint lsst::afw::cameraGeom::Detector::transform ( CameraPoint const &  fromCameraPoint,
CameraSysPrefix const &  toSys 
) const
inline

Convert a CameraPoint from one coordinate system to a coordinate system prefix

The coordinate system prefix is filled in with this detector's name

Exceptions
pexExcept::InvalidParameterErrorif from or to coordinate system is unknown
Parameters
fromCameraPointcamera point to transform
toSyscoordinate system prefix to which to transform

Definition at line 239 of file Detector.h.

242  {
243  return transform(fromCameraPoint, makeCameraSys(toSys));
244  }
CameraPoint transform(CameraPoint const &fromCameraPoint, CameraSys const &toSys) const
Definition: Detector.h:223
CameraSys const makeCameraSys(CameraSys const &cameraSys) const
Definition: Detector.h:209

Member Data Documentation

table::AmpInfoCatalog lsst::afw::cameraGeom::Detector::_ampInfoCatalog
private

list of amplifier data

Definition at line 265 of file Detector.h.

_AmpInfoMap lsst::afw::cameraGeom::Detector::_ampNameIterMap
private

map of amplifier name: catalog iterator

Definition at line 266 of file Detector.h.

geom::Box2I lsst::afw::cameraGeom::Detector::_bbox
private

bounding box

Definition at line 264 of file Detector.h.

int lsst::afw::cameraGeom::Detector::_id
private

detector numeric ID

Definition at line 261 of file Detector.h.

std::string lsst::afw::cameraGeom::Detector::_name
private

name of detector's location in the camera

Definition at line 260 of file Detector.h.

Orientation lsst::afw::cameraGeom::Detector::_orientation
private

position and orientation of detector in focal plane

Definition at line 267 of file Detector.h.

geom::Extent2D lsst::afw::cameraGeom::Detector::_pixelSize
private

pixel size (mm)

Definition at line 268 of file Detector.h.

std::string lsst::afw::cameraGeom::Detector::_serial
private

serial "number" that identifies the physical detector

Definition at line 263 of file Detector.h.

CameraTransformMap lsst::afw::cameraGeom::Detector::_transformMap
private

registry of coordinate transforms

Definition at line 269 of file Detector.h.

DetectorType lsst::afw::cameraGeom::Detector::_type
private

type of detectorsize_t

Definition at line 262 of file Detector.h.


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