lsst.afw  14.0-52-g19103d347
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;
89  AmpInfoRecord & operator=(AmpInfoRecord &&) = delete;
91 
94  }
95 
97  std::string getName() const;
99  void setName(std::string const &name);
100 
101  geom::Box2I getBBox() const;
102  void setBBox(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 
122  void setReadoutCorner(ReadoutCorner val);
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 
133  geom::Box2I getRawBBox() const;
134  void setRawBBox(geom::Box2I const &bbox);
135 
136  geom::Box2I getRawDataBBox() const;
137  void setRawDataBBox(geom::Box2I const &bbox);
138 
139  bool getRawFlipX() const;
140  void setRawFlipX(bool rawFlipX);
141 
142  bool getRawFlipY() const;
143  void setRawFlipY(bool rawFlipY);
144 
146  void setRawXYOffset(
147  geom::Extent2I const &xy);
148 
151  geom::Box2I const &bbox);
152 
155  geom::Box2I const &bbox);
156 
158  void setRawPrescanBBox(
159  geom::Box2I const &bbox);
160 
162 
163 protected:
164  friend class AmpInfoTable;
165 
166  explicit AmpInfoRecord(std::shared_ptr<AmpInfoTable> const &table);
167 };
168 
174 class AmpInfoTable : public BaseTable {
175 public:
180  static int const MAX_NAME_LENGTH = 64; // max length for amplifier name
181  static int const MAX_LINEARITY_COEFFS = 4; // max number of linearity coefficients
182  static int const MAX_LINEARITY_TYPE_LENGTH = 64; // max length for linearity type
183 
184  AmpInfoTable & operator=(AmpInfoTable const &) = delete;
185  AmpInfoTable & operator=(AmpInfoTable &&) = delete;
186  ~AmpInfoTable();
187 
193  static std::shared_ptr<AmpInfoTable> make(Schema const &schema);
194 
203  Schema r = getMinimalSchema().schema;
204  r.disconnectAliases();
205  return r;
206  }
207 
214  static bool checkSchema(Schema const &other) { return other.contains(getMinimalSchema().schema); }
215 
217 
222  static Key<std::string> getNameKey() { return getMinimalSchema().name; }
223  static PointKey<int> getBBoxMinKey() { return getMinimalSchema().bboxMin; }
224  static PointKey<int> getBBoxExtentKey() { return getMinimalSchema().bboxExtent; }
225  static Key<double> getGainKey() { return getMinimalSchema().gain; }
226  static Key<double> getReadNoiseKey() { return getMinimalSchema().readNoise; }
227  static Key<double> getSaturationKey() { return getMinimalSchema().saturation; }
228  static Key<double> getSuspectLevelKey() { return getMinimalSchema().suspectLevel; }
229  static Key<int> getReadoutCornerKey() { return getMinimalSchema().readoutCorner; }
230  static Key<Array<double> > getLinearityCoeffsKey() { return getMinimalSchema().linearityCoeffs; }
231  static Key<std::string> getLinearityTypeKey() { return getMinimalSchema().linearityType; }
232  static Key<Flag> getHasRawInfoKey() { return getMinimalSchema().hasRawInfo; }
233  static PointKey<int> getRawBBoxMinKey() { return getMinimalSchema().rawBBoxMin; }
234  static PointKey<int> getRawBBoxExtentKey() { return getMinimalSchema().rawBBoxExtent; }
235  static PointKey<int> getRawDataBBoxMinKey() { return getMinimalSchema().rawDataBBoxMin; }
236  static PointKey<int> getRawDataBBoxExtentKey() { return getMinimalSchema().rawDataBBoxExtent; }
237  static Key<Flag> getRawFlipXKey() { return getMinimalSchema().rawFlipX; }
238  static Key<Flag> getRawFlipYKey() { return getMinimalSchema().rawFlipY; }
239  static PointKey<int> getRawXYOffsetKey() { return getMinimalSchema().rawXYOffset; }
241  return getMinimalSchema().rawHorizontalOverscanBBoxMin;
242  }
244  return getMinimalSchema().rawHorizontalOverscanBBoxExtent;
245  }
247  return getMinimalSchema().rawVerticalOverscanBBoxMin;
248  }
250  return getMinimalSchema().rawVerticalOverscanBBoxExtent;
251  }
252  static PointKey<int> getRawPrescanBBoxMinKey() { return getMinimalSchema().rawPrescanBBoxMin; }
253  static PointKey<int> getRawPrescanBBoxExtentKey() { return getMinimalSchema().rawPrescanBBoxExtent; }
255 
258 
261  return std::static_pointer_cast<AmpInfoRecord>(_makeRecord());
262  }
263 
267  }
268 
272  }
273 
274 protected:
275  explicit AmpInfoTable(Schema const &schema);
276 
277  explicit AmpInfoTable(AmpInfoTable const &other);
278  explicit AmpInfoTable(AmpInfoTable &&other);
279 
280  std::shared_ptr<BaseTable> _clone() const override;
281 
282  std::shared_ptr<BaseRecord> _makeRecord() override;
283 
284 private:
285  // Struct that holds the minimal schema and the special keys we've added to it.
286  struct MinimalSchema {
287  Schema schema;
289  PointKey<int> bboxMin;
290  PointKey<int> bboxExtent;
291  Key<double> gain;
292  Key<double> readNoise;
293  Key<double> saturation;
294  Key<double> suspectLevel;
295  Key<int> readoutCorner;
296  Key<Array<double> > linearityCoeffs;
297  Key<std::string> linearityType;
298  Key<Flag> hasRawInfo;
299  PointKey<int> rawBBoxMin;
300  PointKey<int> rawBBoxExtent;
301  PointKey<int> rawDataBBoxMin;
302  PointKey<int> rawDataBBoxExtent;
303  Key<Flag> rawFlipX;
304  Key<Flag> rawFlipY;
305  PointKey<int> rawXYOffset;
306  PointKey<int> rawHorizontalOverscanBBoxMin;
307  PointKey<int> rawHorizontalOverscanBBoxExtent;
308  PointKey<int> rawVerticalOverscanBBoxMin;
309  PointKey<int> rawVerticalOverscanBBoxExtent;
310  PointKey<int> rawPrescanBBoxMin;
311  PointKey<int> rawPrescanBBoxExtent;
312  MinimalSchema();
313  };
314 
315  // Return the singleton minimal schema.
316  static MinimalSchema &getMinimalSchema();
317 
318  friend class io::FitsWriter;
319 
320  // Return a writer object that knows how to save in FITS format. See also FitsWriter.
321  std::shared_ptr<io::FitsWriter> makeFitsWriter(fits::Fits *fitsfile, int flags) const override;
322 };
323 }
324 }
325 } // namespace lsst::afw::table
326 
327 #endif // !AFW_TABLE_AmpInfo_h_INCLUDED
Defines the fields and offsets for a table.
Definition: Schema.h:47
geom::Box2I getRawVerticalOverscanBBox() const
Convenience accessors for the keys in the minimal reference schema.
static PointKey< int > getRawPrescanBBoxExtentKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:253
void setRawFlipY(bool rawFlipY)
flip column order to make an assembled image?
CatalogT< AmpInfoRecord > Catalog
Definition: AmpInfo.h:83
void setRawXYOffset(geom::Extent2I const &xy)
offset for assembling a raw CCD image: desired xy0 - raw xy0
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:237
table::Key< std::string > name
Definition: ApCorrMap.cc:71
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.
void setReadNoise(double readNoise)
amplifier read noise, in e-
std::shared_ptr< AmpInfoTable > clone() const
Return a polymorphic deep copy of the table.
Definition: AmpInfo.h:257
afw::table::Schema schema
Definition: GaussianPsf.cc:43
double getGain() const
Convenience accessors for the keys in the minimal reference schema.
std::vector< double > getLinearityCoeffs() const
Convenience accessors for the keys in the minimal reference schema.
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
static PointKey< int > getRawXYOffsetKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:239
CatalogT< Record > Catalog
Definition: AmpInfo.h:178
static PointKey< int > getRawDataBBoxMinKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:235
void setRawPrescanBBox(geom::Box2I const &bbox)
bounding box of usable (horizontal) prescan pixels on raw image
static PointKey< int > getRawVerticalOverscanBBoxMinKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:246
void setRawFlipX(bool rawFlipX)
flip row order to make assembled image?
void setName(std::string const &name)
name of amplifier location in camera
void disconnectAliases()
Sever the connection between this schema and any others with which it shares aliases.
void setRawDataBBox(geom::Box2I const &bbox)
bounding box of amplifier image pixels on raw image
static Schema makeMinimalSchema()
Return a minimal schema for AmpInfo tables and records.
Definition: AmpInfo.h:202
static Key< std::string > getLinearityTypeKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:231
void setRawBBox(geom::Box2I const &bbox)
bounding box of all amplifier pixels on raw image
CatalogT< AmpInfoRecord const > ConstCatalog
Definition: AmpInfo.h:84
static PointKey< int > getRawBBoxMinKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:233
geom::Box2I getBBox() const
Convenience accessors for the keys in the minimal reference schema.
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
Definition: fits.h:298
void setRawVerticalOverscanBBox(geom::Box2I const &bbox)
bounding box of usable vertical overscan pixels
static bool checkSchema(Schema const &other)
Return true if the given schema is a valid AmpInfoTable schema.
Definition: AmpInfo.h:214
void setHasRawInfo(bool hasRawInfo)
does this table have raw amplifier information?
An integer coordinate rectangle.
Definition: Box.h:55
STL class.
bool getRawFlipX() const
Convenience accessors for the keys in the minimal reference schema.
std::shared_ptr< BaseRecord > copyRecord(BaseRecord const &input)
Deep-copy a record, requiring that it have the same schema as this table.
void setSuspectLevel(double suspectLevel)
level in ADU above which pixels are considered suspicious,
static PointKey< int > getRawHorizontalOverscanBBoxExtentKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:243
double getSuspectLevel() const
Convenience accessors for the keys in the minimal reference schema.
void setGain(double gain)
amplifier gain in e-/ADU
static Key< double > getSuspectLevelKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:228
A base class for image defects.
static PointKey< int > getBBoxMinKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:223
int contains(Schema const &other, int flags=EQUAL_KEYS) const
Test whether the given schema is a subset of this.
std::shared_ptr< AmpInfoRecord > makeRecord()
Default-construct an associated record.
Definition: AmpInfo.h:260
geom::Box2I getRawDataBBox() const
Convenience accessors for the keys in the minimal reference schema.
ColumnViewT< AmpInfoRecord > ColumnView
Definition: AmpInfo.h:82
T static_pointer_cast(T... args)
static PointKey< int > getRawBBoxExtentKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:234
ReadoutCorner getReadoutCorner() const
Convenience accessors for the keys in the minimal reference schema.
static Key< Flag > getRawFlipYKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:238
geom::Box2I getRawBBox() const
Convenience accessors for the keys in the minimal reference schema.
geom::Box2I getRawPrescanBBox() const
Convenience accessors for the keys in the minimal reference schema.
ColumnViewT< AmpInfoRecord > ColumnView
Definition: AmpInfo.h:177
void setRawHorizontalOverscanBBox(geom::Box2I const &bbox)
bounding box of usable horizontal overscan pixels
static Key< Flag > getHasRawInfoKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:232
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:55
bool getHasRawInfo() const
Convenience accessors for the keys in the minimal reference schema.
Base class for all records.
Definition: BaseRecord.h:29
geom::Box2I getRawHorizontalOverscanBBox() const
Convenience accessors for the keys in the minimal reference schema.
std::string getLinearityType() const
Convenience accessors for the keys in the minimal reference schema.
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:265
Key specialization for Flag.
Definition: Flag.h:92
std::string getName() const
Convenience accessors for the keys in the minimal reference schema.
AmpInfoRecord & operator=(AmpInfoRecord const &)=delete
CatalogT< Record const > ConstCatalog
Definition: AmpInfo.h:179
AmpInfoRecord(AmpInfoRecord const &)=delete
static PointKey< int > getRawVerticalOverscanBBoxExtentKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:249
table::Box2IKey bbox
static PointKey< int > getRawPrescanBBoxMinKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:252
static Key< double > getReadNoiseKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:226
void setReadoutCorner(ReadoutCorner val)
set readout corner
bool getRawFlipY() const
Convenience accessors for the keys in the minimal reference schema.
void setBBox(geom::Box2I const &bbox)
bounding box of amplifier pixels in assembled image
static Key< int > getReadoutCornerKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:229
static PointKey< int > getRawDataBBoxExtentKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:236
void setSaturation(double saturation)
level in ADU above which pixels are considered saturated;
void setLinearityType(std::string const &type)
name of linearity parameterization
static Key< std::string > getNameKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:222
static PointKey< int > getBBoxExtentKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:224
Table of amplifier information (AmpInfoRecord records)
Definition: AmpInfo.h:174
static PointKey< int > getRawHorizontalOverscanBBoxMinKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:240
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:225
geom::Extent2I getRawXYOffset() const
Convenience accessors for the keys in the minimal reference schema.
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:270
std::shared_ptr< AmpInfoTable const > getTable() const
Definition: AmpInfo.h:92
static Key< Array< double > > getLinearityCoeffsKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:230
double getSaturation() const
Convenience accessors for the keys in the minimal reference schema.
static Key< double > getSaturationKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:227