LSSTApplications  18.0.0+106,18.0.0+50,19.0.0,19.0.0+1,19.0.0+10,19.0.0+11,19.0.0+13,19.0.0+17,19.0.0+2,19.0.0-1-g20d9b18+6,19.0.0-1-g425ff20,19.0.0-1-g5549ca4,19.0.0-1-g580fafe+6,19.0.0-1-g6fe20d0+1,19.0.0-1-g7011481+9,19.0.0-1-g8c57eb9+6,19.0.0-1-gb5175dc+11,19.0.0-1-gdc0e4a7+9,19.0.0-1-ge272bc4+6,19.0.0-1-ge3aa853,19.0.0-10-g448f008b,19.0.0-12-g6990b2c,19.0.0-2-g0d9f9cd+11,19.0.0-2-g3d9e4fb2+11,19.0.0-2-g5037de4,19.0.0-2-gb96a1c4+3,19.0.0-2-gd955cfd+15,19.0.0-3-g2d13df8,19.0.0-3-g6f3c7dc,19.0.0-4-g725f80e+11,19.0.0-4-ga671dab3b+1,19.0.0-4-gad373c5+3,19.0.0-5-ga2acb9c+2,19.0.0-5-gfe96e6c+2,w.2020.01
LSSTDataManagementBasePackage
Amplifier.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 /*
3  * Developed for the LSST Data Management System.
4  * This product includes software developed by the LSST Project
5  * (https://www.lsst.org).
6  * See the COPYRIGHT file at the top-level directory of this distribution
7  * for details of code ownership.
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <https://www.gnu.org/licenses/>.
21  */
22 #ifndef LSST_AFW_CAMERAGEOM_AMPLIFIER_H_INCLUDED
23 #define LSST_AFW_CAMERAGEOM_AMPLIFIER_H_INCLUDED
24 
25 #include <string>
26 
27 #include "lsst/afw/table/fwd.h"
28 #include "lsst/geom/Box.h"
29 #include "lsst/geom/Extent.h"
30 
31 namespace lsst {
32 namespace afw {
33 namespace cameraGeom {
34 
38 enum class ReadoutCorner {
39  LL,
40  LR,
41  UR,
42  UL,
43 };
44 
48 enum class AssemblyState {
49  RAW,
50  SCIENCE,
51 };
52 
86 class Amplifier {
87 public:
88 
89  class Builder;
90 
92  static table::Schema getRecordSchema();
93 
94  virtual ~Amplifier() noexcept = default;
95 
102  void toRecord(table::BaseRecord & record) const;
103 
109  Builder rebuild() const;
110 
112  std::string getName() const { return getFields().name; }
113 
115  lsst::geom::Box2I getBBox() const { return getFields().bbox; }
116 
118  double getGain() const { return getFields().gain; }
119 
121  double getReadNoise() const { return getFields().readNoise; }
122 
127  double getSaturation() const { return getFields().saturation; }
128 
136  double getSuspectLevel() const { return getFields().suspectLevel; }
137 
139  ReadoutCorner getReadoutCorner() const { return getFields().readoutCorner; }
140 
142  ndarray::Array<double const, 1, 1> getLinearityCoeffs() const { return getFields().linearityCoeffs; }
143 
145  std::string getLinearityType() const { return getFields().linearityType; }
146 
150  double getLinearityThreshold() const { return getFields().linearityThreshold; }
151 
156  double getLinearityMaximum() const { return getFields().linearityMaximum; }
157 
159  std::string getLinearityUnits() const { return getFields().linearityUnits; }
160 
162  [[deprecated("Amplifier objects always have raw information; will be removed after 19.0.")]] // DM-21711
163  bool getHasRawInfo() const { return true; }
164 
169  lsst::geom::Box2I getRawBBox() const { return getFields().rawBBox; }
170 
175  lsst::geom::Box2I getRawDataBBox() const { return getFields().rawDataBBox; }
176 
181  bool getRawFlipX() const { return getFields().rawFlipX; }
182 
187  bool getRawFlipY() const { return getFields().rawFlipY; }
188 
193  lsst::geom::Extent2I getRawXYOffset() const { return getFields().rawXYOffset; }
194 
199  lsst::geom::Box2I getRawHorizontalOverscanBBox() const { return getFields().rawHorizontalOverscanBBox; }
200 
205  lsst::geom::Box2I getRawVerticalOverscanBBox() const { return getFields().rawVerticalOverscanBBox; }
206 
211  lsst::geom::Box2I getRawPrescanBBox() const { return getFields().rawPrescanBBox; }
212 
218  lsst::geom::Box2I getRawSerialOverscanBBox() const { return getFields().rawHorizontalOverscanBBox; }
219 
225  lsst::geom::Box2I getRawParallelOverscanBBox() const { return getFields().rawVerticalOverscanBBox; }
226 
232  lsst::geom::Box2I getRawSerialPrescanBBox() const { return getFields().rawPrescanBBox; }
233 
235  lsst::geom::Box2I getRawHorizontalPrescanBBox() const { return getFields().rawPrescanBBox; }
236 
237 protected:
238 
239  struct Fields {
242  double gain = 0.0;
243  double readNoise = 0.0;
244  double saturation = 0.0;
245  double suspectLevel = 0.0;
247  ndarray::Array<double const, 1, 1> linearityCoeffs;
254  bool rawFlipX = false;
255  bool rawFlipY = false;
260  };
261 
262  // Amplifier construction and assignment is protected to avoid type-slicing
263  // but permit derived classes to implement safe versions of these.
264 
265  Amplifier() = default;
266 
267  Amplifier(Amplifier const &) = default;
268  Amplifier(Amplifier &&) = default;
269  Amplifier & operator=(Amplifier const &) = default;
270  Amplifier & operator=(Amplifier &&) = default;
271 
272  virtual Fields const & getFields() const = 0;
273 
274 };
275 
280 class Amplifier::Builder final : public Amplifier {
281 public:
282 
289  static Builder fromRecord(table::BaseRecord const & record);
290 
292  Builder() = default;
293 
295  Builder(Builder const &) = default;
296 
298  Builder(Builder &&) = default;
299 
301  Builder(Amplifier const & other);
302 
304  Builder & operator=(Builder const &) = default;
305 
307  Builder & operator=(Builder &&) = default;
308 
310  Builder & operator=(Amplifier const & other);
311 
312  ~Builder() noexcept override = default;
313 
320  std::shared_ptr<Amplifier const> finish() const;
321 
323  void setName(std::string const &name) { _fields.name = name; }
324 
326  void setBBox(lsst::geom::Box2I const &bbox) { _fields.bbox = bbox; }
327 
329  void setGain(double gain) { _fields.gain = gain; }
330 
332  void setReadNoise(double readNoise) { _fields.readNoise = readNoise; }
333 
335  void setSaturation(double saturation) { _fields.saturation = saturation; }
336 
338  void setSuspectLevel(double suspectLevel) { _fields.suspectLevel = suspectLevel; }
339 
341  void setReadoutCorner(ReadoutCorner readoutCorner) { _fields.readoutCorner = readoutCorner; }
342 
344  void setLinearityCoeffs(ndarray::Array<double const, 1, 1> const & coeffs) {
345  _fields.linearityCoeffs = coeffs;
346  }
347 
349  void setLinearityType(std::string const & type) { _fields.linearityType = type; }
350 
352  void setLinearityThreshold(double threshold) { _fields.linearityThreshold = threshold; }
353 
355  void setLinearityMaximum(double maximum) { _fields.linearityMaximum = maximum; }
356 
358  void setLinearityUnits(std::string const & units) { _fields.linearityUnits = units; }
359 
361  void setRawBBox(lsst::geom::Box2I const &bbox) { _fields.rawBBox = bbox; }
362 
364  void setRawDataBBox(lsst::geom::Box2I const &bbox) { _fields.rawDataBBox = bbox; }
365 
367  void setRawFlipX(bool rawFlipX) { _fields.rawFlipX = rawFlipX; }
368 
370  void setRawFlipY(bool rawFlipY) { _fields.rawFlipY = rawFlipY; }
371 
373  void setRawXYOffset(lsst::geom::Extent2I const &xy) { _fields.rawXYOffset = xy; }
374 
377  _fields.rawHorizontalOverscanBBox = bbox;
378  }
379 
382  _fields.rawVerticalOverscanBBox = bbox;
383  }
384 
387  _fields.rawPrescanBBox = bbox;
388  }
389 
392  _fields.rawHorizontalOverscanBBox = bbox;
393  }
394 
397  _fields.rawVerticalOverscanBBox = bbox;
398  }
399 
402  _fields.rawPrescanBBox = bbox;
403  }
404 
407  _fields.rawPrescanBBox = bbox;
408  }
409 
410 protected:
411  Fields const & getFields() const override { return _fields; }
412 private:
413  Fields _fields;
414 };
415 
416 
417 
418 } // namespace cameraGeom
419 } // namespace afw
420 } // namespace lsst
421 
422 #endif // !LSST_AFW_CAMERAGEOM_AMPLIFIER_H_INCLUDED
AmpInfoBoxKey bbox
Definition: Amplifier.cc:117
Defines the fields and offsets for a table.
Definition: Schema.h:50
void setRawXYOffset(lsst::geom::Extent2I const &xy)
Offset in transformation from pre-raw, unassembled image to trimmed, assembled post-ISR image: final ...
Definition: Amplifier.h:373
void setRawFlipY(bool rawFlipY)
Flip column order in transformation from untrimmed, assembled raw image to trimmed, assembled post-ISR image?
Definition: Amplifier.h:370
lsst::geom::Box2I getRawPrescanBBox() const
The bounding box of (horizontal) prescan pixels in the assembled, untrimmed raw image.
Definition: Amplifier.h:211
bool getHasRawInfo() const
Does this table have raw amplifier information?
Definition: Amplifier.h:163
AssemblyState
Assembly state of the amplifier, used to identify bounding boxes and component existence.
Definition: Amplifier.h:48
ndarray::Array< double const, 1, 1 > linearityCoeffs
Definition: Amplifier.h:247
lsst::geom::Box2I getRawHorizontalPrescanBBox() const
The bounding box of horizontal/serial prescan pixels in the assembled, untrimmed raw image...
Definition: Amplifier.h:235
void setRawHorizontalOverscanBBox(lsst::geom::Box2I const &bbox)
The bounding box of horizontal overscan pixels in the assembled, untrimmed raw image.
Definition: Amplifier.h:376
ndarray::Array< double const, 1, 1 > getLinearityCoeffs() const
Vector of linearity coefficients.
Definition: Amplifier.h:142
lsst::geom::Box2I getRawVerticalOverscanBBox() const
The bounding box of vertical overscan pixels in the assembled, untrimmed raw image.
Definition: Amplifier.h:205
void setBBox(lsst::geom::Box2I const &bbox)
Bounding box of amplifier pixels in the trimmed, assembled image.
Definition: Amplifier.h:326
void setLinearityThreshold(double threshold)
Level in ADU above which linearity should be applied.
Definition: Amplifier.h:352
lsst::geom::Box2I getRawParallelOverscanBBox() const
The bounding box of parallel overscan pixels (equivalent to vertical overscan pixels) in the assemble...
Definition: Amplifier.h:225
void setRawPrescanBBox(lsst::geom::Box2I const &bbox)
The bounding box of (horizontal) prescan pixels in the assembled, untrimmed raw image.
Definition: Amplifier.h:386
ItemVariant const * other
Definition: Schema.cc:56
table::Key< double > suspectLevel
Definition: Amplifier.cc:120
void setLinearityCoeffs(ndarray::Array< double const, 1, 1 > const &coeffs)
Vector of linearity coefficients.
Definition: Amplifier.h:344
double getGain() const
Amplifier gain in e-/ADU.
Definition: Amplifier.h:118
double getSuspectLevel() const
Level in ADU above which pixels are considered suspicious, meaning they may be affected by unknown sy...
Definition: Amplifier.h:136
lsst::geom::Box2I getRawBBox() const
Bounding box of all amplifier pixels on untrimmed, assembled raw image.
Definition: Amplifier.h:169
void setSuspectLevel(double suspectLevel)
Level in ADU above which pixels are considered suspicious, meaning they may be affected by unknown sy...
Definition: Amplifier.h:338
void setGain(double gain)
Amplifier gain in e-/ADU.
Definition: Amplifier.h:329
void setRawFlipX(bool rawFlipX)
Flip row order in transformation from untrimmed, assembled raw image to trimmed, assembled post-ISR i...
Definition: Amplifier.h:367
A mutable Amplifier subclass class that can be used to incrementally construct or modify Amplifiers...
Definition: Amplifier.h:280
STL class.
lsst::geom::Box2I getRawSerialOverscanBBox() const
The bounding box of serial overscan pixels (equivalent to horizontal overscan pixels) in the assemble...
Definition: Amplifier.h:218
void setSaturation(double saturation)
Level in ADU above which pixels are considered saturated; use nan if no such level applies...
Definition: Amplifier.h:335
table::Key< double > saturation
Definition: Amplifier.cc:119
std::string getName() const
Name of the amplifier.
Definition: Amplifier.h:112
void setRawSerialOverscanBBox(lsst::geom::Box2I const &bbox)
The bounding box of serial overscan pixels (equivalent to horizontal overscan pixels) in the assemble...
Definition: Amplifier.h:391
A base class for image defects.
void setRawParallelOverscanBBox(lsst::geom::Box2I const &bbox)
The bounding box of parallel overscan pixels (equivalent to vertical overscan pixels) in the assemble...
Definition: Amplifier.h:396
table::Key< double > gain
Definition: Amplifier.cc:118
table::Key< double > readNoise
Definition: Amplifier.cc:121
table::Key< int > type
Definition: Detector.cc:163
void setLinearityType(std::string const &type)
Name of linearity parameterization.
Definition: Amplifier.h:349
void setName(std::string const &name)
Name of the amplifier.
Definition: Amplifier.h:323
void setLinearityMaximum(double maximum)
Level in ADU above which the linearity relation is poorly defined.
Definition: Amplifier.h:355
bool getRawFlipY() const
Flip column order in transformation from untrimmed, assembled raw image to trimmed, assembled post-ISR image?
Definition: Amplifier.h:187
lsst::geom::Box2I getRawDataBBox() const
Bounding box of amplifier image pixels on untrimmed, assembled raw image.
Definition: Amplifier.h:175
void setLinearityUnits(std::string const &units)
Units for the input to the linearity relation (DN).
Definition: Amplifier.h:358
void setRawDataBBox(lsst::geom::Box2I const &bbox)
Bounding box of amplifier image pixels on untrimmed, assembled raw image.
Definition: Amplifier.h:364
Base class for all records.
Definition: BaseRecord.h:31
lsst::geom::Box2I getRawHorizontalOverscanBBox() const
The bounding box of horizontal overscan pixels in the assembled, untrimmed raw image.
Definition: Amplifier.h:199
void setRawHorizontalPrescanBBox(lsst::geom::Box2I const &bbox)
The bounding box of horizontal/serial prescan pixels in the assembled, untrimmed raw image...
Definition: Amplifier.h:406
double getLinearityMaximum() const
Level in ADU above which the linearity relation is poorly defined.
Definition: Amplifier.h:156
void setRawVerticalOverscanBBox(lsst::geom::Box2I const &bbox)
The bounding box of vertical overscan pixels in the assembled, untrimmed raw image.
Definition: Amplifier.h:381
void setReadoutCorner(ReadoutCorner readoutCorner)
Readout corner in the trimmed, assembled image.
Definition: Amplifier.h:341
double getReadNoise() const
Amplifier read noise, in e-.
Definition: Amplifier.h:121
ReadoutCorner getReadoutCorner() const
Readout corner in the trimmed, assembled image.
Definition: Amplifier.h:139
lsst::geom::Extent2I getRawXYOffset() const
Offset in transformation from pre-raw, unassembled image to trimmed, assembled post-ISR image: final ...
Definition: Amplifier.h:193
void setRawBBox(lsst::geom::Box2I const &bbox)
Bounding box of all amplifier pixels on untrimmed, assembled raw image.
Definition: Amplifier.h:361
Geometry and electronic information about raw amplifier images.
Definition: Amplifier.h:86
bool getRawFlipX() const
Flip row order in transformation from untrimmed, assembled raw image to trimmed, assembled post-ISR i...
Definition: Amplifier.h:181
void setReadNoise(double readNoise)
Amplifier read noise, in e-.
Definition: Amplifier.h:332
lsst::geom::Box2I getRawSerialPrescanBBox() const
The bounding box of horizontal/serial prescan pixels in the assembled, untrimmed raw image...
Definition: Amplifier.h:232
lsst::geom::Box2I rawHorizontalOverscanBBox
Definition: Amplifier.h:257
void setRawSerialPrescanBBox(lsst::geom::Box2I const &bbox)
The bounding box of horizontal/serial prescan pixels in the assembled, untrimmed raw image...
Definition: Amplifier.h:401
table::Key< table::Flag > rawFlipX
Definition: Amplifier.cc:128
std::string getLinearityType() const
Name of linearity parameterization.
Definition: Amplifier.h:145
An integer coordinate rectangle.
Definition: Box.h:55
lsst::geom::Box2I getBBox() const
Bounding box of amplifier pixels in the trimmed, assembled image.
Definition: Amplifier.h:115
table::Key< int > readoutCorner
Definition: Amplifier.cc:122
double getLinearityThreshold() const
Level in ADU above which linearity should be applied.
Definition: Amplifier.h:150
table::Key< table::Flag > rawFlipY
Definition: Amplifier.cc:129
Fields const & getFields() const override
Definition: Amplifier.h:411
ReadoutCorner
Readout corner, in the frame of reference of the assembled image.
Definition: Amplifier.h:38
double getSaturation() const
Level in ADU above which pixels are considered saturated; use nan if no such level applies...
Definition: Amplifier.h:127
std::string getLinearityUnits() const
Units for the input to the linearity relation (DN).
Definition: Amplifier.h:159