LSSTApplications  16.0-10-g0ee56ad+5,16.0-11-ga33d1f2+5,16.0-12-g3ef5c14+3,16.0-12-g71e5ef5+18,16.0-12-gbdf3636+3,16.0-13-g118c103+3,16.0-13-g8f68b0a+3,16.0-15-gbf5c1cb+4,16.0-16-gfd17674+3,16.0-17-g7c01f5c+3,16.0-18-g0a50484+1,16.0-20-ga20f992+8,16.0-21-g0e05fd4+6,16.0-21-g15e2d33+4,16.0-22-g62d8060+4,16.0-22-g847a80f+4,16.0-25-gf00d9b8+1,16.0-28-g3990c221+4,16.0-3-gf928089+3,16.0-32-g88a4f23+5,16.0-34-gd7987ad+3,16.0-37-gc7333cb+2,16.0-4-g10fc685+2,16.0-4-g18f3627+26,16.0-4-g5f3a788+26,16.0-5-gaf5c3d7+4,16.0-5-gcc1f4bb+1,16.0-6-g3b92700+4,16.0-6-g4412fcd+3,16.0-6-g7235603+4,16.0-69-g2562ce1b+2,16.0-8-g14ebd58+4,16.0-8-g2df868b+1,16.0-8-g4cec79c+6,16.0-8-gadf6c7a+1,16.0-8-gfc7ad86,16.0-82-g59ec2a54a+1,16.0-9-g5400cdc+2,16.0-9-ge6233d7+5,master-g2880f2d8cf+3,v17.0.rc1
LSSTDataManagementBasePackage
Detector.h
Go to the documentation of this file.
1 /*
2  * LSST Data Management System
3  * Copyright 2014 LSST Corporation.
4  *
5  * This product includes software developed by the
6  * LSST Project (http://www.lsst.org/).
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the LSST License Statement and
19  * the GNU General Public License along with this program. If not,
20  * see <http://www.lsstcorp.org/LegalNotices/>.
21  */
22 
23 #if !defined(LSST_AFW_CAMERAGEOM_DETECTOR_H)
24 #define LSST_AFW_CAMERAGEOM_DETECTOR_H
25 
26 #include <string>
27 #include <vector>
28 #include <unordered_map>
29 #include "lsst/base.h"
31 #include "lsst/afw/table/AmpInfo.h"
35 
36 namespace lsst {
37 namespace afw {
38 namespace cameraGeom {
39 
48 };
49 
61 class Detector final : public table::io::PersistableFacade<Detector>, public table::io::Persistable {
62 public:
63  typedef ndarray::Array<float const, 2> CrosstalkMatrix;
64 
89  lsst::geom::Box2I const &bbox, lsst::afw::table::AmpInfoCatalog const &ampInfoCatalog,
91  TransformMap::Transforms const &transforms,
92  CrosstalkMatrix const &crosstalk = CrosstalkMatrix());
93 
111  Detector(std::string const &name, int id, DetectorType type, std::string const &serial,
112  lsst::geom::Box2I const &bbox, lsst::afw::table::AmpInfoCatalog const &ampInfoCatalog,
113  Orientation const &orientation, lsst::geom::Extent2D const &pixelSize,
115  CrosstalkMatrix const &crosstalk = CrosstalkMatrix());
116 
117  ~Detector() = default;
118 
119  Detector(Detector const &) = delete;
120  Detector(Detector &&) = delete;
121  Detector &operator=(Detector const &) = delete;
122  Detector &operator=(Detector &&) = delete;
123 
125  std::string getName() const { return _name; }
126 
128  int getId() const { return _id; }
129 
130  DetectorType getType() const { return _type; }
131 
133  std::string getSerial() const { return _serial; }
134 
136  lsst::geom::Box2I getBBox() const { return _bbox; }
137 
140 
142  std::vector<lsst::geom::Point2D> getCorners(CameraSysPrefix const &cameraSysPrefix) const;
143 
145  lsst::geom::Point2D getCenter(CameraSys const &cameraSys) const;
146 
148  lsst::geom::Point2D getCenter(CameraSysPrefix const &cameraSysPrefix) const;
149 
151  table::AmpInfoCatalog const getAmpInfoCatalog() const { return _ampInfoCatalog; }
152 
154  Orientation const getOrientation() const { return _orientation; }
155 
157  lsst::geom::Extent2D getPixelSize() const { return _pixelSize; }
158 
160  std::shared_ptr<TransformMap const> getTransformMap() const { return _transformMap; }
161 
163  bool hasCrosstalk() const {
164  return !(_crosstalk.isEmpty() || _crosstalk.getShape() == ndarray::makeVector(0, 0));
165  }
166 
168  CrosstalkMatrix const getCrosstalk() const { return _crosstalk; }
169 
171  table::AmpInfoCatalog::const_iterator begin() const { return _ampInfoCatalog.begin(); }
172 
174  table::AmpInfoCatalog::const_iterator end() const { return _ampInfoCatalog.end(); }
175 
181  table::AmpInfoRecord const &operator[](size_t i) const { return _ampInfoCatalog.at(i); }
182 
188  table::AmpInfoRecord const &operator[](std::string const &name) const;
189 
203 
215 
219  size_t size() const { return _ampInfoCatalog.size(); }
220 
222  bool hasTransform(CameraSys const &cameraSys) const;
223 
225  bool hasTransform(CameraSysPrefix const &cameraSysPrefix) const;
226 
239  template <typename FromSysT, typename ToSysT>
241  ToSysT const &toSys) const;
242 
251  CameraSys const makeCameraSys(CameraSys const &cameraSys) const { return cameraSys; }
252 
259  CameraSys const makeCameraSys(CameraSysPrefix const &cameraSysPrefix) const {
260  return CameraSys(cameraSysPrefix, _name);
261  }
262 
275  template <typename FromSysT, typename ToSysT>
276  lsst::geom::Point2D transform(lsst::geom::Point2D const &point, FromSysT const &fromSys,
277  ToSysT const &toSys) const;
278 
291  template <typename FromSysT, typename ToSysT>
293  FromSysT const &fromSys, ToSysT const &toSys) const;
294 
296  CameraSys getNativeCoordSys() const { return _nativeSys; }
297 
299  bool isPersistable() const noexcept override { return true; }
300 
301 private:
303 
304  std::string getPersistenceName() const override;
305 
306  std::string getPythonModule() const override;
307 
308  void write(OutputArchiveHandle& handle) const override;
309 
310  std::string _name;
311  int _id;
312  DetectorType _type;
313  std::string _serial;
314  lsst::geom::Box2I _bbox;
315  table::AmpInfoCatalog _ampInfoCatalog;
316  _AmpInfoMap _ampNameIterMap;
317  Orientation _orientation;
318  lsst::geom::Extent2D _pixelSize;
319  CameraSys _nativeSys;
321  CrosstalkMatrix _crosstalk;
322 };
323 } // namespace cameraGeom
324 } // namespace afw
325 } // namespace lsst
326 
327 #endif
table::AmpInfoCatalog const getAmpInfoCatalog() const
Get the amplifier information catalog.
Definition: Detector.h:151
size_t size() const
Get the number of amplifiers.
Definition: Detector.h:219
Camera coordinate system; used as a key in in TransformMap.
Definition: CameraSys.h:83
Geometry and electronic information about raw amplifier images.
Definition: AmpInfo.h:79
An object passed to Persistable::write to allow it to persist itself.
table::AmpInfoRecord const & operator[](size_t i) const
Get the amplifier specified by index.
Definition: Detector.h:181
std::shared_ptr< table::AmpInfoRecord const > _get(int i) const
Get the amplifier specified by index, returning a shared pointer to an AmpInfo record.
Definition: Detector.cc:110
DetectorType getType() const
Definition: Detector.h:130
Describe a detector&#39;s orientation in the focal plane.
Definition: Orientation.h:52
STL class.
A base class for objects that can be persisted via afw::table::io Archive classes.
Definition: Persistable.h:74
CameraSys const makeCameraSys(CameraSys const &cameraSys) const
Get a coordinate system from a coordinate system (return input unchanged and untested) ...
Definition: Detector.h:251
Orientation const getOrientation() const
Get detector&#39;s orientation in the focal plane.
Definition: Detector.h:154
lsst::geom::Box2I getBBox() const
Get the bounding box.
Definition: Detector.h:136
A base class for image defects.
table::Key< int > type
Definition: Detector.cc:164
std::shared_ptr< TransformMap const > getTransformMap() const
Get the transform registry.
Definition: Detector.h:160
iterator end()
Iterator access.
Definition: Catalog.h:397
Iterator class for CatalogT.
Definition: Catalog.h:38
bool hasTransform(CameraSys const &cameraSys) const
Can this object convert between PIXELS and the specified camera coordinate system?
Definition: Detector.cc:127
bool hasCrosstalk() const
Have we got crosstalk coefficients?
Definition: Detector.h:163
std::vector< lsst::geom::Point2D > getCorners(CameraSys const &cameraSys) const
Get the corners of the detector in the specified camera coordinate system.
Definition: Detector.cc:88
CameraSys const makeCameraSys(CameraSysPrefix const &cameraSysPrefix) const
Get a coordinate system from a detector system prefix (add detector name)
Definition: Detector.h:259
CrosstalkMatrix const getCrosstalk() const
Get the crosstalk coefficients.
Definition: Detector.h:168
table::Point2DKey pixelSize
Definition: Detector.cc:167
table::Box2IKey bbox
Definition: Detector.cc:166
table::AmpInfoCatalog::const_iterator begin() const
Get iterator to beginning of amplifier list.
Definition: Detector.h:171
lsst::geom::Point2D getCenter(CameraSys const &cameraSys) const
Get the center of the detector in the specified camera coordinate system.
Definition: Detector.cc:98
Camera coordinate system prefix.
Definition: CameraSys.h:44
std::string getName() const
Get the detector name.
Definition: Detector.h:125
STL class.
Information about a CCD or other imaging detector.
Definition: Detector.h:61
Detector & operator=(Detector const &)=delete
table::AmpInfoCatalog::const_iterator end() const
Get iterator to end of amplifier list.
Definition: Detector.h:174
int getId() const
Get the detector ID.
Definition: Detector.h:128
size_type size() const
Return the number of elements in the catalog.
Definition: Catalog.h:408
table::Key< std::string > serial
Definition: Detector.cc:165
Detector(std::string const &name, int id, DetectorType type, std::string const &serial, lsst::geom::Box2I const &bbox, lsst::afw::table::AmpInfoCatalog const &ampInfoCatalog, Orientation const &orientation, lsst::geom::Extent2D const &pixelSize, TransformMap::Transforms const &transforms, CrosstalkMatrix const &crosstalk=CrosstalkMatrix())
Make a Detector.
Definition: Detector.cc:36
bool isPersistable() const noexcept override
Detectors are always peristable.
Definition: Detector.h:299
iterator begin()
Iterator access.
Definition: Catalog.h:396
reference at(size_type i) const
Return the record at index i (throws std::out_of_range).
Definition: Catalog.h:437
table::Key< table::Array< float > > crosstalk
Definition: Detector.cc:174
lsst::geom::Extent2D getPixelSize() const
Get size of pixel along (mm)
Definition: Detector.h:157
DetectorType
Type of imaging detector.
Definition: Detector.h:43
A CRTP facade class for subclasses of Persistable.
Definition: Persistable.h:176
ndarray::Array< float const, 2 > CrosstalkMatrix
Definition: Detector.h:63
An integer coordinate rectangle.
Definition: Box.h:54
std::string getSerial() const
Get the detector serial "number".
Definition: Detector.h:133
CameraSys getNativeCoordSys() const
The "native" coordinate system of this detector.
Definition: Detector.h:296
lsst::geom::Point2D transform(lsst::geom::Point2D const &point, FromSysT const &fromSys, ToSysT const &toSys) const
Transform a point from one camera system to another.
Definition: Detector.cc:140
std::shared_ptr< afw::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.
Basic LSST definitions.