LSST Applications g04e9c324dd+8c5ae1fdc5,g134cb467dc+1b3060144d,g18429d2f64+f642bf4753,g199a45376c+0ba108daf9,g1fd858c14a+2dcf163641,g262e1987ae+7b8c96d2ca,g29ae962dfc+3bd6ecb08a,g2cef7863aa+aef1011c0b,g35bb328faa+8c5ae1fdc5,g3fd5ace14f+53e1a9e7c5,g4595892280+fef73a337f,g47891489e3+2efcf17695,g4d44eb3520+642b70b07e,g53246c7159+8c5ae1fdc5,g67b6fd64d1+2efcf17695,g67fd3c3899+b70e05ef52,g74acd417e5+317eb4c7d4,g786e29fd12+668abc6043,g87389fa792+8856018cbb,g89139ef638+2efcf17695,g8d7436a09f+3be3c13596,g8ea07a8fe4+9f5ccc88ac,g90f42f885a+a4e7b16d9b,g97be763408+ad77d7208f,g9dd6db0277+b70e05ef52,ga681d05dcb+a3f46e7fff,gabf8522325+735880ea63,gac2eed3f23+2efcf17695,gb89ab40317+2efcf17695,gbf99507273+8c5ae1fdc5,gd8ff7fe66e+b70e05ef52,gdab6d2f7ff+317eb4c7d4,gdc713202bf+b70e05ef52,gdfd2d52018+b10e285e0f,ge365c994fd+310e8507c4,ge410e46f29+2efcf17695,geaed405ab2+562b3308c0,gffca2db377+8c5ae1fdc5,w.2025.35
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.