LSSTApplications  16.0-10-g0ee56ad+5,16.0-11-ga33d1f2+5,16.0-12-g3ef5c14+3,16.0-12-g71e5ef5+18,16.0-12-gbdf3636+3,16.0-13-g118c103+3,16.0-13-g8f68b0a+3,16.0-15-gbf5c1cb+4,16.0-16-gfd17674+3,16.0-17-g7c01f5c+3,16.0-18-g0a50484+1,16.0-20-ga20f992+8,16.0-21-g0e05fd4+6,16.0-21-g15e2d33+4,16.0-22-g62d8060+4,16.0-22-g847a80f+4,16.0-25-gf00d9b8+1,16.0-28-g3990c221+4,16.0-3-gf928089+3,16.0-32-g88a4f23+5,16.0-34-gd7987ad+3,16.0-37-gc7333cb+2,16.0-4-g10fc685+2,16.0-4-g18f3627+26,16.0-4-g5f3a788+26,16.0-5-gaf5c3d7+4,16.0-5-gcc1f4bb+1,16.0-6-g3b92700+4,16.0-6-g4412fcd+3,16.0-6-g7235603+4,16.0-69-g2562ce1b+2,16.0-8-g14ebd58+4,16.0-8-g2df868b+1,16.0-8-g4cec79c+6,16.0-8-gadf6c7a+1,16.0-8-gfc7ad86,16.0-82-g59ec2a54a+1,16.0-9-g5400cdc+2,16.0-9-ge6233d7+5,master-g2880f2d8cf+3,v17.0.rc1
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 
94  }
95 
97  std::string getName() const;
99  void setName(std::string const &name);
100 
101  lsst::geom::Box2I getBBox() const;
102  void setBBox(lsst::geom::Box2I const &bbox);
103 
104  double getGain() const;
105  void setGain(double gain);
106 
107  double getReadNoise() const;
108  void setReadNoise(double readNoise);
109 
110  double getSaturation() const;
111  void setSaturation(double saturation);
112 
114  double getSuspectLevel() const;
115  void setSuspectLevel(
116  double suspectLevel);
117 
123 
125  void setLinearityCoeffs(std::vector<double> const &coeffs);
126 
128  void setLinearityType(std::string const &type);
129 
130  bool getHasRawInfo() const;
131  void setHasRawInfo(bool hasRawInfo);
132 
134  void setRawBBox(lsst::geom::Box2I const &bbox);
135 
137  void setRawDataBBox(
138  lsst::geom::Box2I const &bbox);
139 
140  bool getRawFlipX() const;
141  void setRawFlipX(bool rawFlipX);
142 
143  bool getRawFlipY() const;
144  void setRawFlipY(bool rawFlipY);
145 
148  &xy);
149 
152  lsst::geom::Box2I const &bbox);
153 
156  lsst::geom::Box2I const &bbox);
157 
159  void setRawPrescanBBox(lsst::geom::Box2I const &bbox);
160 
163 
164 protected:
165  friend class AmpInfoTable;
166 
168 };
169 
175 class AmpInfoTable : public BaseTable {
176 public:
181  static int const MAX_NAME_LENGTH = 64; // max length for amplifier name
182  static int const MAX_LINEARITY_COEFFS = 4; // max number of linearity coefficients
183  static int const MAX_LINEARITY_TYPE_LENGTH = 64; // max length for linearity type
184 
185  AmpInfoTable &operator=(AmpInfoTable const &) = delete;
186  AmpInfoTable &operator=(AmpInfoTable &&) = delete;
187  ~AmpInfoTable() override;
188 
194  static std::shared_ptr<AmpInfoTable> make(Schema const &schema);
195 
204  Schema r = getMinimalSchema().schema;
205  r.disconnectAliases();
206  return r;
207  }
208 
215  static bool checkSchema(Schema const &other) { return other.contains(getMinimalSchema().schema); }
216 
218 
223  static Key<std::string> getNameKey() { return getMinimalSchema().name; }
224  static PointKey<int> getBBoxMinKey() { return getMinimalSchema().bboxMin; }
225  static PointKey<int> getBBoxExtentKey() { return getMinimalSchema().bboxExtent; }
226  static Key<double> getGainKey() { return getMinimalSchema().gain; }
227  static Key<double> getReadNoiseKey() { return getMinimalSchema().readNoise; }
228  static Key<double> getSaturationKey() { return getMinimalSchema().saturation; }
229  static Key<double> getSuspectLevelKey() { return getMinimalSchema().suspectLevel; }
230  static Key<int> getReadoutCornerKey() { return getMinimalSchema().readoutCorner; }
231  static Key<Array<double> > getLinearityCoeffsKey() { return getMinimalSchema().linearityCoeffs; }
232  static Key<std::string> getLinearityTypeKey() { return getMinimalSchema().linearityType; }
233  static Key<Flag> getHasRawInfoKey() { return getMinimalSchema().hasRawInfo; }
234  static PointKey<int> getRawBBoxMinKey() { return getMinimalSchema().rawBBoxMin; }
235  static PointKey<int> getRawBBoxExtentKey() { return getMinimalSchema().rawBBoxExtent; }
236  static PointKey<int> getRawDataBBoxMinKey() { return getMinimalSchema().rawDataBBoxMin; }
237  static PointKey<int> getRawDataBBoxExtentKey() { return getMinimalSchema().rawDataBBoxExtent; }
238  static Key<Flag> getRawFlipXKey() { return getMinimalSchema().rawFlipX; }
239  static Key<Flag> getRawFlipYKey() { return getMinimalSchema().rawFlipY; }
240  static PointKey<int> getRawXYOffsetKey() { return getMinimalSchema().rawXYOffset; }
242  return getMinimalSchema().rawHorizontalOverscanBBoxMin;
243  }
245  return getMinimalSchema().rawHorizontalOverscanBBoxExtent;
246  }
248  return getMinimalSchema().rawVerticalOverscanBBoxMin;
249  }
251  return getMinimalSchema().rawVerticalOverscanBBoxExtent;
252  }
253  static PointKey<int> getRawPrescanBBoxMinKey() { return getMinimalSchema().rawPrescanBBoxMin; }
254  static PointKey<int> getRawPrescanBBoxExtentKey() { return getMinimalSchema().rawPrescanBBoxExtent; }
256 
259 
262  return std::static_pointer_cast<AmpInfoRecord>(_makeRecord());
263  }
264 
268  }
269 
273  }
274 
275 protected:
276  explicit AmpInfoTable(Schema const &schema);
277 
278  explicit AmpInfoTable(AmpInfoTable const &other);
279  explicit AmpInfoTable(AmpInfoTable &&other);
280 
281  std::shared_ptr<BaseTable> _clone() const override;
282 
283  std::shared_ptr<BaseRecord> _makeRecord() override;
284 
285 private:
286  // Struct that holds the minimal schema and the special keys we've added to it.
287  struct MinimalSchema {
288  Schema schema;
291  PointKey<int> bboxExtent;
292  Key<double> gain;
293  Key<double> readNoise;
294  Key<double> saturation;
295  Key<double> suspectLevel;
296  Key<int> readoutCorner;
297  Key<Array<double> > linearityCoeffs;
298  Key<std::string> linearityType;
299  Key<Flag> hasRawInfo;
300  PointKey<int> rawBBoxMin;
301  PointKey<int> rawBBoxExtent;
302  PointKey<int> rawDataBBoxMin;
303  PointKey<int> rawDataBBoxExtent;
304  Key<Flag> rawFlipX;
305  Key<Flag> rawFlipY;
306  PointKey<int> rawXYOffset;
307  PointKey<int> rawHorizontalOverscanBBoxMin;
308  PointKey<int> rawHorizontalOverscanBBoxExtent;
309  PointKey<int> rawVerticalOverscanBBoxMin;
310  PointKey<int> rawVerticalOverscanBBoxExtent;
311  PointKey<int> rawPrescanBBoxMin;
312  PointKey<int> rawPrescanBBoxExtent;
313  MinimalSchema();
314  };
315 
316  // Return the singleton minimal schema.
317  static MinimalSchema &getMinimalSchema();
318 
319  friend class io::FitsWriter;
320 
321  // Return a writer object that knows how to save in FITS format. See also FitsWriter.
322  std::shared_ptr<io::FitsWriter> makeFitsWriter(fits::Fits *fitsfile, int flags) const override;
323 };
324 } // namespace table
325 } // namespace afw
326 } // namespace lsst
327 
328 #endif // !AFW_TABLE_AmpInfo_h_INCLUDED
std::vector< double > getLinearityCoeffs() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:209
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:254
lsst::geom::Box2I getRawDataBBox() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:237
void setRawFlipY(bool rawFlipY)
flip column order to make an assembled image?
Definition: AmpInfo.cc:250
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:238
lsst::geom::Extent2I getRawXYOffset() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:252
Geometry and electronic information about raw amplifier images.
Definition: AmpInfo.h:79
double getReadNoise() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:199
void setReadNoise(double readNoise)
amplifier read noise, in e-
Definition: AmpInfo.cc:200
std::shared_ptr< AmpInfoTable > clone() const
Return a polymorphic deep copy of the table.
Definition: AmpInfo.h:258
double getGain() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:188
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:213
static PointKey< int > getRawXYOffsetKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:240
CatalogT< Record > Catalog
Definition: AmpInfo.h:179
static PointKey< int > getRawDataBBoxMinKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:236
static PointKey< int > getRawVerticalOverscanBBoxMinKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:247
void setRawFlipX(bool rawFlipX)
flip row order to make assembled image?
Definition: AmpInfo.cc:247
void setName(std::string const &name)
name of amplifier location in camera
Definition: AmpInfo.cc:177
lsst::geom::Box2I getRawBBox() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:228
void disconnectAliases()
Sever the connection between this schema and any others with which it shares aliases.
Definition: Schema.cc:729
static Schema makeMinimalSchema()
Return a minimal schema for AmpInfo tables and records.
Definition: AmpInfo.h:203
ImageT val
Definition: CR.cc:146
static Key< std::string > getLinearityTypeKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:232
CatalogT< AmpInfoRecord const > ConstCatalog
Definition: AmpInfo.h:84
static PointKey< int > getRawBBoxMinKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:234
void setRawPrescanBBox(lsst::geom::Box2I const &bbox)
bounding box of usable (horizontal) prescan pixels on raw image
Definition: AmpInfo.cc:282
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
Definition: fits.h:296
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
STL class.
static bool checkSchema(Schema const &other)
Return true if the given schema is a valid AmpInfoTable schema.
Definition: AmpInfo.h:215
void setHasRawInfo(bool hasRawInfo)
does this table have raw amplifier information?
Definition: AmpInfo.cc:224
STL class.
bool getRawFlipX() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:246
afw::table::PointKey< int > bboxMin
void setSuspectLevel(double suspectLevel)
level in ADU above which pixels are considered suspicious,
Definition: AmpInfo.cc:195
static PointKey< int > getRawHorizontalOverscanBBoxExtentKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:244
double getSuspectLevel() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:194
lsst::geom::Box2I getBBox() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:179
void setGain(double gain)
amplifier gain in e-/ADU
Definition: AmpInfo.cc:189
static Key< double > getSuspectLevelKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:229
A base class for image defects.
table::Key< int > type
Definition: Detector.cc:164
static PointKey< int > getBBoxMinKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:224
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:264
std::shared_ptr< AmpInfoRecord > makeRecord()
Default-construct an associated record.
Definition: AmpInfo.h:261
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:166
static PointKey< int > getRawBBoxExtentKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:235
ReadoutCorner getReadoutCorner() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:202
static Key< Flag > getRawFlipYKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:239
ColumnViewT< AmpInfoRecord > ColumnView
Definition: AmpInfo.h:178
void setBBox(lsst::geom::Box2I const &bbox)
bounding box of amplifier pixels in assembled image
Definition: AmpInfo.cc:183
static Key< Flag > getHasRawInfoKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:233
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:57
bool getHasRawInfo() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:223
void setRawDataBBox(lsst::geom::Box2I const &bbox)
bounding box of amplifier image pixels on raw image
Definition: AmpInfo.cc:241
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:218
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:266
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:176
AmpInfoRecord & operator=(AmpInfoRecord const &)=delete
CatalogT< Record const > ConstCatalog
Definition: AmpInfo.h:180
lsst::geom::Box2I getRawVerticalOverscanBBox() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:269
AmpInfoRecord(AmpInfoRecord const &)=delete
static PointKey< int > getRawVerticalOverscanBBoxExtentKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:250
static PointKey< int > getRawPrescanBBoxMinKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:253
lsst::geom::Box2I getRawPrescanBBox() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:278
ItemVariant const * other
Definition: Schema.cc:56
static Key< double > getReadNoiseKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:227
void setReadoutCorner(ReadoutCorner val)
set readout corner
Definition: AmpInfo.cc:205
bool getRawFlipY() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:249
static Key< int > getReadoutCornerKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:230
static PointKey< int > getRawDataBBoxExtentKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:237
void setSaturation(double saturation)
level in ADU above which pixels are considered saturated;
Definition: AmpInfo.cc:192
void setLinearityType(std::string const &type)
name of linearity parameterization
Definition: AmpInfo.cc:219
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:223
static PointKey< int > getBBoxExtentKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:225
Table of amplifier information (AmpInfoRecord records)
Definition: AmpInfo.h:175
static PointKey< int > getRawHorizontalOverscanBBoxMinKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:241
Base class for all tables.
Definition: BaseTable.h:44
static Key< double > getGainKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:226
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:271
std::shared_ptr< AmpInfoTable const > getTable() const
Definition: AmpInfo.h:92
void setRawVerticalOverscanBBox(lsst::geom::Box2I const &bbox)
bounding box of usable vertical overscan pixels
Definition: AmpInfo.cc:273
static Key< Array< double > > getLinearityCoeffsKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:231
SchemaMapper * mapper
Definition: SchemaMapper.cc:78
lsst::geom::Box2I getRawHorizontalOverscanBBox() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:259
void setRawXYOffset(lsst::geom::Extent2I const &xy)
offset for assembling a raw CCD image: desired xy0 - raw xy0
Definition: AmpInfo.cc:255
double getSaturation() const
Convenience accessors for the keys in the minimal reference schema.
Definition: AmpInfo.cc:191
void setRawBBox(lsst::geom::Box2I const &bbox)
bounding box of all amplifier pixels on raw image
Definition: AmpInfo.cc:232
static Key< double > getSaturationKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:228