lsst.afw  14.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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  std::shared_ptr<AmpInfoTable const> getTable() const {
87  return std::static_pointer_cast<AmpInfoTable const>(BaseRecord::getTable());
88  }
89 
91  std::string getName() const;
93  void setName(std::string const &name);
94 
95  geom::Box2I getBBox() const;
96  void setBBox(geom::Box2I const &bbox);
97 
98  double getGain() const;
99  void setGain(double gain);
100 
101  double getReadNoise() const;
102  void setReadNoise(double readNoise);
103 
104  double getSaturation() const;
105  void setSaturation(double saturation);
106 
108  double getSuspectLevel() const;
109  void setSuspectLevel(
110  double suspectLevel);
111 
116  void setReadoutCorner(ReadoutCorner val);
117 
118  std::vector<double> getLinearityCoeffs() const;
119  void setLinearityCoeffs(std::vector<double> const &coeffs);
120 
121  std::string getLinearityType() const;
122  void setLinearityType(std::string const &type);
123 
124  bool getHasRawInfo() const;
125  void setHasRawInfo(bool hasRawInfo);
126 
127  geom::Box2I getRawBBox() const;
128  void setRawBBox(geom::Box2I const &bbox);
129 
130  geom::Box2I getRawDataBBox() const;
131  void setRawDataBBox(geom::Box2I const &bbox);
132 
133  bool getRawFlipX() const;
134  void setRawFlipX(bool rawFlipX);
135 
136  bool getRawFlipY() const;
137  void setRawFlipY(bool rawFlipY);
138 
140  void setRawXYOffset(
141  geom::Extent2I const &xy);
142 
145  geom::Box2I const &bbox);
146 
149  geom::Box2I const &bbox);
150 
152  void setRawPrescanBBox(
153  geom::Box2I const &bbox);
154 
156 
157 protected:
158  friend class AmpInfoTable;
159 
160  explicit AmpInfoRecord(std::shared_ptr<AmpInfoTable> const &table);
161 };
162 
168 class AmpInfoTable : public BaseTable {
169 public:
174  static int const MAX_NAME_LENGTH = 64; // max length for amplifier name
175  static int const MAX_LINEARITY_COEFFS = 4; // max number of linearity coefficients
176  static int const MAX_LINEARITY_TYPE_LENGTH = 64; // max length for linearity type
177 
183  static std::shared_ptr<AmpInfoTable> make(Schema const &schema);
184 
193  Schema r = getMinimalSchema().schema;
194  r.disconnectAliases();
195  return r;
196  }
197 
204  static bool checkSchema(Schema const &other) { return other.contains(getMinimalSchema().schema); }
205 
207 
212  static Key<std::string> getNameKey() { return getMinimalSchema().name; }
213  static PointKey<int> getBBoxMinKey() { return getMinimalSchema().bboxMin; }
214  static PointKey<int> getBBoxExtentKey() { return getMinimalSchema().bboxExtent; }
215  static Key<double> getGainKey() { return getMinimalSchema().gain; }
216  static Key<double> getReadNoiseKey() { return getMinimalSchema().readNoise; }
217  static Key<double> getSaturationKey() { return getMinimalSchema().saturation; }
218  static Key<double> getSuspectLevelKey() { return getMinimalSchema().suspectLevel; }
219  static Key<int> getReadoutCornerKey() { return getMinimalSchema().readoutCorner; }
220  static Key<Array<double> > getLinearityCoeffsKey() { return getMinimalSchema().linearityCoeffs; }
221  static Key<std::string> getLinearityTypeKey() { return getMinimalSchema().linearityType; }
222  static Key<Flag> getHasRawInfoKey() { return getMinimalSchema().hasRawInfo; }
223  static PointKey<int> getRawBBoxMinKey() { return getMinimalSchema().rawBBoxMin; }
224  static PointKey<int> getRawBBoxExtentKey() { return getMinimalSchema().rawBBoxExtent; }
225  static PointKey<int> getRawDataBBoxMinKey() { return getMinimalSchema().rawDataBBoxMin; }
226  static PointKey<int> getRawDataBBoxExtentKey() { return getMinimalSchema().rawDataBBoxExtent; }
227  static Key<Flag> getRawFlipXKey() { return getMinimalSchema().rawFlipX; }
228  static Key<Flag> getRawFlipYKey() { return getMinimalSchema().rawFlipY; }
229  static PointKey<int> getRawXYOffsetKey() { return getMinimalSchema().rawXYOffset; }
231  return getMinimalSchema().rawHorizontalOverscanBBoxMin;
232  }
234  return getMinimalSchema().rawHorizontalOverscanBBoxExtent;
235  }
237  return getMinimalSchema().rawVerticalOverscanBBoxMin;
238  }
240  return getMinimalSchema().rawVerticalOverscanBBoxExtent;
241  }
242  static PointKey<int> getRawPrescanBBoxMinKey() { return getMinimalSchema().rawPrescanBBoxMin; }
243  static PointKey<int> getRawPrescanBBoxExtentKey() { return getMinimalSchema().rawPrescanBBoxExtent; }
245 
247  std::shared_ptr<AmpInfoTable> clone() const { return std::static_pointer_cast<AmpInfoTable>(_clone()); }
248 
250  std::shared_ptr<AmpInfoRecord> makeRecord() {
251  return std::static_pointer_cast<AmpInfoRecord>(_makeRecord());
252  }
253 
255  std::shared_ptr<AmpInfoRecord> copyRecord(BaseRecord const &other) {
256  return std::static_pointer_cast<AmpInfoRecord>(BaseTable::copyRecord(other));
257  }
258 
260  std::shared_ptr<AmpInfoRecord> copyRecord(BaseRecord const &other, SchemaMapper const &mapper) {
261  return std::static_pointer_cast<AmpInfoRecord>(BaseTable::copyRecord(other, mapper));
262  }
263 
264 protected:
265  explicit AmpInfoTable(Schema const &schema);
266 
267  explicit AmpInfoTable(AmpInfoTable const &other);
268 
269  std::shared_ptr<BaseTable> _clone() const override;
270 
271  std::shared_ptr<BaseRecord> _makeRecord() override;
272 
273 private:
274  // Struct that holds the minimal schema and the special keys we've added to it.
275  struct MinimalSchema {
276  Schema schema;
279  PointKey<int> bboxExtent;
280  Key<double> gain;
281  Key<double> readNoise;
282  Key<double> saturation;
283  Key<double> suspectLevel;
284  Key<int> readoutCorner;
285  Key<Array<double> > linearityCoeffs;
286  Key<std::string> linearityType;
287  Key<Flag> hasRawInfo;
288  PointKey<int> rawBBoxMin;
289  PointKey<int> rawBBoxExtent;
290  PointKey<int> rawDataBBoxMin;
291  PointKey<int> rawDataBBoxExtent;
292  Key<Flag> rawFlipX;
293  Key<Flag> rawFlipY;
294  PointKey<int> rawXYOffset;
295  PointKey<int> rawHorizontalOverscanBBoxMin;
296  PointKey<int> rawHorizontalOverscanBBoxExtent;
297  PointKey<int> rawVerticalOverscanBBoxMin;
298  PointKey<int> rawVerticalOverscanBBoxExtent;
299  PointKey<int> rawPrescanBBoxMin;
300  PointKey<int> rawPrescanBBoxExtent;
301  MinimalSchema();
302  };
303 
304  // Return the singleton minimal schema.
305  static MinimalSchema &getMinimalSchema();
306 
307  friend class io::FitsWriter;
308 
309  // Return a writer object that knows how to save in FITS format. See also FitsWriter.
310  std::shared_ptr<io::FitsWriter> makeFitsWriter(fits::Fits *fitsfile, int flags) const override;
311 };
312 }
313 }
314 } // namespace lsst::afw::table
315 
316 #endif // !AFW_TABLE_AmpInfo_h_INCLUDED
Defines the fields and offsets for a table.
Definition: Schema.h:46
static PointKey< int > getRawPrescanBBoxExtentKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:243
static std::shared_ptr< AmpInfoTable > make(Schema const &schema)
Construct a new table.
void setRawFlipY(bool rawFlipY)
flip column order to make an assembled image?
static int const MAX_NAME_LENGTH
Definition: AmpInfo.h:174
CatalogT< AmpInfoRecord > Catalog
Definition: AmpInfo.h:83
std::string getLinearityType() const
Convenience accessors for the keys in the minimal reference schema.
std::string getName() const
Convenience accessors for the keys in the minimal reference schema.
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:227
std::shared_ptr< BaseTable > _clone() const override
Clone implementation with noncovariant return types.
bool getHasRawInfo() const
Convenience accessors for the keys in the minimal reference schema.
double getGain() const
Convenience accessors for the keys in the minimal reference schema.
geom::Box2I getRawHorizontalOverscanBBox() const
Convenience accessors for the keys in the minimal reference schema.
geom::Extent2I getRawXYOffset() const
Convenience accessors for the keys in the minimal reference schema.
Geometry and electronic information about raw amplifier images.
Definition: AmpInfo.h:79
void setReadNoise(double readNoise)
amplifier read noise, in e-
double getSuspectLevel() const
Convenience accessors for the keys in the minimal reference schema.
A custom container class for records, based on std::vector.
Definition: Catalog.h:96
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
table::PointKey< int > bboxMin
static PointKey< int > getRawXYOffsetKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:229
CatalogT< Record > Catalog
Definition: AmpInfo.h:172
static PointKey< int > getRawDataBBoxMinKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:225
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:236
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:192
static Key< std::string > getLinearityTypeKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:221
void setRawBBox(geom::Box2I const &bbox)
bounding box of all amplifier pixels on raw image
std::vector< double > getLinearityCoeffs() const
Convenience accessors for the keys in the minimal reference schema.
CatalogT< AmpInfoRecord const > ConstCatalog
Definition: AmpInfo.h:84
static PointKey< int > getRawBBoxMinKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:223
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
Definition: fits.h:199
void setRawVerticalOverscanBBox(geom::Box2I const &bbox)
bounding box of usable vertical overscan pixels
geom::Box2I getBBox() const
Convenience accessors for the keys in the minimal reference schema.
static bool checkSchema(Schema const &other)
Return true if the given schema is a valid AmpInfoTable schema.
Definition: AmpInfo.h:204
void setHasRawInfo(bool hasRawInfo)
does this table have raw amplifier information?
An integer coordinate rectangle.
Definition: Box.h:55
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:233
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:218
geom::Box2I getRawVerticalOverscanBBox() const
Convenience accessors for the keys in the minimal reference schema.
AmpInfoRecord(std::shared_ptr< AmpInfoTable > const &table)
static PointKey< int > getBBoxMinKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:213
std::shared_ptr< BaseTable const > getTable() const
Return the table this record is associated with.
Definition: BaseRecord.h:55
AmpInfoTable(Schema const &schema)
static int const MAX_LINEARITY_COEFFS
Definition: AmpInfo.h:175
geom::Box2I getRawBBox() const
Convenience accessors for the keys in the minimal reference schema.
double getReadNoise() const
Convenience accessors for the keys in the minimal reference schema.
ReadoutCorner getReadoutCorner() const
Convenience accessors for the keys in the minimal reference schema.
std::shared_ptr< AmpInfoRecord > makeRecord()
Default-construct an associated record.
Definition: AmpInfo.h:250
table::Key< std::string > name
Definition: ApCorrMap.cc:71
geom::Box2I getRawPrescanBBox() const
Convenience accessors for the keys in the minimal reference schema.
ColumnViewT< AmpInfoRecord > ColumnView
Definition: AmpInfo.h:82
static PointKey< int > getRawBBoxExtentKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:224
static Key< Flag > getRawFlipYKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:228
ColumnViewT< AmpInfoRecord > ColumnView
Definition: AmpInfo.h:171
void setRawHorizontalOverscanBBox(geom::Box2I const &bbox)
bounding box of usable horizontal overscan pixels
bool getRawFlipX() const
Convenience accessors for the keys in the minimal reference schema.
geom::Box2I getRawDataBBox() const
Convenience accessors for the keys in the minimal reference schema.
static Key< Flag > getHasRawInfoKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:222
double getSaturation() const
Convenience accessors for the keys in the minimal reference schema.
ReadoutCorner
Readout corner, in the frame of reference of the assembled image.
Definition: AmpInfo.h:39
std::shared_ptr< AmpInfoTable const > getTable() const
Definition: AmpInfo.h:86
Base class for all records.
Definition: BaseRecord.h:29
int contains(Schema const &other, int flags=EQUAL_KEYS) const
Test whether the given schema is a subset of this.
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:255
Key specialization for Flag.
Definition: Flag.h:79
CatalogT< Record const > ConstCatalog
Definition: AmpInfo.h:173
bool getRawFlipY() const
Convenience accessors for the keys in the minimal reference schema.
static PointKey< int > getRawVerticalOverscanBBoxExtentKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:239
static PointKey< int > getRawPrescanBBoxMinKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:242
static Key< double > getReadNoiseKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:216
void setReadoutCorner(ReadoutCorner val)
set readout corner
static int const MAX_LINEARITY_TYPE_LENGTH
Definition: AmpInfo.h:176
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:219
static PointKey< int > getRawDataBBoxExtentKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:226
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:212
static PointKey< int > getBBoxExtentKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:214
Table of amplifier information (AmpInfoRecord records)
Definition: AmpInfo.h:168
static PointKey< int > getRawHorizontalOverscanBBoxMinKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:230
Base class for all tables.
Definition: BaseTable.h:44
afw::table::Schema schema
Definition: GaussianPsf.cc:43
static Key< double > getGainKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:215
std::shared_ptr< BaseRecord > _makeRecord() override
Default-construct an associated record (protected implementation).
std::shared_ptr< AmpInfoTable > clone() const
Return a polymorphic deep copy of the table.
Definition: AmpInfo.h:247
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:260
static Key< Array< double > > getLinearityCoeffsKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:220
static Key< double > getSaturationKey()
Get keys for standard fields shared by all references.
Definition: AmpInfo.h:217