21 class AmpInfoFitsWriter :
public io::FitsWriter {
23 explicit AmpInfoFitsWriter(Fits *
fits,
int flags) : io::FitsWriter(fits, flags) {}
33 "Cannot use a AmpInfoFitsWriter on a non-AmpInfo table.");
36 _fits->writeKey(
"AFW_TYPE",
"AMPINFO",
"Tells lsst::afw to load this as a AmpInfo table.");
50 class AmpInfoFitsReader :
public io::FitsReader {
52 AmpInfoFitsReader() : io::FitsReader(
"AMPINFO") {}
56 bool stripMetadata)
const override {
58 table->setMetadata(metadata);
63 static AmpInfoFitsReader
const ampInfoFitsReader;
74 if (!checkSchema(schema)) {
77 "Schema for AmpInfo must contain at least the keys defined by makeMinimalSchema().");
90 AmpInfoTable::MinimalSchema::MinimalSchema() {
94 "bbox of amplifier image data on assembled image, min point",
"pixel");
96 "bbox of amplifier image data on assembled image, extent",
"pixel");
97 gain =
schema.addField<
double>(
"gain",
"amplifier gain",
"electron adu^-1");
98 saturation =
schema.addField<
double>(
100 "level above which pixels are considered saturated; use `nan` if no such level applies",
"adu");
101 suspectLevel =
schema.addField<
double>(
103 "level above which pixels are considered suspicious, meaning they may be affected by unknown " 104 "systematics; for example if non-linearity corrections above a certain level are unstable " 105 "then that would be a useful value for suspectLevel; use `nan` if no such level applies",
107 readNoise =
schema.addField<
double>(
"readnoise",
"amplifier read noise",
"electron");
109 schema.addField<
int>(
"readoutcorner",
"readout corner, in the frame of the assembled image");
111 schema.addField<
Array<double> >(
"linearity_coeffs",
"coefficients for linearity fit up to cubic",
113 linearityType =
schema.addField<
std::string>(
"linearity_type",
"type of linearity model",
117 hasRawInfo =
schema.addField<Flag>(
118 "hasrawinfo",
"is raw amplifier information available (e.g. untrimmed bounding boxes)?");
120 "entire amplifier bbox on raw image, min point",
"pixel");
122 "entire amplifier bbox on raw image, extent",
"pixel");
124 "image data bbox on raw image, min point",
"pixel");
126 "image data bbox on raw image, extent",
"pixel");
127 rawFlipX =
schema.addField<Flag>(
"raw_flip_x",
"flip row order to make assembled image?");
128 rawFlipY =
schema.addField<Flag>(
"raw_flip_y",
"flip column order to make an assembled image?");
131 "offset for assembling a raw CCD image: desired xy0 - raw xy0; 0,0 if raw data comes assembled",
133 rawHorizontalOverscanBBoxMin =
135 "usable horizontal overscan bbox on raw image, min point",
"pixel");
136 rawHorizontalOverscanBBoxExtent =
138 "usable horizontal overscan bbox on raw image, extent",
"pixel");
139 rawVerticalOverscanBBoxMin =
141 "usable vertical overscan region raw image, min point",
"pixel");
142 rawVerticalOverscanBBoxExtent =
144 "usable vertical overscan region raw image, extent",
"pixel");
147 "usable (horizontal) prescan bbox on raw image, min point",
"pixel");
148 rawPrescanBBoxExtent =
150 "usable (horizontal) prescan bbox on raw image, extent",
"pixel");
153 AmpInfoTable::MinimalSchema &AmpInfoTable::getMinimalSchema() {
154 static MinimalSchema it;
159 return std::make_shared<AmpInfoFitsWriter>(fitsfile, flags);
167 return constructRecord<AmpInfoRecord>();
208 return coeffKey.extractVector(*
this);
212 coeffKey.assignVector(*
this, linearityCoeffs);
std::vector< double > getLinearityCoeffs() const
Convenience accessors for the keys in the minimal reference schema.
Extent2I const getDimensions() const noexcept
Defines the fields and offsets for a table.
static PointKey< int > getRawPrescanBBoxExtentKey()
Get keys for standard fields shared by all references.
lsst::geom::Box2I getRawDataBBox() const
Convenience accessors for the keys in the minimal reference schema.
void setRawFlipY(bool rawFlipY)
flip column order to make an assembled image?
static int const MAX_NAME_LENGTH
static Key< Flag > getRawFlipXKey()
Get keys for standard fields shared by all references.
lsst::geom::Extent2I getRawXYOffset() const
Convenience accessors for the keys in the minimal reference schema.
double getReadNoise() const
Convenience accessors for the keys in the minimal reference schema.
void setReadNoise(double readNoise)
amplifier read noise, in e-
double getGain() const
Convenience accessors for the keys in the minimal reference schema.
void setLinearityCoeffs(std::vector< double > const &coeffs)
vector of linearity coefficients
static PointKey< int > getRawXYOffsetKey()
Get keys for standard fields shared by all references.
static PointKey< int > getRawDataBBoxMinKey()
Get keys for standard fields shared by all references.
static PointKey< int > getRawVerticalOverscanBBoxMinKey()
Get keys for standard fields shared by all references.
void setRawFlipX(bool rawFlipX)
flip row order to make assembled image?
void setName(std::string const &name)
name of amplifier location in camera
static PointKey addFields(Schema &schema, std::string const &name, std::string const &doc, std::string const &unit)
Add a pair of _x, _y fields to a Schema, and return a PointKey that points to them.
lsst::geom::Box2I getRawBBox() const
Convenience accessors for the keys in the minimal reference schema.
static Key< std::string > getLinearityTypeKey()
Get keys for standard fields shared by all references.
static PointKey< int > getRawBBoxMinKey()
Get keys for standard fields shared by all references.
ItemVariant const * other
void setRawPrescanBBox(lsst::geom::Box2I const &bbox)
bounding box of usable (horizontal) prescan pixels on raw image
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
void setHasRawInfo(bool hasRawInfo)
does this table have raw amplifier information?
bool getRawFlipX() const
Convenience accessors for the keys in the minimal reference schema.
Point2I const getMin() const noexcept
afw::table::PointKey< int > bboxMin
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.
double getSuspectLevel() const
Convenience accessors for the keys in the minimal reference schema.
lsst::geom::Box2I getBBox() 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.
A base class for image defects.
static PointKey< int > getBBoxMinKey()
Get keys for standard fields shared by all references.
AmpInfoTable(Schema const &schema)
~AmpInfoRecord() override
void setRawHorizontalOverscanBBox(lsst::geom::Box2I const &bbox)
bounding box of usable horizontal overscan pixels
static int const MAX_LINEARITY_COEFFS
std::shared_ptr< BaseTable > _clone() const override
Clone implementation with noncovariant return types.
Tag types used to declare specialized field types.
T dynamic_pointer_cast(T... args)
Reports errors in the logical structure of the program.
static PointKey< int > getRawBBoxExtentKey()
Get keys for standard fields shared by all references.
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.
virtual void _writeTable(std::shared_ptr< BaseTable const > const &table, std::size_t nRows)
Write a table and its schema.
void setBBox(lsst::geom::Box2I const &bbox)
bounding box of amplifier pixels in assembled image
static Key< Flag > getHasRawInfoKey()
Get keys for standard fields shared by all references.
ReadoutCorner
Readout corner, in the frame of reference of the assembled image.
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Extent< int, 2 > Extent2I
bool getHasRawInfo() const
Convenience accessors for the keys in the minimal reference schema.
void setRawDataBBox(lsst::geom::Box2I const &bbox)
bounding box of amplifier image pixels on raw image
std::string getLinearityType() const
Convenience accessors for the keys in the minimal reference schema.
A class used as a handle to a particular field in a table.
std::string getName() const
Convenience accessors for the keys in the minimal reference schema.
lsst::geom::Box2I getRawVerticalOverscanBBox() const
Convenience accessors for the keys in the minimal reference schema.
Reports invalid arguments.
static PointKey< int > getRawVerticalOverscanBBoxExtentKey()
Get keys for standard fields shared by all references.
static PointKey< int > getRawPrescanBBoxMinKey()
Get keys for standard fields shared by all references.
lsst::geom::Box2I getRawPrescanBBox() const
Convenience accessors for the keys in the minimal reference schema.
static Key< double > getReadNoiseKey()
Get keys for standard fields shared by all references.
void setReadoutCorner(ReadoutCorner val)
set readout corner
static int const MAX_LINEARITY_TYPE_LENGTH
bool getRawFlipY() const
Convenience accessors for the keys in the minimal reference schema.
static Key< int > getReadoutCornerKey()
Get keys for standard fields shared by all references.
static PointKey< int > getRawDataBBoxExtentKey()
Get keys for standard fields shared by all references.
void setSaturation(double saturation)
level in ADU above which pixels are considered saturated;
void setLinearityType(std::string const &type)
name of linearity parameterization
An integer coordinate rectangle.
static Key< std::string > getNameKey()
Get keys for standard fields shared by all references.
static PointKey< int > getBBoxExtentKey()
Get keys for standard fields shared by all references.
Table of amplifier information (AmpInfoRecord records)
static PointKey< int > getRawHorizontalOverscanBBoxMinKey()
Get keys for standard fields shared by all references.
Base class for all tables.
static Key< double > getGainKey()
Get keys for standard fields shared by all references.
void setRawVerticalOverscanBBox(lsst::geom::Box2I const &bbox)
bounding box of usable vertical overscan pixels
static Key< Array< double > > getLinearityCoeffsKey()
Get keys for standard fields shared by all references.
lsst::geom::Box2I getRawHorizontalOverscanBBox() const
Convenience accessors for the keys in the minimal reference schema.
void setRawXYOffset(lsst::geom::Extent2I const &xy)
offset for assembling a raw CCD image: desired xy0 - raw xy0
double getSaturation() const
Convenience accessors for the keys in the minimal reference schema.
static std::shared_ptr< AmpInfoTable > make(Schema const &schema)
Construct a new table.
void setRawBBox(lsst::geom::Box2I const &bbox)
bounding box of all amplifier pixels on raw image
std::shared_ptr< BaseRecord > _makeRecord() override
Default-construct an associated record (protected implementation).
static Key< double > getSaturationKey()
Get keys for standard fields shared by all references.