LSSTApplications  16.0-11-g09ed895+2,16.0-11-g12e47bd,16.0-11-g9bb73b2+6,16.0-12-g5c924a4+6,16.0-14-g9a974b3+1,16.0-15-g1417920+1,16.0-15-gdd5ca33+1,16.0-16-gf0259e2,16.0-17-g31abd91+7,16.0-17-g7d7456e+7,16.0-17-ga3d2e9f+13,16.0-18-ga4d4bcb+1,16.0-18-gd06566c+1,16.0-2-g0febb12+21,16.0-2-g9d5294e+69,16.0-2-ga8830df+6,16.0-20-g21842373+7,16.0-24-g3eae5ec,16.0-28-gfc9ea6c+4,16.0-29-ge8801f9,16.0-3-ge00e371+34,16.0-4-g18f3627+13,16.0-4-g5f3a788+20,16.0-4-ga3eb747+10,16.0-4-gabf74b7+29,16.0-4-gb13d127+6,16.0-49-g42e581f7+6,16.0-5-g27fb78a+7,16.0-5-g6a53317+34,16.0-5-gb3f8a4b+87,16.0-6-g9321be7+4,16.0-6-gcbc7b31+42,16.0-6-gf49912c+29,16.0-7-gd2eeba5+51,16.0-71-ge89f8615e,16.0-8-g21fd5fe+29,16.0-8-g3a9f023+20,16.0-8-g4734f7a+1,16.0-8-g5858431+3,16.0-9-gf5c1f43+8,master-gd73dc1d098+1,w.2019.01
LSSTDataManagementBasePackage
Peak.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 /*
3  * LSST Data Management System
4  * Copyright 2008-2014 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_DETECTION_Peak_h_INCLUDED
24 #define AFW_DETECTION_Peak_h_INCLUDED
25 
29 #include "lsst/afw/table/Catalog.h"
31 
32 namespace lsst {
33 namespace afw {
34 namespace detection {
35 
36 class PeakRecord;
37 class PeakTable;
38 
43 public:
44  typedef PeakTable Table;
48 
49  ~PeakRecord() override = default;
50  PeakRecord(PeakRecord const&) = delete;
51  PeakRecord(PeakRecord&&) = delete;
52  PeakRecord& operator=(PeakRecord const&) = delete;
53  PeakRecord& operator=(PeakRecord&&) = delete;
54 
57  }
58 
62  void setId(afw::table::RecordId id);
63 
64  int getIx() const;
65  int getIy() const;
66  void setIx(int ix);
67  void setIy(int iy);
69  lsst::geom::Point2I getCentroid(bool) const { return getI(); }
70 
71  float getFx() const;
72  float getFy() const;
73  void setFx(float fx);
74  void setFy(float fy);
76  lsst::geom::Point2D getCentroid() const { return getF(); }
77 
78  float getPeakValue() const;
79  void setPeakValue(float peakValue);
81 
82 protected:
84 
85 private:
86  friend class PeakTable;
87 };
88 
93 public:
94  typedef PeakRecord Record;
98 
99  ~PeakTable() override;
100  PeakTable& operator=(PeakTable const&) = delete;
101  PeakTable& operator=(PeakTable&&) = delete;
102 
118  static std::shared_ptr<PeakTable> make(afw::table::Schema const& schema, bool forceNew = false);
119 
127  static afw::table::Schema makeMinimalSchema() { return getMinimalSchema().schema; }
128 
135  static bool checkSchema(afw::table::Schema const& other) {
136  return other.contains(getMinimalSchema().schema);
137  }
138 
141 
144 
147 
149 
154  static afw::table::Key<afw::table::RecordId> getIdKey() { return getMinimalSchema().id; }
155  static afw::table::Key<int> getIxKey() { return getMinimalSchema().ix; }
156  static afw::table::Key<int> getIyKey() { return getMinimalSchema().iy; }
157  static afw::table::Key<float> getFxKey() { return getMinimalSchema().fx; }
158  static afw::table::Key<float> getFyKey() { return getMinimalSchema().fy; }
159  static afw::table::Key<float> getPeakValueKey() { return getMinimalSchema().peakValue; }
161 
164 
167 
171  }
172 
177  }
178 
179 protected:
181 
182  PeakTable(PeakTable const& other);
183  PeakTable(PeakTable&& other);
184 
185  std::shared_ptr<afw::table::BaseTable> _clone() const override;
186 
187  std::shared_ptr<afw::table::BaseRecord> _makeRecord() override;
188 
189 private:
190  // Struct that holds the minimal schema and the special keys we've added to it.
191  struct MinimalSchema {
198  afw::table::Key<float> peakValue;
199 
200  MinimalSchema();
201  };
202 
203  // Return the singleton minimal schema.
204  static MinimalSchema& getMinimalSchema();
205 
207 
208  // Return a writer object that knows how to save in FITS format. See also FitsWriter.
210  int flags) const override;
211 
212  std::shared_ptr<afw::table::IdFactory> _idFactory; // generates IDs for new records
213 };
214 
216 
219 
220 inline int PeakRecord::getIx() const { return get(PeakTable::getIxKey()); }
221 inline int PeakRecord::getIy() const { return get(PeakTable::getIyKey()); }
222 inline void PeakRecord::setIx(int ix) { set(PeakTable::getIxKey(), ix); }
223 inline void PeakRecord::setIy(int iy) { set(PeakTable::getIyKey(), iy); }
224 
225 inline float PeakRecord::getFx() const { return get(PeakTable::getFxKey()); }
226 inline float PeakRecord::getFy() const { return get(PeakTable::getFyKey()); }
227 inline void PeakRecord::setFx(float fx) { set(PeakTable::getFxKey(), fx); }
228 inline void PeakRecord::setFy(float fy) { set(PeakTable::getFyKey(), fy); }
229 
230 inline float PeakRecord::getPeakValue() const { return get(PeakTable::getPeakValueKey()); }
231 inline void PeakRecord::setPeakValue(float peakValue) { set(PeakTable::getPeakValueKey(), peakValue); }
232 
236 } // namespace detection
237 } // namespace afw
238 } // namespace lsst
239 
240 #endif // !AFW_DETECTION_Peak_h_INCLUDED
Defines the fields and offsets for a table.
Definition: Schema.h:50
static afw::table::Key< float > getFxKey()
Get keys for standard fields shared by all peaks.
Definition: Peak.h:157
int getIy() const
Convenience accessors for the keys in the minimal schema.
Definition: Peak.h:221
Writer object for FITS binary tables.
Definition: FitsWriter.h:25
friend std::ostream & operator<<(std::ostream &os, BaseRecord const &record)
Write the record&#39;s content out, one field on each line.
Definition: BaseRecord.cc:101
std::shared_ptr< afw::table::IdFactory > getIdFactory()
Return the object that generates IDs for the table (may be null).
Definition: Peak.h:140
std::shared_ptr< PeakRecord > makeRecord()
Default-construct an associated record.
Definition: Peak.h:166
static afw::table::Schema makeMinimalSchema()
Return a minimal schema for Peak tables and records.
Definition: Peak.h:127
std::shared_ptr< PeakTable > clone() const
Return a polymorphic deep copy of the table.
Definition: Peak.h:163
A mapping between the keys of two Schemas, used to copy data between them.
Definition: SchemaMapper.h:21
afw::table::CatalogT< PeakRecord > Catalog
Definition: Peak.h:46
afw::table::CatalogT< Record const > ConstCatalog
Definition: Peak.h:97
PeakRecord(PeakRecord const &)=delete
Table class for Peaks in Footprints.
Definition: Peak.h:92
lsst::geom::Point2I getI() const
Convenience accessors for the keys in the minimal schema.
Definition: Peak.h:68
PeakRecord & operator=(PeakRecord const &)=delete
table::Key< int > id
Definition: Detector.cc:163
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
Definition: fits.h:296
std::shared_ptr< BaseRecord > copyRecord(BaseRecord const &input)
Deep-copy a record, requiring that it have the same schema as this table.
Definition: BaseTable.cc:125
static afw::table::Key< float > getPeakValueKey()
Get keys for standard fields shared by all peaks.
Definition: Peak.h:159
STL class.
float getPeakValue() const
Convenience accessors for the keys in the minimal schema.
Definition: Peak.h:230
std::shared_ptr< PeakTable const > getTable() const
Definition: Peak.h:55
Point< double, 2 > Point2D
Definition: Point.h:324
void setId(afw::table::RecordId id)
Convenience accessors for the keys in the minimal schema.
Definition: Peak.h:218
afw::table::RecordId getId() const
Convenience accessors for the keys in the minimal schema.
Definition: Peak.h:217
static afw::table::Key< float > getFyKey()
Get keys for standard fields shared by all peaks.
Definition: Peak.h:158
void setIy(int iy)
Convenience accessors for the keys in the minimal schema.
Definition: Peak.h:223
afw::table::CatalogT< PeakRecord const > ConstCatalog
Definition: Peak.h:47
std::shared_ptr< PeakRecord > copyRecord(afw::table::BaseRecord const &other)
Deep-copy a record, requiring that it have the same schema as this table.
Definition: Peak.h:169
afw::table::CatalogT< PeakRecord const > ConstPeakCatalog
Definition: Peak.h:235
void setFy(float fy)
Convenience accessors for the keys in the minimal schema.
Definition: Peak.h:228
A base class for image defects.
Definition: cameraGeom.dox:3
afw::table::CatalogT< PeakRecord > PeakCatalog
Definition: Peak.h:234
afw::table::CatalogT< Record > Catalog
Definition: Peak.h:96
int contains(Schema const &other, int flags=EQUAL_KEYS) const
Test whether the given schema is a subset of this.
Definition: Schema.cc:679
afw::table::ColumnViewT< PeakRecord > PeakColumnView
Definition: Peak.h:233
std::shared_ptr< PeakRecord > copyRecord(afw::table::BaseRecord const &other, afw::table::SchemaMapper const &mapper)
Deep-copy a record, requiring that it have the same schema as this table.
Definition: Peak.h:174
table::Schema schema
Definition: Camera.cc:161
static afw::table::Key< afw::table::RecordId > getIdKey()
Get keys for standard fields shared by all peaks.
Definition: Peak.h:154
T static_pointer_cast(T... args)
int getIx() const
Convenience accessors for the keys in the minimal schema.
Definition: Peak.h:220
Point< int, 2 > Point2I
Definition: Point.h:321
std::shared_ptr< BaseTable const > getTable() const
Return the table this record is associated with.
Definition: BaseRecord.h:57
static bool checkSchema(afw::table::Schema const &other)
Return true if the given schema is a valid PeakTable schema.
Definition: Peak.h:135
afw::table::ColumnViewT< PeakRecord > ColumnView
Definition: Peak.h:95
Base class for all records.
Definition: BaseRecord.h:31
A class used as a handle to a particular field in a table.
Definition: fwd.h:45
~PeakRecord() override=default
void setIdFactory(std::shared_ptr< afw::table::IdFactory > f)
Switch to a new IdFactory – object that generates IDs for the table (may be null).
Definition: Peak.h:146
static afw::table::Key< int > getIyKey()
Get keys for standard fields shared by all peaks.
Definition: Peak.h:156
lsst::geom::Point2I getCentroid(bool) const
Convenience accessors for the keys in the minimal schema.
Definition: Peak.h:69
void setPeakValue(float peakValue)
Convenience accessors for the keys in the minimal schema.
Definition: Peak.h:231
void setIx(int ix)
Convenience accessors for the keys in the minimal schema.
Definition: Peak.h:222
ItemVariant const * other
Definition: Schema.cc:56
lsst::geom::Point2D getF() const
Convenience accessors for the keys in the minimal schema.
Definition: Peak.h:75
void setFx(float fx)
Convenience accessors for the keys in the minimal schema.
Definition: Peak.h:227
Record class that represents a peak in a Footprint.
Definition: Peak.h:42
lsst::geom::Point2D getCentroid() const
Convenience accessors for the keys in the minimal schema.
Definition: Peak.h:76
STL class.
afw::table::ColumnViewT< PeakRecord > ColumnView
Definition: Peak.h:45
float getFy() const
Convenience accessors for the keys in the minimal schema.
Definition: Peak.h:226
Base class for all tables.
Definition: BaseTable.h:44
std::ostream * os
Definition: Schema.cc:746
SchemaMapper * mapper
Definition: SchemaMapper.cc:78
std::shared_ptr< afw::table::IdFactory const > getIdFactory() const
Return the object that generates IDs for the table (may be null).
Definition: Peak.h:143
static afw::table::Key< int > getIxKey()
Get keys for standard fields shared by all peaks.
Definition: Peak.h:155
float getFx() const
Convenience accessors for the keys in the minimal schema.
Definition: Peak.h:225