LSSTApplications  1.1.2+25,10.0+13,10.0+132,10.0+133,10.0+224,10.0+41,10.0+8,10.0-1-g0f53050+14,10.0-1-g4b7b172+19,10.0-1-g61a5bae+98,10.0-1-g7408a83+3,10.0-1-gc1e0f5a+19,10.0-1-gdb4482e+14,10.0-11-g3947115+2,10.0-12-g8719d8b+2,10.0-15-ga3f480f+1,10.0-2-g4f67435,10.0-2-gcb4bc6c+26,10.0-28-gf7f57a9+1,10.0-3-g1bbe32c+14,10.0-3-g5b46d21,10.0-4-g027f45f+5,10.0-4-g86f66b5+2,10.0-4-gc4fccf3+24,10.0-40-g4349866+2,10.0-5-g766159b,10.0-5-gca2295e+25,10.0-6-g462a451+1
LSSTDataManagementBasePackage
slots.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 #ifndef LSST_AFW_TABLE_slots_h_INCLUDED
3 #define LSST_AFW_TABLE_slots_h_INCLUDED
4 
6 
7 namespace lsst {
8 
9 namespace daf { namespace base {
10 class PropertySet;
11 }} // namespace daf::base
12 
13 namespace afw {
14 
15 namespace fits {
16 class Fits;
17 }; // namespace fits
18 
19 namespace table {
20 
21 
48 public:
49 
51  explicit SlotDefinition(std::string const & name) : _name(name) {}
52 
54  std::string getName() const { return _name; }
55 
61  std::string getAlias(int version) const {
62  return (version > 0 ? "slot_" : "slot.") + _name;
63  }
64 
65 protected:
66  std::string _name;
67 };
68 
71 public:
72 
73  typedef double MeasValue;
74  typedef double ErrValue;
75  typedef Key<double> MeasKey;
76  typedef Key<double> ErrKey;
77 
79  explicit FluxSlotDefinition(std::string const & name) : SlotDefinition(name) {}
80 
82  bool isValid() const { return _measKey.isValid(); }
83 
85  MeasKey getMeasKey() const { return _measKey; }
86 
88  ErrKey getErrKey() const { return _errKey; }
89 
91  Key<Flag> getFlagKey() const { return _flagKey; }
92 
103  void setKeys(std::string const & alias, Schema const & schema);
104 
105 private:
109 };
110 
113 public:
114 
116  typedef Eigen::Matrix<float,2,2> ErrValue;
117  typedef Point2DKey MeasKey;
119 
121  explicit CentroidSlotDefinition(std::string const & name) : SlotDefinition(name) {}
122 
124  bool isValid() const { return _measKey.isValid(); }
125 
127  MeasKey getMeasKey() const { return _measKey; }
128 
130  ErrKey getErrKey() const { return _errKey; }
131 
133  Key<Flag> getFlagKey() const { return _flagKey; }
134 
145  void setKeys(std::string const & alias, Schema const & schema);
146 
147 private:
151 };
152 
155 public:
156 
158  typedef Eigen::Matrix<float,3,3> ErrValue;
161 
163  explicit ShapeSlotDefinition(std::string const & name) : SlotDefinition(name) {}
164 
166  bool isValid() const { return _measKey.isValid(); }
167 
169  MeasKey getMeasKey() const { return _measKey; }
170 
172  ErrKey getErrKey() const { return _errKey; }
173 
175  Key<Flag> getFlagKey() const { return _flagKey; }
176 
187  void setKeys(std::string const & alias, Schema const & schema);
188 
189 private:
193 };
194 
201 struct SlotSuite {
208 
210  void handleAliasChange(std::string const & alias, Schema const & schema);
211 
213  explicit SlotSuite(Schema const & schema);
214 };
215 
216 
218 
226 #ifndef SWIG
227 
228 template <typename MeasTagT, typename ErrTagT>
229 struct Measurement {
230  typedef MeasTagT MeasTag;
231  typedef ErrTagT ErrTag;
232  typedef typename Field<MeasTag>::Value MeasValue;
233  typedef typename Field<ErrTag>::Value ErrValue;
235  typedef Key<ErrTag> ErrKey;
236 };
237 
239 struct Flux : public Measurement<double, double> {};
240 
242 struct Centroid : public Measurement< Point<double>, Covariance< Point<float> > > {};
243 
245 struct Shape : public Measurement< Moments<double>, Covariance< Moments<float> > > {};
246 
254 template <typename MeasurementT>
255 struct KeyTuple {
256  typename MeasurementT::MeasKey meas;
257  typename MeasurementT::ErrKey err;
259 
261  KeyTuple() {}
262 
265  typename MeasurementT::MeasKey const & meas_,
266  typename MeasurementT::ErrKey const & err_,
267  Key<Flag> const & flag_
268  ) : meas(meas_), err(err_), flag(flag_) {}
269 
270 };
271 
273 KeyTuple<Centroid> addCentroidFields(Schema & schema, std::string const & name, std::string const & doc);
274 
276 KeyTuple<Shape> addShapeFields(Schema & schema, std::string const & name, std::string const & doc);
277 
279 KeyTuple<Flux> addFluxFields(Schema & schema, std::string const & name, std::string const & doc);
280 
281 #endif // !SWIG
282 
283 //@
284 
285 }}} // lsst::afw::table
286 
287 #endif // !LSST_AFW_TABLE_slots_h_INCLUDED
void handleAliasChange(std::string const &alias, Schema const &schema)
Handle a callback from an AliasMap informing the table that an alias has changed. ...
An ellipse core with quadrupole moments as parameters.
Definition: Quadrupole.h:45
Defines the fields and offsets for a table.
Definition: Schema.h:46
KeyTuple< Shape > addShapeFields(Schema &schema, std::string const &name, std::string const &doc)
Convenience function to setup fields for shape measurement algorithms.
bool isValid() const
Return True if all the constituent Keys are valid.
Definition: aggregates.h:262
FluxSlotDefinition defModelFlux
Definition: slots.h:205
KeyTuple()
Default-constructor; all keys will be invalid.
Definition: slots.h:261
void setKeys(std::string const &alias, Schema const &schema)
MeasTagT MeasTag
the tag (template parameter) type used for the measurement
Definition: slots.h:230
Field< MeasTag >::Value MeasValue
the value type used for the measurement
Definition: slots.h:232
double ErrValue
Type returned by accessing the slot uncertainty.
Definition: slots.h:74
void setKeys(std::string const &alias, Schema const &schema)
bool isValid() const
Return true if the key was initialized to valid offset.
Definition: Key.h:83
FluxSlotDefinition(std::string const &name)
Construct a SlotDefinition from the name of the slot (e.g. &quot;PsfFlux&quot;)
Definition: slots.h:79
CovarianceMatrixKey< float, 3 > ErrKey
Key type used to access the slot uncertainty.
Definition: slots.h:160
bool isValid() const
Return true if the key associated with the measurement is valid.
Definition: slots.h:166
MeasKey getMeasKey() const
Return the cached Key used to access the slot measurement.
Definition: slots.h:169
ShapeSlotDefinition defShape
Definition: slots.h:207
void setKeys(std::string const &alias, Schema const &schema)
A collection of types useful for shape measurement algorithms.
Definition: slots.h:245
Field< ErrTag >::Value ErrValue
the value type used for the uncertainty
Definition: slots.h:233
A collection of types useful for flux measurement algorithms.
Definition: slots.h:239
Eigen::Matrix< float, 3, 3 > ErrValue
Type returned by accessing the slot uncertainty.
Definition: slots.h:158
CentroidSlotDefinition defCentroid
Definition: slots.h:206
ErrKey getErrKey() const
Return the cached Key used to access the slot uncertainty.
Definition: slots.h:172
FluxSlotDefinition defInstFlux
Definition: slots.h:204
bool isValid() const
Return true if the key associated with the measurement is valid.
Definition: slots.h:82
ErrTagT ErrTag
the tag (template parameter) type used for the uncertainty
Definition: slots.h:231
KeyTuple< Flux > addFluxFields(Schema &schema, std::string const &name, std::string const &doc)
Convenience function to setup fields for flux measurement algorithms.
KeyTuple(typename MeasurementT::MeasKey const &meas_, typename MeasurementT::ErrKey const &err_, Key< Flag > const &flag_)
Main constructor.
Definition: slots.h:264
tbl::Schema schema
Definition: CoaddPsf.cc:324
ErrKey getErrKey() const
Return the cached Key used to access the slot uncertainty.
Definition: slots.h:130
FluxSlotDefinition defPsfFlux
Definition: slots.h:202
Key< ErrTag > ErrKey
the Key type for the error on the measurement
Definition: slots.h:235
CentroidSlotDefinition(std::string const &name)
Construct a SlotDefinition from the name of the slot (e.g. &quot;Centroid&quot;)
Definition: slots.h:121
T Value
the type returned by BaseRecord::get
Definition: FieldBase.h:52
CovarianceMatrixKey< float, 2 > ErrKey
Key type used to access the slot uncertainty.
Definition: slots.h:118
MeasKey getMeasKey() const
Return the cached Key used to access the slot measurement.
Definition: slots.h:127
Key< Flag > getFlagKey() const
Return the cached Key used to access the slot failure flag.
Definition: slots.h:133
geom::Point2D MeasValue
Type returned by accessing the slot measurement.
Definition: slots.h:115
bool isValid() const
Return true if the key associated with the measurement is valid.
Definition: slots.h:124
MeasurementT::ErrKey err
Key used for the uncertainty.
Definition: slots.h:257
Eigen::Matrix< float, 2, 2 > ErrValue
Type returned by accessing the slot uncertainty.
Definition: slots.h:116
geom::ellipses::Quadrupole MeasValue
Type returned by accessing the slot measurement.
Definition: slots.h:157
Key specialization for Flag.
Definition: Flag.h:82
MeasKey getMeasKey() const
Return the cached Key used to access the slot measurement.
Definition: slots.h:85
Class for storing generic metadata.
Definition: PropertySet.h:82
SlotDefinition specialization for centroids.
Definition: slots.h:112
std::string getAlias(int version) const
Definition: slots.h:61
double MeasValue
Type returned by accessing the slot measurement.
Definition: slots.h:73
A three-element tuple of measurement, uncertainty, and flag keys.
Definition: slots.h:255
Key< Flag > flag
Failure bit; set if the measurement did not fully succeed.
Definition: slots.h:258
ShapeSlotDefinition(std::string const &name)
Construct a SlotDefinition from the name of the slot (e.g. &quot;Shape&quot;)
Definition: slots.h:163
Key< MeasTag > MeasKey
the Key type for the actual measurement
Definition: slots.h:234
MeasurementT::MeasKey meas
Key used for the measured value.
Definition: slots.h:256
Key< Flag > getFlagKey() const
Return the cached Key used to access the slot failure flag.
Definition: slots.h:91
KeyTuple< Centroid > addCentroidFields(Schema &schema, std::string const &name, std::string const &doc)
Convenience function to setup fields for centroid measurement algorithms.
ErrKey getErrKey() const
Return the cached Key used to access the slot uncertainty.
Definition: slots.h:88
SlotDefinition(std::string const &name)
Construct a SlotDefinition from the name of the slot (e.g. &quot;Centroid&quot; or &quot;PsfFlux&quot;) ...
Definition: slots.h:51
Key< Flag > getFlagKey() const
Return the cached Key used to access the slot failure flag.
Definition: slots.h:175
FluxSlotDefinition defApFlux
Definition: slots.h:203
Key< double > ErrKey
Key type used to access the slot uncertainty.
Definition: slots.h:76
SlotDefinition specialization for shapes.
Definition: slots.h:154
A FunctorKey used to get or set a geom::ellipses::Quadrupole from a tuple of constituent Keys...
Definition: aggregates.h:196
bool isValid() const
Return True if both the x and y Keys are valid.
Definition: aggregates.h:105
SlotDefinition specialization for fluxes.
Definition: slots.h:70
std::string getName() const
Return the name of the slot (e.g. &quot;Centroid&quot; or &quot;PsfFlux&quot;)
Definition: slots.h:54
Key< double > MeasKey
Key type used to access the slot measurement.
Definition: slots.h:75
QuadrupoleKey MeasKey
Key type used to access the slot measurement.
Definition: slots.h:159
SlotSuite(Schema const &schema)
Initialize the slots.
A collection of types useful for centroid measurement algorithms.
Definition: slots.h:242
Point2DKey MeasKey
Key type used to access the slot measurement.
Definition: slots.h:117