LSSTApplications  17.0+115,17.0+12,17.0+65,18.0.0+14,18.0.0+29,18.0.0+6,18.0.0+70,18.0.0-4-g68ffd23+1,18.1.0-1-g0001055+9,18.1.0-1-g03d53ef+2,18.1.0-1-g1349e88+44,18.1.0-1-g2505f39+35,18.1.0-1-g5315e5e+2,18.1.0-1-g5e4b7ea+11,18.1.0-1-g7e8fceb+2,18.1.0-1-g85f8cd4+38,18.1.0-1-gd55f500+25,18.1.0-13-gfe4edf0b,18.1.0-14-g259bd21+9,18.1.0-14-gd04256d+35,18.1.0-2-g4903023+12,18.1.0-2-g5f9922c+13,18.1.0-2-gd3b74e5+3,18.1.0-2-gfbf3545+22,18.1.0-2-gfefb8b5+34,18.1.0-22-g936f6a9b4,18.1.0-23-g364d03b8,18.1.0-23-g52ab674,18.1.0-3-g52aa583+17,18.1.0-3-g8f4a2b1+32,18.1.0-3-gb69f684+30,18.1.0-4-g1ee41a7+2,18.1.0-5-g6dbcb01+31,18.1.0-5-gc286bb7+4,18.1.0-6-g857e778+4,18.1.0-7-gae09a6d+18,18.1.0-8-g42b2ab3+10,18.1.0-8-gc69d46e+17,18.1.0-9-gee19f03+2,w.2019.44
LSSTDataManagementBasePackage
AmpInfo.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 /*
3  * LSST Data Management System
4  * Copyright 2008, 2009, 2010, 2011 LSST Corporation.
5  *
6  * This product includes software developed by the
7  * LSST Project (http://www.lsst.org/).
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 LSST License Statement and
20  * the GNU General Public License along with this program. If not,
21  * see <http://www.lsstcorp.org/LegalNotices/>.
22  */
23 #ifndef AFW_TABLE_AmpInfo_h_INCLUDED
24 #define AFW_TABLE_AmpInfo_h_INCLUDED
25 
28 #include "lsst/afw/table/Catalog.h"
31 
32 namespace lsst {
33 namespace afw {
34 namespace table {
35 
40  LL,
41  LR,
42  UR,
43  UL,
44 };
45 
46 class AmpInfoRecord;
47 class AmpInfoTable;
48 
79 class AmpInfoRecord : public BaseRecord {
80 public:
85 
86  AmpInfoRecord(AmpInfoRecord const &) = delete;
87  AmpInfoRecord(AmpInfoRecord &&) = delete;
88  AmpInfoRecord &operator=(AmpInfoRecord const &) = delete;
90  ~AmpInfoRecord() override;
91 
102  BaseRecord(token, std::move(data))
103  {}
104 
107  }
108 
110  std::string getName() const;
112  void setName(std::string const &name);
113 
114  lsst::geom::Box2I getBBox() const;
115  void setBBox(lsst::geom::Box2I const &bbox);
116 
117  double getGain() const;
118  void setGain(double gain);
119 
120  double getReadNoise() const;
121  void setReadNoise(double readNoise);
122 
123  double getSaturation() const;
124  void setSaturation(double saturation);
125 
127  double getSuspectLevel() const;
128  void setSuspectLevel(
129  double suspectLevel);
130 
136 
138  void setLinearityCoeffs(std::vector<double> const &coeffs);
139 
141  void setLinearityType(std::string const &type);
142 
143  bool getHasRawInfo() const;
144  void setHasRawInfo(bool hasRawInfo);
145 
147  void setRawBBox(lsst::geom::Box2I const &bbox);
148 
150  void setRawDataBBox(
151  lsst::geom::Box2I const &bbox);
152 
153  bool getRawFlipX() const;
154  void setRawFlipX(bool rawFlipX);
155 
156  bool getRawFlipY() const;
157  void setRawFlipY(bool rawFlipY);
158 
161  &xy);
162 
165  lsst::geom::Box2I const &bbox);
166 
169  lsst::geom::Box2I const &bbox);
170 
172  void setRawPrescanBBox(lsst::geom::Box2I const &bbox);
173 
176 
177 private:
178  friend class AmpInfoTable;
179 };
180 
186 class AmpInfoTable : public BaseTable {
187 public:
192  static int const MAX_NAME_LENGTH = 64; // max length for amplifier name
193  static int const MAX_LINEARITY_COEFFS = 4; // max number of linearity coefficients
194  static int const MAX_LINEARITY_TYPE_LENGTH = 64; // max length for linearity type
195 
196  AmpInfoTable &operator=(AmpInfoTable const &) = delete;
197  AmpInfoTable &operator=(AmpInfoTable &&) = delete;
198  ~AmpInfoTable() override;
199 
205  static std::shared_ptr<AmpInfoTable> make(Schema const &schema);
206 
215  Schema r = getMinimalSchema().schema;
216  r.disconnectAliases();
217  return r;
218  }
219 
226  static bool checkSchema(Schema const &other) { return other.contains(getMinimalSchema().schema); }
227 
229 
234  static Key<std::string> getNameKey() { return getMinimalSchema().name; }
235  static PointKey<int> getBBoxMinKey() { return getMinimalSchema().bboxMin; }
236  static PointKey<int> getBBoxExtentKey() { return getMinimalSchema().bboxExtent; }
237  static Key<double> getGainKey() { return getMinimalSchema().gain; }
238  static Key<double> getReadNoiseKey() { return getMinimalSchema().readNoise; }
239  static Key<double> getSaturationKey() { return getMinimalSchema().saturation; }
240  static Key<double> getSuspectLevelKey() { return getMinimalSchema().suspectLevel; }
241  static Key<int> getReadoutCornerKey() { return getMinimalSchema().readoutCorner; }
242  static Key<Array<double> > getLinearityCoeffsKey() { return getMinimalSchema().linearityCoeffs; }
243  static Key<std::string> getLinearityTypeKey() { return getMinimalSchema().linearityType; }
244  static Key<Flag> getHasRawInfoKey() { return getMinimalSchema().hasRawInfo; }
245  static PointKey<int> getRawBBoxMinKey() { return getMinimalSchema().rawBBoxMin; }
246  static PointKey<int> getRawBBoxExtentKey() { return getMinimalSchema().rawBBoxExtent; }
247  static PointKey<int> getRawDataBBoxMinKey() { return getMinimalSchema().rawDataBBoxMin; }
248  static PointKey<int> getRawDataBBoxExtentKey() { return getMinimalSchema().rawDataBBoxExtent; }
249  static Key<Flag> getRawFlipXKey() { return getMinimalSchema().rawFlipX; }
250  static Key<Flag> getRawFlipYKey() { return getMinimalSchema().rawFlipY; }
251  static PointKey<int> getRawXYOffsetKey() { return getMinimalSchema().rawXYOffset; }
253  return getMinimalSchema().rawHorizontalOverscanBBoxMin;
254  }
256  return getMinimalSchema().rawHorizontalOverscanBBoxExtent;
257  }
259  return getMinimalSchema().rawVerticalOverscanBBoxMin;
260  }
262  return getMinimalSchema().rawVerticalOverscanBBoxExtent;
263  }
264  static PointKey<int> getRawPrescanBBoxMinKey() { return getMinimalSchema().rawPrescanBBoxMin; }
265  static PointKey<int> getRawPrescanBBoxExtentKey() { return getMinimalSchema().rawPrescanBBoxExtent; }
267 
270 
273  return std::static_pointer_cast<AmpInfoRecord>(_makeRecord());
274  }
275 
279  }
280 
284  }
285 
286 protected:
287  explicit AmpInfoTable(Schema const &schema);
288 
289  explicit AmpInfoTable(AmpInfoTable const &other);
290  explicit AmpInfoTable(AmpInfoTable &&other);
291 
292  std::shared_ptr<BaseTable> _clone() const override;
293 
294  std::shared_ptr<BaseRecord> _makeRecord() override;
295 
296 private:
297  // Struct that holds the minimal schema and the special keys we've added to it.
298  struct MinimalSchema {
299  Schema schema;
302  PointKey<int> bboxExtent;
303  Key<double> gain;
304  Key<double> readNoise;
305  Key<double> saturation;
306  Key<double> suspectLevel;
307  Key<int> readoutCorner;
308  Key<Array<double> > linearityCoeffs;
309  Key<std::string> linearityType;
310  Key<Flag> hasRawInfo;
311  PointKey<int> rawBBoxMin;
312  PointKey<int> rawBBoxExtent;
313  PointKey<int> rawDataBBoxMin;
314  PointKey<int> rawDataBBoxExtent;
315  Key<Flag> rawFlipX;
316  Key<Flag> rawFlipY;
317  PointKey<int> rawXYOffset;
318  PointKey<int> rawHorizontalOverscanBBoxMin;
319  PointKey<int> rawHorizontalOverscanBBoxExtent;
320  PointKey<int> rawVerticalOverscanBBoxMin;
321  PointKey<int> rawVerticalOverscanBBoxExtent;
322  PointKey<int> rawPrescanBBoxMin;
323  PointKey<int> rawPrescanBBoxExtent;
324  MinimalSchema();
325  };
326 
327  // Return the singleton minimal schema.
328  static MinimalSchema &getMinimalSchema();
329 
330  friend class io::FitsWriter;
331 
332  // Return a writer object that knows how to save in FITS format. See also FitsWriter.
333  std::shared_ptr<io::FitsWriter> makeFitsWriter(fits::Fits *fitsfile, int flags) const override;
334 };
335 } // namespace table
336 } // namespace afw
337 } // namespace lsst
338 
339 #endif // !AFW_TABLE_AmpInfo_h_INCLUDED
std::vector< double > getLinearityCoeffs() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:206
Defines the fields and offsets for a table.
Definition: Schema.h:50
static PointKey< int > getRawPrescanBBoxExtentKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:265
lsst::geom::Box2I getRawDataBBox() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:234
void setRawFlipY(bool rawFlipY)
flip column order to make an assembled image?
Definition: AmpInfo.cc:247
CatalogT< AmpInfoRecord > Catalog
Definition: AmpInfo.h:83
Writer object for FITS binary tables.
Definition: FitsWriter.h:25
static Key< Flag > getRawFlipXKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:249
lsst::geom::Extent2I getRawXYOffset() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:249
Geometry and electronic information about raw amplifier images.
Definition: AmpInfo.h:79
Helper struct that contains the information passed from BaseTable to BaseRecord at construction...
Definition: BaseTable.h:32
double getReadNoise() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:196
void setReadNoise(double readNoise)
amplifier read noise, in e-
Definition: AmpInfo.cc:197
std::shared_ptr< AmpInfoTable > clone() const
Return a polymorphic deep copy of the table.
Definition: AmpInfo.h:269
double getGain() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:185
A mapping between the keys of two Schemas, used to copy data between them.
Definition: SchemaMapper.h:21
void setLinearityCoeffs(std::vector< double > const &coeffs)
vector of linearity coefficients
Definition: AmpInfo.cc:210
static PointKey< int > getRawXYOffsetKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:251
CatalogT< Record > Catalog
Definition: AmpInfo.h:190
static PointKey< int > getRawDataBBoxMinKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:247
static PointKey< int > getRawVerticalOverscanBBoxMinKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:258
void setRawFlipX(bool rawFlipX)
flip row order to make assembled image?
Definition: AmpInfo.cc:244
void setName(std::string const &name)
name of amplifier location in camera
Definition: AmpInfo.cc:174
lsst::geom::Box2I getRawBBox() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:225
void disconnectAliases()
Sever the connection between this schema and any others with which it shares aliases.
Definition: Schema.cc:729
STL namespace.
static Schema makeMinimalSchema()
Return a minimal schema for AmpInfo tables and records.
Definition: AmpInfo.h:214
ImageT val
Definition: CR.cc:146
static Key< std::string > getLinearityTypeKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:243
CatalogT< AmpInfoRecord const > ConstCatalog
Definition: AmpInfo.h:84
static PointKey< int > getRawBBoxMinKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:245
ItemVariant const * other
Definition: Schema.cc:56
SchemaMapper * mapper
Definition: SchemaMapper.cc:78
void setRawPrescanBBox(lsst::geom::Box2I const &bbox)
bounding box of usable (horizontal) prescan pixels on raw image
Definition: AmpInfo.cc:279
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
Definition: fits.h:297
std::shared_ptr< BaseRecord > copyRecord(BaseRecord const &input)
Deep-copy a record, requiring that it have the same schema as this table.
Definition: BaseTable.cc:125
static bool checkSchema(Schema const &other)
Return true if the given schema is a valid AmpInfoTable schema.
Definition: AmpInfo.h:226
void setHasRawInfo(bool hasRawInfo)
does this table have raw amplifier information?
Definition: AmpInfo.cc:221
STL class.
bool getRawFlipX() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:243
afw::table::PointKey< int > bboxMin
void setSuspectLevel(double suspectLevel)
level in ADU above which pixels are considered suspicious,
Definition: AmpInfo.cc:192
static PointKey< int > getRawHorizontalOverscanBBoxExtentKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:255
double getSuspectLevel() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:191
lsst::geom::Box2I getBBox() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:176
void setGain(double gain)
amplifier gain in e-/ADU
Definition: AmpInfo.cc:186
static Key< double > getSuspectLevelKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:240
A base class for image defects.
char * data
Definition: BaseRecord.cc:62
table::Key< int > type
Definition: Detector.cc:167
static PointKey< int > getBBoxMinKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:235
int contains(Schema const &other, int flags=EQUAL_KEYS) const
Test whether the given schema is a subset of this.
Definition: Schema.cc:679
void setRawHorizontalOverscanBBox(lsst::geom::Box2I const &bbox)
bounding box of usable horizontal overscan pixels
Definition: AmpInfo.cc:261
std::shared_ptr< AmpInfoRecord > makeRecord()
Default-construct an associated record.
Definition: AmpInfo.h:272
table::Schema schema
Definition: Camera.cc:161
ColumnViewT< AmpInfoRecord > ColumnView
Definition: AmpInfo.h:82
T static_pointer_cast(T... args)
table::Box2IKey bbox
Definition: Detector.cc:169
static PointKey< int > getRawBBoxExtentKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:246
ReadoutCorner getReadoutCorner() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:199
static Key< Flag > getRawFlipYKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:250
ColumnViewT< AmpInfoRecord > ColumnView
Definition: AmpInfo.h:189
void setBBox(lsst::geom::Box2I const &bbox)
bounding box of amplifier pixels in assembled image
Definition: AmpInfo.cc:180
AmpInfoRecord(ConstructionToken const &token, detail::RecordData &&data)
Constructor used by AmpInfoTable.
Definition: AmpInfo.h:101
static Key< Flag > getHasRawInfoKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:244
ReadoutCorner
Readout corner, in the frame of reference of the assembled image.
Definition: AmpInfo.h:39
std::shared_ptr< BaseTable const > getTable() const
Return the table this record is associated with.
Definition: BaseRecord.h:83
bool getHasRawInfo() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:220
void setRawDataBBox(lsst::geom::Box2I const &bbox)
bounding box of amplifier image pixels on raw image
Definition: AmpInfo.cc:238
Base class for all records.
Definition: BaseRecord.h:31
std::string getLinearityType() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:215
std::shared_ptr< AmpInfoRecord > copyRecord(BaseRecord const &other)
Deep-copy a record, requiring that it have the same schema as this table.
Definition: AmpInfo.h:277
Key specialization for Flag.
Definition: Flag.h:94
std::string getName() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:173
AmpInfoRecord & operator=(AmpInfoRecord const &)=delete
CatalogT< Record const > ConstCatalog
Definition: AmpInfo.h:191
lsst::geom::Box2I getRawVerticalOverscanBBox() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:266
AmpInfoRecord(AmpInfoRecord const &)=delete
static PointKey< int > getRawVerticalOverscanBBoxExtentKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:261
static PointKey< int > getRawPrescanBBoxMinKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:264
lsst::geom::Box2I getRawPrescanBBox() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:275
static Key< double > getReadNoiseKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:238
void setReadoutCorner(ReadoutCorner val)
set readout corner
Definition: AmpInfo.cc:202
bool getRawFlipY() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:246
static Key< int > getReadoutCornerKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:241
static PointKey< int > getRawDataBBoxExtentKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:248
void setSaturation(double saturation)
level in ADU above which pixels are considered saturated;
Definition: AmpInfo.cc:189
void setLinearityType(std::string const &type)
name of linearity parameterization
Definition: AmpInfo.cc:216
An integer coordinate rectangle.
Definition: Box.h:54
static Key< std::string > getNameKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:234
static PointKey< int > getBBoxExtentKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:236
Table of amplifier information (AmpInfoRecord records)
Definition: AmpInfo.h:186
static PointKey< int > getRawHorizontalOverscanBBoxMinKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:252
Base class for all tables.
Definition: BaseTable.h:61
static Key< double > getGainKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:237
std::shared_ptr< AmpInfoRecord > copyRecord(BaseRecord const &other, SchemaMapper const &mapper)
Deep-copy a record, requiring that it have the same schema as this table.
Definition: AmpInfo.h:282
std::shared_ptr< AmpInfoTable const > getTable() const
Definition: AmpInfo.h:105
void setRawVerticalOverscanBBox(lsst::geom::Box2I const &bbox)
bounding box of usable vertical overscan pixels
Definition: AmpInfo.cc:270
static Key< Array< double > > getLinearityCoeffsKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:242
lsst::geom::Box2I getRawHorizontalOverscanBBox() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:256
void setRawXYOffset(lsst::geom::Extent2I const &xy)
offset for assembling a raw CCD image: desired xy0 - raw xy0
Definition: AmpInfo.cc:252
double getSaturation() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:188
void setRawBBox(lsst::geom::Box2I const &bbox)
bounding box of all amplifier pixels on raw image
Definition: AmpInfo.cc:229
static Key< double > getSaturationKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:239