29 namespace cameraGeom {
40 _ampInfoCatalog(ampInfoCatalog),
42 _orientation(orientation),
43 _pixelSize(pixelSize),
45 _transformMap(_nativeSys, transforms),
46 _crosstalk(crosstalk) {
52 return _transformMap.
transform(fromVec, _nativeSys, cameraSys);
72 i = _ampInfoCatalog.
size() + i;
74 return _ampInfoCatalog.
get(i);
78 _AmpInfoMap::const_iterator ampIter = _ampNameIterMap.find(name);
79 if (ampIter == _ampNameIterMap.end()) {
80 std::ostringstream os;
81 os <<
"Unknown amplifier \"" << name <<
"\"";
82 throw LSST_EXCEPT(pexExcept::InvalidParameterError, os.str());
84 return ampIter->second;
93 template <
typename FromSysT,
typename ToSysT>
95 ToSysT
const &toSys)
const {
99 void Detector::_init() {
102 ampIter != _ampInfoCatalog.
end(); ++ampIter) {
103 _ampNameIterMap.insert(std::make_pair(ampIter->getName(), ampIter));
105 if (_ampNameIterMap.size() != _ampInfoCatalog.
size()) {
106 throw LSST_EXCEPT(pexExcept::InvalidParameterError,
107 "Invalid ampInfoCatalog: not all amplifier names are unique");
111 for (CameraSys sys : _transformMap) {
112 if (sys.hasDetectorName() && sys.getDetectorName() != _name) {
113 std::ostringstream os;
114 os <<
"Invalid transformMap: " << sys <<
" detector name != \"" << _name <<
"\"";
115 throw LSST_EXCEPT(pexExcept::InvalidParameterError, os.str());
121 auto shape = _crosstalk.getShape();
122 assert(shape.size() == 2);
123 if (shape[0] != shape[1]) {
124 std::ostringstream os;
125 os <<
"Non-square crosstalk matrix: " << _crosstalk <<
" for detector \"" << _name <<
"\"";
126 throw LSST_EXCEPT(pexExcept::InvalidParameterError, os.str());
128 if (shape[0] != _ampInfoCatalog.
size()) {
129 std::ostringstream os;
130 os <<
"Wrong size crosstalk matrix: " << _crosstalk <<
" for detector \"" << _name <<
"\"";
131 throw LSST_EXCEPT(pexExcept::InvalidParameterError, os.str());
139 #define INSTANTIATE(FROMSYS, TOSYS) \
140 template std::shared_ptr<geom::TransformPoint2ToPoint2> Detector::getTransform(FROMSYS const &, \
141 TOSYS const &) const;
std::shared_ptr< RecordT > const get(size_type i) const
Return a pointer to the record at index i.
Camera coordinate system; used as a key in in TransformMap.
std::vector< geom::Point2D > getCorners(CameraSys const &cameraSys) const
Get the corners of the detector in the specified camera coordinate system.
bool hasCrosstalk() const
Have we got crosstalk coefficients?
std::string const & _name
Geometry and electronic information about raw amplifier images.
A custom container class for records, based on std::vector.
CameraSysPrefix const PIXELS
Nominal pixels on the detector (unbinned) This ignores manufacturing imperfections, "tree ring" distortions and all other such effects.
lsst::afw::table::AmpInfoRecord const & operator[](size_t i) const
Get the amplifier specified by index.
CameraPoint transform(CameraPoint const &fromCameraPoint, CameraSys const &toSys) const
Convert a CameraPoint from one coordinate system to another.
CameraPoint getCenter(CameraSys const &cameraSys) const
Get the center of the detector in the specified camera coordinate system.
size_type size() const
Return the number of elements in the catalog.
An integer coordinate rectangle.
Describe a detector's orientation in the focal plane.
std::shared_ptr< geom::TransformPoint2ToPoint2 > getTransform(FromSysT const &fromSys, ToSysT const &toSys) const
Get a Transform from one camera coordinate system, or camera coordinate system prefix, to another.
iterator end()
Iterator access.
geom::Box2I const & _bbox
CameraSys const makeCameraSys(CameraSys const &cameraSys) const
Get a coordinate system from a coordinate system (return input unchanged and untested) ...
Iterator class for CatalogT.
table::Key< std::string > name
std::vector< Point2D > getCorners() const
Get the corner points.
CameraPoint makeCameraPoint(geom::Point2D const &point, CameraSys const &cameraSys) const
Make a CameraPoint from a point and a camera system.
bool hasTransform(CameraSys const &cameraSys) const
Can this object convert between PIXELS and the specified camera coordinate system?
Camera coordinate system prefix.
Detector(std::string const &name, int id, DetectorType type, std::string const &serial, geom::Box2I const &bbox, lsst::afw::table::AmpInfoCatalog const &InfoCatalog, Orientation const &orientation, geom::Extent2D const &pixelSize, TransformMap::Transforms const &transforms, CrosstalkMatrix const &crosstalk=CrosstalkMatrix())
Make a Detector.
A Point2D with associated camera coordinate system.
std::shared_ptr< lsst::afw::table::AmpInfoRecord const > _get(int i) const
Get the amplifier specified by index, returning a shared pointer to an AmpInfo record.
A floating-point coordinate rectangle geometry.
iterator begin()
Iterator access.
DetectorType
Type of imaging detector.
ndarray::Array< float const, 2 > CrosstalkMatrix
#define INSTANTIATE(FROMSYS, TOSYS)