LSSTApplications  19.0.0-14-gb0260a2+72efe9b372,20.0.0+7927753e06,20.0.0+8829bf0056,20.0.0+995114c5d2,20.0.0+b6f4b2abd1,20.0.0+bddc4f4cbe,20.0.0-1-g253301a+8829bf0056,20.0.0-1-g2b7511a+0d71a2d77f,20.0.0-1-g5b95a8c+7461dd0434,20.0.0-12-g321c96ea+23efe4bbff,20.0.0-16-gfab17e72e+fdf35455f6,20.0.0-2-g0070d88+ba3ffc8f0b,20.0.0-2-g4dae9ad+ee58a624b3,20.0.0-2-g61b8584+5d3db074ba,20.0.0-2-gb780d76+d529cf1a41,20.0.0-2-ged6426c+226a441f5f,20.0.0-2-gf072044+8829bf0056,20.0.0-2-gf1f7952+ee58a624b3,20.0.0-20-geae50cf+e37fec0aee,20.0.0-25-g3dcad98+544a109665,20.0.0-25-g5eafb0f+ee58a624b3,20.0.0-27-g64178ef+f1f297b00a,20.0.0-3-g4cc78c6+e0676b0dc8,20.0.0-3-g8f21e14+4fd2c12c9a,20.0.0-3-gbd60e8c+187b78b4b8,20.0.0-3-gbecbe05+48431fa087,20.0.0-38-ge4adf513+a12e1f8e37,20.0.0-4-g97dc21a+544a109665,20.0.0-4-gb4befbc+087873070b,20.0.0-4-gf910f65+5d3db074ba,20.0.0-5-gdfe0fee+199202a608,20.0.0-5-gfbfe500+d529cf1a41,20.0.0-6-g64f541c+d529cf1a41,20.0.0-6-g9a5b7a1+a1cd37312e,20.0.0-68-ga3f3dda+5fca18c6a4,20.0.0-9-g4aef684+e18322736b,w.2020.45
LSSTDataManagementBasePackage
MeasuredStar.h
Go to the documentation of this file.
1 // -*- LSST-C++ -*-
2 /*
3  * This file is part of jointcal.
4  *
5  * Developed for the LSST Data Management System.
6  * This product includes software developed by the LSST Project
7  * (https://www.lsst.org).
8  * See the COPYRIGHT file at the top-level directory of this distribution
9  * for details of code ownership.
10  *
11  * This program is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation, either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program. If not, see <https://www.gnu.org/licenses/>.
23  */
24 
25 #ifndef LSST_JOINTCAL_MEASURED_STAR_H
26 #define LSST_JOINTCAL_MEASURED_STAR_H
27 
28 #include <iostream>
29 
30 #include "lsst/afw/table/misc.h"
31 #include "lsst/jointcal/BaseStar.h"
33 #include "lsst/jointcal/StarList.h"
34 
35 namespace lsst {
36 namespace jointcal {
37 
38 namespace {
39 double instMagFromInstFlux(double instFlux) { return -2.5 * std::log10(instFlux); }
40 } // namespace
41 
42 class CcdImage;
43 
46 class MeasuredStar : public BaseStar {
47 public:
49  : BaseStar(),
50  _id(0),
51  _instFlux(0.),
52  _instFluxErr(0.),
53  _ccdImage(0),
54  _valid(true),
55  _xFocal(0.0),
56  _yFocal(0.0),
57  _instMag(0.),
58  _instMagErr(0.) {}
59 
60  MeasuredStar(BaseStar const &baseStar)
61  : BaseStar(baseStar),
62  _id(0),
63  _instFlux(0.),
64  _instFluxErr(0.),
65  _ccdImage(0),
66  _valid(true),
67  _xFocal(0.0),
68  _yFocal(0.0),
69  _instMag(0.),
70  _instMagErr(0.) {}
71 
74  MeasuredStar(MeasuredStar const &) = default;
75  MeasuredStar(MeasuredStar &&) = delete;
76  MeasuredStar &operator=(MeasuredStar const &) = delete;
78 
80  if (fittedStar) fittedStar->getMeasurementCount()++;
81  _fittedStar = std::move(fittedStar);
82  }
83 
84  void print(std::ostream &out) const {
85  BaseStar::print(out);
86  out << " instFlux: " << _instFlux << " instFluxErr: " << _instFluxErr << " id: " << _id
87  << " valid: " << _valid;
88  }
89 
90  void setInstFluxAndErr(double instFlux, double instFluxErr) {
91  _instFlux = instFlux;
92  _instMag = instMagFromInstFlux(instFlux);
93  _instFluxErr = instFluxErr;
94  _instMagErr = magErrFromFluxErr(instFlux, instFluxErr);
95  }
96 
97  double getInstFlux() const { return _instFlux; }
98  double getInstFluxErr() const { return _instFluxErr; }
99  double getInstMag() const { return _instMag; }
100  double getInstMagErr() const { return _instMagErr; }
101 
102  void setId(afw::table::RecordId id) { _id = id; }
103  afw::table::RecordId getId() { return _id; }
104 
106  double getMagWeight() const { return (_instFlux * _instFlux / (_instFluxErr * _instFluxErr)); }
107 
108  double getXFocal() const { return _xFocal; }
109  void setXFocal(double xFocal) { _xFocal = xFocal; }
110  double getYFocal() const { return _yFocal; }
111  void setYFocal(double yFocal) { _yFocal = yFocal; }
112 
113  std::shared_ptr<FittedStar> getFittedStar() const { return _fittedStar; };
114 
115  CcdImage const &getCcdImage() const { return *_ccdImage; };
116 
117  void setCcdImage(const CcdImage *ccdImage) { _ccdImage = ccdImage; };
118 
120  bool isValid() const { return _valid; }
122  void setValid(bool v) { _valid = v; }
123 
124 private:
125  afw::table::RecordId _id; // id in original catalog
126 
127  // on-chip flux, in ADU
128  double _instFlux;
129  double _instFluxErr;
130 
131  const CcdImage *_ccdImage;
132  // Note: _fittedStar is not const, but measuredStar won't modify it.
133  std::shared_ptr<FittedStar> _fittedStar;
134  bool _valid;
135 
136  double _xFocal, _yFocal;
137 
138  // on-sensor "magnitudes", used when fitting the MagnitudeModel.
139  double _instMag;
140  double _instMagErr;
141 };
142 
143 /****** MeasuredStarList */
144 
146 class MeasuredStarList : public StarList<MeasuredStar> {
147 public:
149 
150  void setCcdImage(const CcdImage *_ccdImage);
151 };
152 
153 typedef MeasuredStarList::const_iterator MeasuredStarCIterator;
154 typedef MeasuredStarList::iterator MeasuredStarIterator;
155 
158 const BaseStarList &Measured2Base(const MeasuredStarList &This);
159 const BaseStarList *Measured2Base(const MeasuredStarList *This);
160 } // namespace jointcal
161 } // namespace lsst
162 
163 #endif // LSST_JOINTCAL_MEASURED_STAR_H
lsst::jointcal::MeasuredStar
objects measured on actual images.
Definition: MeasuredStar.h:46
lsst::jointcal::MeasuredStarCIterator
MeasuredStarList::const_iterator MeasuredStarCIterator
Definition: MeasuredStar.h:153
std::shared_ptr< FittedStar >
lsst::jointcal::MeasuredStarList::MeasuredStarList
MeasuredStarList()
Definition: MeasuredStar.h:148
lsst::jointcal::MeasuredStar::getMagWeight
double getMagWeight() const
the inverse of the mag variance
Definition: MeasuredStar.h:106
std::move
T move(T... args)
lsst::jointcal::MeasuredStar::getInstFlux
double getInstFlux() const
Definition: MeasuredStar.h:97
lsst::jointcal::MeasuredStar::getInstFluxErr
double getInstFluxErr() const
Definition: MeasuredStar.h:98
lsst::jointcal::Measured2Base
BaseStarList & Measured2Base(MeasuredStarList &This)
Definition: MeasuredStar.cc:58
lsst::jointcal::MeasuredStar::setInstFluxAndErr
void setInstFluxAndErr(double instFlux, double instFluxErr)
Definition: MeasuredStar.h:90
lsst::jointcal::MeasuredStar::getInstMagErr
double getInstMagErr() const
Definition: MeasuredStar.h:100
lsst::jointcal::MeasuredStar::setId
void setId(afw::table::RecordId id)
Definition: MeasuredStar.h:102
lsst::jointcal::MeasuredStar::MeasuredStar
MeasuredStar(MeasuredStar &&)=delete
lsst::jointcal::MeasuredStarIterator
MeasuredStarList::iterator MeasuredStarIterator
Definition: MeasuredStar.h:154
lsst::jointcal::MeasuredStar::setValid
void setValid(bool v)
Fits may use that to discard outliers.
Definition: MeasuredStar.h:122
lsst::jointcal::MeasuredStar::getYFocal
double getYFocal() const
Definition: MeasuredStar.h:110
lsst::jointcal::MeasuredStarList::setCcdImage
void setCcdImage(const CcdImage *_ccdImage)
Definition: MeasuredStar.cc:68
lsst::jointcal::MeasuredStar::operator=
MeasuredStar & operator=(MeasuredStar &&)=delete
misc.h
std::ostream
STL class.
id
table::Key< int > id
Definition: Detector.cc:162
lsst::jointcal::CcdImage
Handler of an actual image from a single CCD.
Definition: CcdImage.h:64
lsst::jointcal::MeasuredStar::isValid
bool isValid() const
Fits may use that to discard outliers.
Definition: MeasuredStar.h:120
lsst::jointcal::StarList
std::lists of Stars.
Definition: StarList.h:58
std::int64_t
lsst::jointcal::MeasuredStar::getFittedStar
std::shared_ptr< FittedStar > getFittedStar() const
Definition: MeasuredStar.h:113
lsst::jointcal::MeasuredStarList
A list of MeasuredStar. They are usually filled in Associations::createCcdImage.
Definition: MeasuredStar.h:146
lsst::jointcal
Definition: Associations.h:49
lsst::jointcal::MeasuredStar::setCcdImage
void setCcdImage(const CcdImage *ccdImage)
Definition: MeasuredStar.h:117
lsst::jointcal::MeasuredStar::setXFocal
void setXFocal(double xFocal)
Definition: MeasuredStar.h:109
lsst::jointcal::MeasuredStar::getInstMag
double getInstMag() const
Definition: MeasuredStar.h:99
lsst
A base class for image defects.
Definition: imageAlgorithm.dox:1
lsst::jointcal::MeasuredStar::MeasuredStar
MeasuredStar(BaseStar const &baseStar)
Definition: MeasuredStar.h:60
BaseStar.h
lsst::jointcal::MeasuredStar::getCcdImage
CcdImage const & getCcdImage() const
Definition: MeasuredStar.h:115
lsst::jointcal::MeasuredStar::print
void print(std::ostream &out) const
utility
Definition: MeasuredStar.h:84
StarList.h
std::log10
T log10(T... args)
lsst::jointcal::MeasuredStar::operator=
MeasuredStar & operator=(MeasuredStar const &)=delete
lsst::jointcal::BaseStar
The base class for handling stars. Used by all matching routines.
Definition: BaseStar.h:50
lsst::jointcal::MeasuredStar::MeasuredStar
MeasuredStar(MeasuredStar const &)=default
No move, allow copy constructor: we may copy the fitted StarLists when associating and matching catal...
lsst::jointcal::MeasuredStar::getId
afw::table::RecordId getId()
Definition: MeasuredStar.h:103
FittedStar.h
lsst::jointcal::MeasuredStar::getXFocal
double getXFocal() const
Definition: MeasuredStar.h:108
lsst::jointcal::BaseStar::print
virtual void print(std::ostream &out) const
utility
Definition: BaseStar.h:82
lsst::jointcal::MeasuredStar::MeasuredStar
MeasuredStar()
Definition: MeasuredStar.h:48
lsst::jointcal::MeasuredStar::setFittedStar
void setFittedStar(std::shared_ptr< FittedStar > fittedStar)
Definition: MeasuredStar.h:79
lsst::jointcal::MeasuredStar::setYFocal
void setYFocal(double yFocal)
Definition: MeasuredStar.h:111