LSST Applications g070148d5b3+33e5256705,g0d53e28543+25c8b88941,g0da5cf3356+2dd1178308,g1081da9e2a+62d12e78cb,g17e5ecfddb+7e422d6136,g1c76d35bf8+ede3a706f7,g295839609d+225697d880,g2e2c1a68ba+cc1f6f037e,g2ffcdf413f+853cd4dcde,g38293774b4+62d12e78cb,g3b44f30a73+d953f1ac34,g48ccf36440+885b902d19,g4b2f1765b6+7dedbde6d2,g5320a0a9f6+0c5d6105b6,g56b687f8c9+ede3a706f7,g5c4744a4d9+ef6ac23297,g5ffd174ac0+0c5d6105b6,g6075d09f38+66af417445,g667d525e37+2ced63db88,g670421136f+2ced63db88,g71f27ac40c+2ced63db88,g774830318a+463cbe8d1f,g7876bc68e5+1d137996f1,g7985c39107+62d12e78cb,g7fdac2220c+0fd8241c05,g96f01af41f+368e6903a7,g9ca82378b8+2ced63db88,g9d27549199+ef6ac23297,gabe93b2c52+e3573e3735,gb065e2a02a+3dfbe639da,gbc3249ced9+0c5d6105b6,gbec6a3398f+0c5d6105b6,gc9534b9d65+35b9f25267,gd01420fc67+0c5d6105b6,geee7ff78d7+a14128c129,gf63283c776+ede3a706f7,gfed783d017+0c5d6105b6,w.2022.47
LSST Data Management Base Package
Loading...
Searching...
No Matches
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
31namespace lsst {
32namespace afw {
33namespace cameraGeom {
34
38enum class ReadoutCorner {
39 LL,
40 LR,
41 UR,
42 UL,
43};
44
48enum class AssemblyState {
49 RAW,
50 SCIENCE,
51};
52
86class Amplifier {
87public:
88
89 class Builder;
90
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
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
140
142 ndarray::Array<double const, 1, 1> getLinearityCoeffs() const { return getFields().linearityCoeffs; }
143
146
151
156 double getLinearityMaximum() const { return getFields().linearityMaximum; }
157
160
169
178
184 bool getRawFlipX() const { return getFields().rawFlipX; }
185
191 bool getRawFlipY() const { return getFields().rawFlipY; }
192
199
208
217
226
237
248
258
261
262protected:
263
264 struct Fields {
267 double gain = 0.0;
268 double readNoise = 0.0;
269 double saturation = 0.0;
270 double suspectLevel = 0.0;
272 ndarray::Array<double const, 1, 1> linearityCoeffs;
279 bool rawFlipX = false;
280 bool rawFlipY = false;
285 };
286
287 // Amplifier construction and assignment is protected to avoid type-slicing
288 // but permit derived classes to implement safe versions of these.
289
290 Amplifier() = default;
291
292 Amplifier(Amplifier const &) = default;
293 Amplifier(Amplifier &&) = default;
294 Amplifier & operator=(Amplifier const &) = default;
296
297 virtual Fields const & getFields() const = 0;
298
299};
300
305class Amplifier::Builder final : public Amplifier {
306public:
307
314 static Builder fromRecord(table::BaseRecord const & record);
315
317 Builder() = default;
318
320 Builder(Builder const &) = default;
321
323 Builder(Builder &&) = default;
324
326 Builder(Amplifier const & other);
327
329 Builder & operator=(Builder const &) = default;
330
332 Builder & operator=(Builder &&) = default;
333
335 Builder & operator=(Amplifier const & other);
336
337 ~Builder() noexcept override = default;
338
345 std::shared_ptr<Amplifier const> finish() const;
346
348 void setName(std::string const &name) { _fields.name = name; }
349
351 void setBBox(lsst::geom::Box2I const &bbox) { _fields.bbox = bbox; }
352
354 void setGain(double gain) { _fields.gain = gain; }
355
357 void setReadNoise(double readNoise) { _fields.readNoise = readNoise; }
358
360 void setSaturation(double saturation) { _fields.saturation = saturation; }
361
364
367
369 void setLinearityCoeffs(ndarray::Array<double const, 1, 1> const & coeffs) {
370 _fields.linearityCoeffs = coeffs;
371 }
372
375
377 void setLinearityThreshold(double threshold) { _fields.linearityThreshold = threshold; }
378
380 void setLinearityMaximum(double maximum) { _fields.linearityMaximum = maximum; }
381
383 void setLinearityUnits(std::string const & units) { _fields.linearityUnits = units; }
384
386 void setRawBBox(lsst::geom::Box2I const &bbox) { _fields.rawBBox = bbox; }
387
390
392 void setRawFlipX(bool rawFlipX) { _fields.rawFlipX = rawFlipX; }
393
395 void setRawFlipY(bool rawFlipY) { _fields.rawFlipY = rawFlipY; }
396
398 void setRawXYOffset(lsst::geom::Extent2I const &xy) { _fields.rawXYOffset = xy; }
399
403 }
404
408 }
409
412 _fields.rawPrescanBBox = bbox;
413 }
414
418 }
419
423 }
424
427 _fields.rawPrescanBBox = bbox;
428 }
429
432 _fields.rawPrescanBBox = bbox;
433 }
434
435protected:
436 Fields const & getFields() const override { return _fields; }
437private:
438 Fields _fields;
439};
440
441
442
443} // namespace cameraGeom
444} // namespace afw
445} // namespace lsst
446
447#endif // !LSST_AFW_CAMERAGEOM_AMPLIFIER_H_INCLUDED
table::Key< std::string > name
Definition: Amplifier.cc:116
AmpInfoBoxKey bbox
Definition: Amplifier.cc:117
table::Key< double > gain
Definition: Amplifier.cc:118
table::Key< double > saturation
Definition: Amplifier.cc:119
table::Key< double > readNoise
Definition: Amplifier.cc:121
table::Key< table::Flag > rawFlipX
Definition: Amplifier.cc:128
table::Key< int > readoutCorner
Definition: Amplifier.cc:122
table::Key< table::Flag > rawFlipY
Definition: Amplifier.cc:129
table::Key< double > suspectLevel
Definition: Amplifier.cc:120
table::Key< int > type
Definition: Detector.cc:163
A mutable Amplifier subclass class that can be used to incrementally construct or modify Amplifiers.
Definition: Amplifier.h:305
void setSaturation(double saturation)
Level in ADU above which pixels are considered saturated; use nan if no such level applies.
Definition: Amplifier.h:360
void setRawParallelOverscanBBox(lsst::geom::Box2I const &bbox)
The bounding box of parallel overscan pixels (equivalent to vertical overscan pixels) in the image to...
Definition: Amplifier.h:421
void setBBox(lsst::geom::Box2I const &bbox)
Bounding box of amplifier pixels in the trimmed, assembled image.
Definition: Amplifier.h:351
Builder & operator=(Builder const &)=default
Standard copy assignment.
void setRawFlipY(bool rawFlipY)
Is this amplifier (and the image to which it is attached) flipped in the Y direction,...
Definition: Amplifier.h:395
Builder()=default
Construct a Builder with default values for all fields.
void setReadNoise(double readNoise)
Amplifier read noise, in e-.
Definition: Amplifier.h:357
void setLinearityThreshold(double threshold)
Level in ADU above which linearity should be applied.
Definition: Amplifier.h:377
void setLinearityCoeffs(ndarray::Array< double const, 1, 1 > const &coeffs)
Vector of linearity coefficients.
Definition: Amplifier.h:369
Builder(Builder &&)=default
Standard move constructor.
Builder(Builder const &)=default
Standard copy constructor.
void setRawSerialOverscanBBox(lsst::geom::Box2I const &bbox)
The bounding box of serial overscan pixels (equivalent to horizontal overscan pixels) in the image to...
Definition: Amplifier.h:416
~Builder() noexcept override=default
void setRawHorizontalPrescanBBox(lsst::geom::Box2I const &bbox)
The bounding box of horizontal/serial prescan pixels in the image to which it is attached,...
Definition: Amplifier.h:431
static Builder fromRecord(table::BaseRecord const &record)
Construct a new Builder object from the fields in the given record.
Definition: Amplifier.cc:286
void setRawHorizontalOverscanBBox(lsst::geom::Box2I const &bbox)
The bounding box of horizontal overscan pixels in the image to which it is attached,...
Definition: Amplifier.h:401
void setRawFlipX(bool rawFlipX)
Is this amplifier (and the image to which it is attached) flipped in the X direction,...
Definition: Amplifier.h:392
Fields const & getFields() const override
Definition: Amplifier.h:436
void setGain(double gain)
Amplifier gain in e-/ADU.
Definition: Amplifier.h:354
void setReadoutCorner(ReadoutCorner readoutCorner)
Readout corner in the trimmed, assembled image.
Definition: Amplifier.h:366
void setRawDataBBox(lsst::geom::Box2I const &bbox)
Bounding box of amplifier data pixels in the image to which it is attached, which is assumed to be un...
Definition: Amplifier.h:389
Builder & operator=(Builder &&)=default
Standard move assignment.
std::shared_ptr< Amplifier const > finish() const
Construct an immutable Amplifier with the same values as the Builder.
Definition: Amplifier.cc:282
void setLinearityMaximum(double maximum)
Level in ADU above which the linearity relation is poorly defined.
Definition: Amplifier.h:380
void setSuspectLevel(double suspectLevel)
Level in ADU above which pixels are considered suspicious, meaning they may be affected by unknown sy...
Definition: Amplifier.h:363
void setLinearityType(std::string const &type)
Name of linearity parameterization.
Definition: Amplifier.h:374
void setRawVerticalOverscanBBox(lsst::geom::Box2I const &bbox)
The bounding box of vertical overscan pixels in the image to which it is attached,...
Definition: Amplifier.h:406
void setRawXYOffset(lsst::geom::Extent2I const &xy)
Offset in transformation from this amplifier (and the image to which it is attached) to trimmed,...
Definition: Amplifier.h:398
void setRawPrescanBBox(lsst::geom::Box2I const &bbox)
The bounding box of (horizontal) prescan pixels in the image to which it is attached,...
Definition: Amplifier.h:411
void setRawSerialPrescanBBox(lsst::geom::Box2I const &bbox)
The bounding box of horizontal/serial prescan pixels in the image to which it is attached,...
Definition: Amplifier.h:426
void setName(std::string const &name)
Name of the amplifier.
Definition: Amplifier.h:348
void setLinearityUnits(std::string const &units)
Units for the input to the linearity relation (DN).
Definition: Amplifier.h:383
void setRawBBox(lsst::geom::Box2I const &bbox)
Bounding box of the untrimmed amplifier in the image to which it is attached, which is assumed to be ...
Definition: Amplifier.h:386
Geometry and electronic information about raw amplifier images.
Definition: Amplifier.h:86
Amplifier(Amplifier &&)=default
Builder rebuild() const
Return a Builder object initialized with the fields of this.
Definition: Amplifier.cc:271
lsst::geom::Box2I getRawVerticalOverscanBBox() const
The bounding box of vertical overscan pixels in the image to which it is attached,...
Definition: Amplifier.h:216
lsst::geom::Box2I getRawSerialPrescanBBox() const
The bounding box of horizontal/serial prescan pixels in the image to which it is attached,...
Definition: Amplifier.h:257
lsst::geom::Box2I getRawDataBBox() const
Bounding box of amplifier data pixels in the image to which it is attached, which is assumed to be un...
Definition: Amplifier.h:177
lsst::geom::Box2I getRawHorizontalOverscanBBox() const
The bounding box of horizontal overscan pixels in the image to which it is attached,...
Definition: Amplifier.h:207
Amplifier & operator=(Amplifier &&)=default
ndarray::Array< double const, 1, 1 > getLinearityCoeffs() const
Vector of linearity coefficients.
Definition: Amplifier.h:142
bool getRawFlipX() const
Is this amplifier (and the image to which it is attached) flipped in the X direction,...
Definition: Amplifier.h:184
ReadoutCorner getReadoutCorner() const
Readout corner in the trimmed, assembled image.
Definition: Amplifier.h:139
lsst::geom::Box2I getRawSerialOverscanBBox() const
The bounding box of serial overscan pixels (equivalent to horizontal overscan pixels) in the image to...
Definition: Amplifier.h:236
virtual Fields const & getFields() const =0
void toRecord(table::BaseRecord &record) const
Copy the Amplifier's fields into the given record.
Definition: Amplifier.cc:322
lsst::geom::Box2I getRawBBox() const
Bounding box of the untrimmed amplifier in the image to which it is attached, which is assumed to be ...
Definition: Amplifier.h:168
Amplifier(Amplifier const &)=default
lsst::geom::Box2I getRawHorizontalPrescanBBox() const
The bounding box of horizontal/serial prescan pixels in the image to which it is attached,...
Definition: Amplifier.h:260
lsst::geom::Box2I getRawParallelOverscanBBox() const
The bounding box of parallel overscan pixels (equivalent to vertical overscan pixels) in the image to...
Definition: Amplifier.h:247
lsst::geom::Extent2I getRawXYOffset() const
Offset in transformation from this amplifier (and the image to which it is attached) to trimmed,...
Definition: Amplifier.h:198
std::string getName() const
Name of the amplifier.
Definition: Amplifier.h:112
double getLinearityMaximum() const
Level in ADU above which the linearity relation is poorly defined.
Definition: Amplifier.h:156
static table::Schema getRecordSchema()
Return the schema used in the afw.table representation of amplifiers.
Definition: Amplifier.cc:267
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
virtual ~Amplifier() noexcept=default
double getSuspectLevel() const
Level in ADU above which pixels are considered suspicious, meaning they may be affected by unknown sy...
Definition: Amplifier.h:136
bool getRawFlipY() const
Is this amplifier (and the image to which it is attached) flipped in the Y direction,...
Definition: Amplifier.h:191
Amplifier & operator=(Amplifier const &)=default
std::string getLinearityType() const
Name of linearity parameterization.
Definition: Amplifier.h:145
lsst::geom::Box2I getRawPrescanBBox() const
The bounding box of (horizontal) prescan pixels in the image to which it is attached,...
Definition: Amplifier.h:225
double getReadNoise() const
Amplifier read noise, in e-.
Definition: Amplifier.h:121
double getGain() const
Amplifier gain in e-/ADU.
Definition: Amplifier.h:118
double getLinearityThreshold() const
Level in ADU above which linearity should be applied.
Definition: Amplifier.h:150
lsst::geom::Box2I getBBox() const
Bounding box of amplifier pixels in the trimmed, assembled image.
Definition: Amplifier.h:115
Base class for all records.
Definition: BaseRecord.h:31
Defines the fields and offsets for a table.
Definition: Schema.h:51
An integer coordinate rectangle.
Definition: Box.h:55
ReadoutCorner
Readout corner, in the frame of reference of the assembled image.
Definition: Amplifier.h:38
AssemblyState
Assembly state of the amplifier, used to identify bounding boxes and component existence.
Definition: Amplifier.h:48
STL namespace.
lsst::geom::Box2I rawHorizontalOverscanBBox
Definition: Amplifier.h:282
ndarray::Array< double const, 1, 1 > linearityCoeffs
Definition: Amplifier.h:272