24 #ifndef LSST_MEAS_BASE_FluxUtilities_h_INCLUDED
25 #define LSST_MEAS_BASE_FluxUtilities_h_INCLUDED
29 #include "lsst/afw/table/FunctorKey.h"
30 #include "lsst/afw/table/Schema.h"
32 namespace lsst {
namespace meas {
namespace base {
70 afw::table::Schema & schema,
71 std::string
const & name,
72 std::string
const & doc
80 afw::table::Key<meas::base::Flux>
const & flux,
81 afw::table::Key<FluxErrElement>
const & fluxSigma
83 _flux(flux), _fluxSigma(fluxSigma)
95 FluxResultKey(afw::table::SubSchema
const & s) : _flux(s[
"flux"]), _fluxSigma(s[
"fluxSigma"]) {}
98 virtual FluxResult get(afw::table::BaseRecord
const & record)
const;
101 virtual void set(afw::table::BaseRecord & record,
FluxResult const & other)
const;
106 return _flux == other._flux && _fluxSigma == other._fluxSigma;
112 bool isValid()
const {
return _flux.isValid() && _fluxSigma.isValid(); }
115 afw::table::Key<meas::base::Flux>
getFlux()
const {
return _flux; }
118 afw::table::Key<FluxErrElement>
getFluxSigma()
const {
return _fluxSigma; }
121 afw::table::Key<Flux> _flux;
122 afw::table::Key<FluxErrElement> _fluxSigma;
149 afw::table::Schema & schema,
150 std::string
const & name
164 MagResultKey(afw::table::SubSchema
const & s) : _magKey(s[
"mag"]), _magErrKey(s[
"magErr"]) {}
167 virtual MagResult get(afw::table::BaseRecord
const & record)
const;
170 virtual void set(afw::table::BaseRecord & record,
MagResult const & magResult)
const;
173 virtual void set(afw::table::BaseRecord & record, std::pair<double,double>
const & magPair)
const;
176 afw::table::Key<Mag> _magKey;
177 afw::table::Key<MagErrElement> _magErrKey;
193 FluxTransform(std::string
const & name, afw::table::SchemaMapper & mapper);
204 virtual void operator()(afw::table::SourceCatalog
const & inputCatalog,
205 afw::table::BaseCatalog & outputCatalog,
206 afw::image::Wcs
const & wcs,
207 afw::image::Calib
const & calib)
const;
224 bool _throwOnNegative;
229 #endif // !LSST_MEAS_BASE_FluxUtilities_h_INCLUDED
bool operator==(FluxResultKey const &other) const
Compare the FunctorKey for equality with another, using the underlying flux and fluxSigma Keys...
MagResultKey(afw::table::SubSchema const &s)
Construct from a subschema, assuming mag and magErr subfields.
FluxResultKey()
Default constructor; instance will not be usuable unless subsequently assigned to.
virtual void set(afw::table::BaseRecord &record, FluxResult const &other) const
Set a FluxResult in the given record.
A FunctorKey for MagResult.
Temporarily replace negative fluxes with NaNs.
A reusable result struct for magnitudes.
static FluxResultKey addFields(afw::table::Schema &schema, std::string const &name, std::string const &doc)
Add a pair of _flux, _fluxSigma fields to a Schema, and return a FluxResultKey that points to them...
FluxResult()
Default constructor; initializes everything to NaN.
FluxResultKey(afw::table::Key< meas::base::Flux > const &flux, afw::table::Key< FluxErrElement > const &fluxSigma)
Construct from a pair of Keys.
FluxResult(Flux flux_, FluxErrElement fluxSigma_)
Constructor from flux and its uncertainty.
FluxResultKey(afw::table::SubSchema const &s)
Construct from a subschema, assuming flux and fluxSigma subfields.
bool isValid() const
Return True if both the flux and fluxSigma Keys are valid.
Flux flux
Measured flux in DN.
MagResultKey()
Default constructor; instance will not be usuable unless subsequently assigned to.
A FunctorKey for FluxResult.
static MagResultKey addFields(afw::table::Schema &schema, std::string const &name)
Add a pair of _mag, _magErr fields to a Schema, and return a MagResultKey that points to them...
NoThrowOnNegativeFluxContext()
virtual void set(afw::table::BaseRecord &record, MagResult const &magResult) const
Set a MagResult in the given record.
afw::table::Key< meas::base::Flux > getFlux() const
Return the underlying flux Key.
afw::table::Key< FluxErrElement > getFluxSigma() const
Return the underlying fluxSigma Key.
FluxErrElement fluxSigma
1-Sigma error (sqrt of variance) on flux in DN.
~NoThrowOnNegativeFluxContext()
A reusable result struct for flux measurements.
bool operator!=(FluxResultKey const &other) const
Compare the FunctorKey for equality with another, using the underlying flux and fluxSigma Keys...