LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
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 { namespace afw { namespace table {
33 
38  LL,
39  LR,
40  UR,
41  UL,
42 };
43 
44 
45 class AmpInfoRecord;
46 class AmpInfoTable;
47 
77 class AmpInfoRecord : public BaseRecord {
78 public:
79 
84 
86  return boost::static_pointer_cast<AmpInfoTable const>(BaseRecord::getTable());
87  }
88 
90  std::string getName() const;
92  void setName(std::string const &name);
93 
94  geom::Box2I getBBox() const;
95  void setBBox(geom::Box2I const &bbox);
96 
97  double getGain() const;
98  void setGain(double gain);
99 
100  double getReadNoise() const;
101  void setReadNoise(double readNoise);
102 
103  int getSaturation() const;
104  void setSaturation(int saturation);
105 
108 
109  std::vector<double> getLinearityCoeffs() const;
110  void setLinearityCoeffs(std::vector<double> const &coeffs);
111 
112  std::string getLinearityType() const;
113  void setLinearityType(std::string const &type);
114 
115  bool getHasRawInfo() const;
116  void setHasRawInfo(bool hasRawInfo);
117 
118  geom::Box2I getRawBBox() const;
119  void setRawBBox(geom::Box2I const &bbox);
120 
121  geom::Box2I getRawDataBBox() const;
122  void setRawDataBBox(geom::Box2I const &bbox);
123 
124  bool getRawFlipX() const;
125  void setRawFlipX(bool rawFlipX);
126 
127  bool getRawFlipY() const;
128  void setRawFlipY(bool rawFlipY);
129 
131  void setRawXYOffset(geom::Extent2I const &xy);
132 
134  void setRawHorizontalOverscanBBox(geom::Box2I const &bbox);
135 
137  void setRawVerticalOverscanBBox(geom::Box2I const &bbox);
138 
140  void setRawPrescanBBox(geom::Box2I const &bbox);
141 
143 
144 protected:
145 
147 
148 };
149 
155 class AmpInfoTable : public BaseTable {
156 public:
157 
162  static int const MAX_NAME_LENGTH = 64; // max length for amplifier name
163  static int const MAX_LINEARITY_COEFFS = 4; // max number of linearity coefficients
164  static int const MAX_LINEARITY_TYPE_LENGTH = 64; // max length for linearity type
165 
171  static PTR(AmpInfoTable) make(Schema const & schema);
172 
182  r.disconnectAliases();
183  return r;
184  }
185 
192  static bool checkSchema(Schema const & other) {
193  return other.contains(getMinimalSchema().schema);
194  }
195 
197 
226 
228  PTR(AmpInfoTable) clone() const { return boost::static_pointer_cast<AmpInfoTable>(_clone()); }
229 
231  PTR(AmpInfoRecord) makeRecord() { return boost::static_pointer_cast<AmpInfoRecord>(_makeRecord()); }
232 
235  return boost::static_pointer_cast<AmpInfoRecord>(BaseTable::copyRecord(other));
236  }
237 
239  PTR(AmpInfoRecord) copyRecord(BaseRecord const & other, SchemaMapper const & mapper) {
240  return boost::static_pointer_cast<AmpInfoRecord>(BaseTable::copyRecord(other, mapper));
241  }
242 
243 protected:
244 
245  AmpInfoTable(Schema const & schema);
246 
247  AmpInfoTable(AmpInfoTable const & other);
248 
249 private:
250 
251  // Struct that holds the minimal schema and the special keys we've added to it.
252  struct MinimalSchema {
277  MinimalSchema();
278  };
279 
280  // Return the singleton minimal schema.
281  static MinimalSchema & getMinimalSchema();
282 
283  friend class io::FitsWriter;
284 
285  // Return a writer object that knows how to save in FITS format. See also FitsWriter.
286  virtual PTR(io::FitsWriter) makeFitsWriter(fits::Fits * fitsfile, int flags) const;
287 };
288 
289 }}} // namespace lsst::afw::table
290 
291 #endif // !AFW_TABLE_AmpInfo_h_INCLUDED
Defines the fields and offsets for a table.
Definition: Schema.h:46
static PointKey< int > getRawPrescanBBoxExtentKey()
Definition: AmpInfo.h:224
void setRawFlipY(bool rawFlipY)
flip column order to make an assembled image?
boost::shared_ptr< BaseRecord > copyRecord(BaseRecord const &input)
Deep-copy a record, requiring that it have the same schema as this table.
static int const MAX_NAME_LENGTH
Definition: AmpInfo.h:162
CatalogT< AmpInfoRecord > Catalog
Definition: AmpInfo.h:82
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:22
static Key< Flag > getRawFlipXKey()
Definition: AmpInfo.h:216
table::Key< std::string > name
Definition: ApCorrMap.cc:71
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:77
virtual boost::shared_ptr< io::FitsWriter > makeFitsWriter(fits::Fits *fitsfile, int flags) const
Key< Array< double > > linearityCoeffs
Definition: AmpInfo.h:261
boost::shared_ptr< AmpInfoRecord > copyRecord(BaseRecord const &other)
Deep-copy a record, requiring that it have the same schema as this table.
Definition: AmpInfo.h:234
void setReadNoise(double readNoise)
amplifier read noise, in e-
A custom container class for records, based on std::vector.
Definition: Catalog.h:94
afw::table::Schema schema
Definition: GaussianPsf.cc:41
A mapping between the keys of two Schemas, used to copy data between them.
Definition: SchemaMapper.h:19
void setLinearityCoeffs(std::vector< double > const &coeffs)
vector of linearity coefficients
static PointKey< int > getRawXYOffsetKey()
Definition: AmpInfo.h:218
CatalogT< Record > Catalog
Definition: AmpInfo.h:160
static PointKey< int > getRawDataBBoxMinKey()
Definition: AmpInfo.h:214
void setRawPrescanBBox(geom::Box2I const &bbox)
bounding box of usable (horizontal) prescan pixels on raw image
static PointKey< int > getRawVerticalOverscanBBoxMinKey()
Definition: AmpInfo.h:221
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.
#define PTR(...)
Definition: base.h:41
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:180
static Key< std::string > getLinearityTypeKey()
Definition: AmpInfo.h:210
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:83
boost::shared_ptr< AmpInfoRecord > makeRecord()
Default-construct an associated record.
Definition: AmpInfo.h:231
static PointKey< int > getRawBBoxMinKey()
Definition: AmpInfo.h:212
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.
boost::shared_ptr< AmpInfoTable const > getTable() const
Definition: AmpInfo.h:85
static bool checkSchema(Schema const &other)
Return true if the given schema is a valid AmpInfoTable schema.
Definition: AmpInfo.h:192
void setHasRawInfo(bool hasRawInfo)
does this table have raw amplifier information?
bool val
An integer coordinate rectangle.
Definition: Box.h:53
std::map< Citizen const *, CitizenInfo > table
Definition: Citizen.h:93
int getSaturation() const
Convenience accessors for the keys in the minimal reference schema.
static PointKey< int > getRawHorizontalOverscanBBoxExtentKey()
Definition: AmpInfo.h:220
void setGain(double gain)
amplifier gain in e-/ADU
boost::shared_ptr< BaseTable const > getTable() const
Return the table this record is associated with.
Definition: BaseRecord.h:51
geom::Box2I getRawVerticalOverscanBBox() const
Convenience accessors for the keys in the minimal reference schema.
static PointKey< int > getBBoxMinKey()
Definition: AmpInfo.h:203
AmpInfoTable(Schema const &schema)
static Key< Array< double > > getLinearityCoeffsKey()
Definition: AmpInfo.h:209
static Key< int > getSaturationKey()
Definition: AmpInfo.h:207
static int const MAX_LINEARITY_COEFFS
Definition: AmpInfo.h:163
geom::Box2I getRawBBox() const
Convenience accessors for the keys in the minimal reference schema.
boost::shared_ptr< AmpInfoTable > clone() const
Return a polymorphic deep copy of the table.
Definition: AmpInfo.h:228
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.
geom::Box2I getRawPrescanBBox() const
Convenience accessors for the keys in the minimal reference schema.
ColumnViewT< AmpInfoRecord > ColumnView
Definition: AmpInfo.h:81
static PointKey< int > getRawBBoxExtentKey()
Definition: AmpInfo.h:213
static Key< Flag > getRawFlipYKey()
Definition: AmpInfo.h:217
ColumnViewT< AmpInfoRecord > ColumnView
Definition: AmpInfo.h:159
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.
AmpInfoRecord(boost::shared_ptr< AmpInfoTable > const &table)
geom::Box2I getRawDataBBox() const
Convenience accessors for the keys in the minimal reference schema.
static Key< Flag > getHasRawInfoKey()
Definition: AmpInfo.h:211
Base class for all records.
Definition: BaseRecord.h:27
int contains(Schema const &other, int flags=EQUAL_KEYS) const
Test whether the given schema is a subset of this.
virtual boost::shared_ptr< BaseTable > _clone() const =0
Clone implementation with noncovariant return types.
static boost::shared_ptr< AmpInfoTable > make(Schema const &schema)
Construct a new table.
Key specialization for Flag.
Definition: Flag.h:82
virtual boost::shared_ptr< BaseRecord > _makeRecord()=0
Default-construct an associated record (protected implementation).
CatalogT< Record const > ConstCatalog
Definition: AmpInfo.h:161
void setSaturation(int saturation)
saturation value, in ADU
bool getRawFlipY() const
Convenience accessors for the keys in the minimal reference schema.
#define CONST_PTR(...)
Definition: base.h:47
static PointKey< int > getRawVerticalOverscanBBoxExtentKey()
Definition: AmpInfo.h:222
static PointKey< int > getRawPrescanBBoxMinKey()
Definition: AmpInfo.h:223
static Key< double > getReadNoiseKey()
Definition: AmpInfo.h:206
void setReadoutCorner(ReadoutCorner val)
set readout corner
static MinimalSchema & getMinimalSchema()
static int const MAX_LINEARITY_TYPE_LENGTH
Definition: AmpInfo.h:164
void setBBox(geom::Box2I const &bbox)
bounding box of amplifier pixels in assembled image
static Key< int > getReadoutCornerKey()
Definition: AmpInfo.h:208
static PointKey< int > getRawDataBBoxExtentKey()
Definition: AmpInfo.h:215
void setLinearityType(std::string const &type)
name of linearity parameterization
static Key< std::string > getNameKey()
Definition: AmpInfo.h:202
static PointKey< int > getBBoxExtentKey()
Definition: AmpInfo.h:204
Table of amplifier information (AmpInfoRecord records)
Definition: AmpInfo.h:155
static PointKey< int > getRawHorizontalOverscanBBoxMinKey()
Definition: AmpInfo.h:219
Base class for all tables.
Definition: BaseTable.h:44
static Key< double > getGainKey()
Definition: AmpInfo.h:205