LSST Applications g013ef56533+d2224463a4,g199a45376c+0ba108daf9,g19c4beb06c+9f335b2115,g1fd858c14a+2459ca3e43,g210f2d0738+2d3d333a78,g262e1987ae+abbb004f04,g2825c19fe3+eedc38578d,g29ae962dfc+0cb55f06ef,g2cef7863aa+aef1011c0b,g35bb328faa+8c5ae1fdc5,g3fd5ace14f+19c3a54948,g47891489e3+501a489530,g4cdb532a89+a047e97985,g511e8cfd20+ce1f47b6d6,g53246c7159+8c5ae1fdc5,g54cd7ddccb+890c8e1e5d,g5fd55ab2c7+951cc3f256,g64539dfbff+2d3d333a78,g67b6fd64d1+501a489530,g67fd3c3899+2d3d333a78,g74acd417e5+0ea5dee12c,g786e29fd12+668abc6043,g87389fa792+8856018cbb,g89139ef638+501a489530,g8d7436a09f+5ea4c44d25,g8ea07a8fe4+81eaaadc04,g90f42f885a+34c0557caf,g9486f8a5af+165c016931,g97be763408+d5e351dcc8,gbf99507273+8c5ae1fdc5,gc2a301910b+2d3d333a78,gca7fc764a6+501a489530,gce8aa8abaa+8c5ae1fdc5,gd7ef33dd92+501a489530,gdab6d2f7ff+0ea5dee12c,ge410e46f29+501a489530,geaed405ab2+e3b4b2a692,gf9a733ac38+8c5ae1fdc5,w.2025.41
LSST Data Management Base Package
Loading...
Searching...
No Matches
FluxUtilities.h
Go to the documentation of this file.
1// -*- lsst-c++ -*-
2/*
3 * LSST Data Management System
4 * Copyright 2008-2015 AURA/LSST.
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
24#ifndef LSST_MEAS_BASE_FluxUtilities_h_INCLUDED
25#define LSST_MEAS_BASE_FluxUtilities_h_INCLUDED
26
33
34namespace lsst {
35namespace meas {
36namespace base {
37
52
53std::ostream& operator<<(std::ostream& os, FluxResult const& result);
54
61class FluxResultKey : public afw::table::FunctorKey<FluxResult> {
62public:
74 static FluxResultKey addFields(afw::table::Schema& schema, std::string const& name,
75 std::string const& doc);
76
78 FluxResultKey() : _instFlux(), _instFluxErr() {}
79
82 afw::table::Key<meas::base::Flux> const& instFlux, // namespace qualification to unconfuse swig
84 : _instFlux(instFlux), _instFluxErr(instFluxErr) {}
85
96 : _instFlux(s["instFlux"]), _instFluxErr(s["instFluxErr"]) {}
97
99 virtual FluxResult get(afw::table::BaseRecord const& record) const;
100
102 virtual void set(afw::table::BaseRecord& record, FluxResult const& other) const;
103
105
106 bool operator==(FluxResultKey const& other) const {
107 return _instFlux == other._instFlux && _instFluxErr == other._instFluxErr;
108 }
109 bool operator!=(FluxResultKey const& other) const { return !(*this == other); }
111
113 bool isValid() const { return _instFlux.isValid() && _instFluxErr.isValid(); }
114
116 afw::table::Key<meas::base::Flux> getInstFlux() const { return _instFlux; }
117
119 afw::table::Key<FluxErrElement> getInstFluxErr() const { return _instFluxErr; }
120
121private:
124};
125
133
140class MagResultKey : public afw::table::FunctorKey<MagResult> {
141public:
149 static MagResultKey addFields(afw::table::Schema& schema, std::string const& name);
150
152 MagResultKey() : _magKey(), _magErrKey() {}
153
162 MagResultKey(afw::table::SubSchema const& s) : _magKey(s["mag"]), _magErrKey(s["magErr"]) {}
163
165 virtual MagResult get(afw::table::BaseRecord const& record) const;
166
168 virtual void set(afw::table::BaseRecord& record, MagResult const& magResult) const;
169
171 virtual void set(afw::table::BaseRecord& record, afw::image::Measurement const& magnitude) const;
172
173private:
174 afw::table::Key<Mag> _magKey;
176};
177
190public:
192
193 /*
194 * @brief Perform transformation from inputCatalog to outputCatalog.
195 *
196 * @param[in] inputCatalog Source of data to be transformed
197 * @param[in,out] outputCatalog Container for transformed results
198 * @param[in] wcs World coordinate system under which transformation will take place
199 * @param[in] photoCalib Photometric calibration under which transformation will take place
200 * @throws LengthError Catalog sizes do not match
201 */
202 virtual void operator()(afw::table::SourceCatalog const& inputCatalog,
203 afw::table::BaseCatalog& outputCatalog, afw::geom::SkyWcs const& wcs,
204 afw::image::PhotoCalib const& photoCalib) const;
205
206private:
207 MagResultKey _magKey;
208};
209
210} // namespace base
211} // namespace meas
212} // namespace lsst
213
214#endif // !LSST_MEAS_BASE_FluxUtilities_h_INCLUDED
Implementation of the Photometric Calibration class.
A 2-dimensional celestial WCS that transform pixels to ICRS RA/Dec, using the LSST standard for pixel...
Definition SkyWcs.h:118
The photometric calibration of an exposure.
Definition PhotoCalib.h:114
Base class for all records.
Definition BaseRecord.h:31
Convenience base class that combines the OutputFunctorKey and InputFunctorKey.
Definition FunctorKey.h:74
A class used as a handle to a particular field in a table.
Definition Key.h:53
Defines the fields and offsets for a table.
Definition Schema.h:51
A mapping between the keys of two Schemas, used to copy data between them.
A proxy type for name lookups in a Schema.
Definition Schema.h:367
BaseTransform(std::string const &name)
Definition Transform.h:88
bool isValid() const
Return True if both the instFlux and instFluxErr Keys are valid.
bool operator==(FluxResultKey const &other) const
Compare the FunctorKey for equality with another, using the underlying instFlux and instFluxErr Keys.
static FluxResultKey addFields(afw::table::Schema &schema, std::string const &name, std::string const &doc)
Add a pair of _instFlux, _instFluxErr fields to a Schema, and return a FluxResultKey that points to t...
afw::table::Key< meas::base::Flux > getInstFlux() const
Return the underlying instFlux Key.
FluxResultKey(afw::table::Key< meas::base::Flux > const &instFlux, afw::table::Key< meas::base::FluxErrElement > const &instFluxErr)
Construct from a pair of Keys.
FluxResultKey()
Default constructor; instance will not be usuable unless subsequently assigned to.
afw::table::Key< FluxErrElement > getInstFluxErr() const
Return the underlying instFluxErr Key.
bool operator!=(FluxResultKey const &other) const
virtual FluxResult get(afw::table::BaseRecord const &record) const
Get a FluxResult from the given record.
virtual void set(afw::table::BaseRecord &record, FluxResult const &other) const
Set a FluxResult in the given record.
FluxResultKey(afw::table::SubSchema const &s)
Construct from a subschema, assuming instFlux and instFluxErr subfields.
virtual void operator()(afw::table::SourceCatalog const &inputCatalog, afw::table::BaseCatalog &outputCatalog, afw::geom::SkyWcs const &wcs, afw::image::PhotoCalib const &photoCalib) const
FluxTransform(std::string const &name, afw::table::SchemaMapper &mapper)
A FunctorKey for MagResult.
virtual void set(afw::table::BaseRecord &record, MagResult const &magResult) const
Set a MagResult in the given record.
MagResultKey()
Default constructor; instance will not be usuable unless subsequently assigned to.
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.
virtual MagResult get(afw::table::BaseRecord const &record) const
Get a MagResult from the given record.
MagResultKey(afw::table::SubSchema const &s)
Construct from a subschema, assuming mag and magErr subfields.
This defines the base of measurement transformations.
CatalogT< BaseRecord > BaseCatalog
Definition fwd.h:72
double MagErrElement
Definition constants.h:54
std::ostream & operator<<(std::ostream &os, CentroidResult const &result)
double FluxErrElement
Definition constants.h:52
A value and its error.
Definition PhotoCalib.h:51
A reusable result struct for instFlux measurements.
meas::base::Flux instFlux
Measured instFlux in DN.
meas::base::FluxErrElement instFluxErr
Standard deviation of instFlux in DN.
FluxResult()
Default constructor; initializes everything to NaN.
FluxResult(meas::base::Flux instFlux_, meas::base::FluxErrElement instFluxErr_)
Constructor from instFlux and its uncertainty.
A reusable result struct for magnitudes.