LSSTApplications  16.0-11-g09ed895+2,16.0-11-g12e47bd,16.0-11-g9bb73b2+6,16.0-12-g5c924a4+6,16.0-14-g9a974b3+1,16.0-15-g1417920+1,16.0-15-gdd5ca33+1,16.0-16-gf0259e2,16.0-17-g31abd91+7,16.0-17-g7d7456e+7,16.0-17-ga3d2e9f+13,16.0-18-ga4d4bcb+1,16.0-18-gd06566c+1,16.0-2-g0febb12+21,16.0-2-g9d5294e+69,16.0-2-ga8830df+6,16.0-20-g21842373+7,16.0-24-g3eae5ec,16.0-28-gfc9ea6c+4,16.0-29-ge8801f9,16.0-3-ge00e371+34,16.0-4-g18f3627+13,16.0-4-g5f3a788+20,16.0-4-ga3eb747+10,16.0-4-gabf74b7+29,16.0-4-gb13d127+6,16.0-49-g42e581f7+6,16.0-5-g27fb78a+7,16.0-5-g6a53317+34,16.0-5-gb3f8a4b+87,16.0-6-g9321be7+4,16.0-6-gcbc7b31+42,16.0-6-gf49912c+29,16.0-7-gd2eeba5+51,16.0-71-ge89f8615e,16.0-8-g21fd5fe+29,16.0-8-g3a9f023+20,16.0-8-g4734f7a+1,16.0-8-g5858431+3,16.0-9-gf5c1f43+8,master-gd73dc1d098+1,w.2019.01
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.
Definition: cameraGeom.dox:3
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
Basic LSST definitions.
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.