LSST Applications g042eb84c57+730a74494b,g04e9c324dd+8c5ae1fdc5,g134cb467dc+1f1e3e7524,g199a45376c+0ba108daf9,g1fd858c14a+fa7d31856b,g210f2d0738+f66ac109ec,g262e1987ae+83a3acc0e5,g29ae962dfc+d856a2cb1f,g2cef7863aa+aef1011c0b,g35bb328faa+8c5ae1fdc5,g3fd5ace14f+a1e0c9f713,g47891489e3+0d594cb711,g4d44eb3520+c57ec8f3ed,g4d7b6aa1c5+f66ac109ec,g53246c7159+8c5ae1fdc5,g56a1a4eaf3+fd7ad03fde,g64539dfbff+f66ac109ec,g67b6fd64d1+0d594cb711,g67fd3c3899+f66ac109ec,g6985122a63+0d594cb711,g74acd417e5+3098891321,g786e29fd12+668abc6043,g81db2e9a8d+98e2ab9f28,g87389fa792+8856018cbb,g89139ef638+0d594cb711,g8d7436a09f+80fda9ce03,g8ea07a8fe4+760ca7c3fc,g90f42f885a+033b1d468d,g97be763408+a8a29bda4b,g99822b682c+e3ec3c61f9,g9d5c6a246b+0d5dac0c3d,ga41d0fce20+9243b26dd2,gbf99507273+8c5ae1fdc5,gd7ef33dd92+0d594cb711,gdab6d2f7ff+3098891321,ge410e46f29+0d594cb711,geaed405ab2+c4bbc419c6,gf9a733ac38+8c5ae1fdc5,w.2025.38
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.