LSSTApplications  17.0+11,17.0+34,17.0+56,17.0+57,17.0+59,17.0+7,17.0-1-g377950a+33,17.0.1-1-g114240f+2,17.0.1-1-g4d4fbc4+28,17.0.1-1-g55520dc+49,17.0.1-1-g5f4ed7e+52,17.0.1-1-g6dd7d69+17,17.0.1-1-g8de6c91+11,17.0.1-1-gb9095d2+7,17.0.1-1-ge9fec5e+5,17.0.1-1-gf4e0155+55,17.0.1-1-gfc65f5f+50,17.0.1-1-gfc6fb1f+20,17.0.1-10-g87f9f3f+1,17.0.1-11-ge9de802+16,17.0.1-16-ga14f7d5c+4,17.0.1-17-gc79d625+1,17.0.1-17-gdae4c4a+8,17.0.1-2-g26618f5+29,17.0.1-2-g54f2ebc+9,17.0.1-2-gf403422+1,17.0.1-20-g2ca2f74+6,17.0.1-23-gf3eadeb7+1,17.0.1-3-g7e86b59+39,17.0.1-3-gb5ca14a,17.0.1-3-gd08d533+40,17.0.1-30-g596af8797,17.0.1-4-g59d126d+4,17.0.1-4-gc69c472+5,17.0.1-6-g5afd9b9+4,17.0.1-7-g35889ee+1,17.0.1-7-gc7c8782+18,17.0.1-9-gc4bbfb2+3,w.2019.22
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:207
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:235
void setRawFlipY(bool rawFlipY)
flip column order to make an assembled image?
Definition: AmpInfo.cc:248
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:250
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:197
void setReadNoise(double readNoise)
amplifier read noise, in e-
Definition: AmpInfo.cc:198
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:186
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:211
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:245
void setName(std::string const &name)
name of amplifier location in camera
Definition: AmpInfo.cc:175
lsst::geom::Box2I getRawBBox() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:226
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
void setRawPrescanBBox(lsst::geom::Box2I const &bbox)
bounding box of usable (horizontal) prescan pixels on raw image
Definition: AmpInfo.cc:280
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:222
STL class.
bool getRawFlipX() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:244
afw::table::PointKey< int > bboxMin
void setSuspectLevel(double suspectLevel)
level in ADU above which pixels are considered suspicious,
Definition: AmpInfo.cc:193
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:192
lsst::geom::Box2I getBBox() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:177
void setGain(double gain)
amplifier gain in e-/ADU
Definition: AmpInfo.cc:187
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:262
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:200
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:181
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:221
void setRawDataBBox(lsst::geom::Box2I const &bbox)
bounding box of amplifier image pixels on raw image
Definition: AmpInfo.cc:239
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:216
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:174
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:267
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:276
ItemVariant const * other
Definition: Schema.cc:56
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:203
bool getRawFlipY() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:247
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:190
void setLinearityType(std::string const &type)
name of linearity parameterization
Definition: AmpInfo.cc:217
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:271
static Key< Array< double > > getLinearityCoeffsKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:242
SchemaMapper * mapper
Definition: SchemaMapper.cc:78
lsst::geom::Box2I getRawHorizontalOverscanBBox() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:257
void setRawXYOffset(lsst::geom::Extent2I const &xy)
offset for assembling a raw CCD image: desired xy0 - raw xy0
Definition: AmpInfo.cc:253
double getSaturation() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:189
void setRawBBox(lsst::geom::Box2I const &bbox)
bounding box of all amplifier pixels on raw image
Definition: AmpInfo.cc:230
static Key< double > getSaturationKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:239