42 class PeakFitsWriter :
public afw::table::io::FitsWriter {
44 explicit PeakFitsWriter(Fits*
fits,
int flags) :
afw::table::io::FitsWriter(fits, flags) {}
54 "Cannot use a PeakFitsWriter on a non-Peak table.");
57 _fits->writeKey(
"AFW_TYPE",
"PEAK",
"Tells lsst::afw to load this as a Peak table.");
71 class PeakFitsReader :
public afw::table::io::FitsReader {
73 PeakFitsReader() :
afw::table::io::FitsReader(
"PEAK") {}
77 int ioFlags,
bool stripMetadata)
const override {
79 table->setMetadata(metadata);
85 static PeakFitsReader
const peakFitsReader;
100 static CachedTableList cache;
101 if (!checkSchema(schema)) {
103 "Schema for Peak must contain at least the keys defined by makeMinimalSchema().");
108 CachedTableList::iterator iter = cache.begin();
109 while (iter != cache.end()) {
112 iter = cache.erase(iter);
118 if (iter != cache.begin()) {
119 cache.splice(cache.begin(), cache, iter);
128 cache.push_front(newTable);
134 :
afw::table::BaseTable(schema), _idFactory(idFactory) {}
138 _idFactory(other._idFactory ? other._idFactory->
clone() : other._idFactory) {}
144 PeakTable::MinimalSchema::MinimalSchema() {
146 fx =
schema.addField<
float>(
"f_x",
"subpixel column position",
"pixel");
147 fy =
schema.addField<
float>(
"f_y",
"subpixel row position",
"pixel");
148 ix =
schema.addField<
int>(
"i_x",
"column position of highest pixel",
"pixel");
149 iy =
schema.addField<
int>(
"i_y",
"row position of highest pixel",
"pixel");
150 peakValue =
schema.addField<
float>(
"peakValue",
"value of [smoothed] image at peak position",
"count");
151 schema.getCitizen().markPersistent();
154 PeakTable::MinimalSchema& PeakTable::getMinimalSchema() {
155 static MinimalSchema it;
160 return std::make_shared<PeakFitsWriter>(fitsfile, flags);
168 auto record = constructRecord<PeakRecord>();
177 template class CatalogT<afw::detection::PeakRecord>;
178 template class CatalogT<afw::detection::PeakRecord const>;
Defines the fields and offsets for a table.
int getIy() const
Convenience accessors for the keys in the minimal schema.
std::ostream & operator<<(std::ostream &os, PeakRecord const &record)
std::shared_ptr< afw::table::IdFactory > getIdFactory()
Return the object that generates IDs for the table (may be null).
std::shared_ptr< PeakTable > clone() const
Return a polymorphic deep copy of the table.
Table class for Peaks in Footprints.
static std::shared_ptr< PeakTable > make(afw::table::Schema const &schema, bool forceNew=false)
Obtain a table that can be used to create records with given schema.
std::shared_ptr< afw::table::BaseRecord > _makeRecord() override
Default-construct an associated record (protected implementation).
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
afw::table::RecordId getId() const
Convenience accessors for the keys in the minimal schema.
PeakTable(afw::table::Schema const &schema, std::shared_ptr< afw::table::IdFactory > const &idFactory)
A base class for image defects.
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
BaseTable(Schema const &schema)
Construct from a schema.
T dynamic_pointer_cast(T... args)
int getIx() const
Convenience accessors for the keys in the minimal schema.
Reports errors in the logical structure of the program.
virtual void _writeTable(std::shared_ptr< BaseTable const > const &table, std::size_t nRows)
Write a table and its schema.
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Reports invalid arguments.
ItemVariant const * other
static std::shared_ptr< IdFactory > makeSimple()
Return a simple IdFactory that simply counts from 1.
std::shared_ptr< afw::table::BaseTable > _clone() const override
Clone implementation with noncovariant return types.
Record class that represents a peak in a Footprint.
float getFy() const
Convenience accessors for the keys in the minimal schema.
float getFx() const
Convenience accessors for the keys in the minimal schema.