lsst.jointcal  16.0-23-gcb65559+3
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 class CcdImage;
39 
42 class MeasuredStar : public BaseStar {
43 public:
45  : BaseStar(),
46  _id(0),
47  _instFlux(0.),
48  _instFluxErr(0.),
49  _ccdImage(0),
50  _valid(true),
51  _xFocal(0.0),
52  _yFocal(0.0),
53  _instMag(0.),
54  _instMagErr(0.) {}
55 
56  MeasuredStar(BaseStar const &baseStar)
57  : BaseStar(baseStar),
58  _id(0),
59  _instFluxErr(0.),
60  _ccdImage(0),
61  _valid(true),
62  _xFocal(0.0),
63  _yFocal(0.0),
64  _instMag(0.),
65  _instMagErr(0.) {}
66 
69  MeasuredStar(MeasuredStar const &) = default;
70  MeasuredStar(MeasuredStar &&) = delete;
71  MeasuredStar &operator=(MeasuredStar const &) = delete;
72  MeasuredStar &operator=(MeasuredStar &&) = delete;
73 
75  if (fittedStar) fittedStar->getMeasurementCount()++;
76  _fittedStar = std::move(fittedStar);
77  }
78 
79  void dump(std::ostream &stream = std::cout) const {
80  BaseStar::dump(stream);
81  stream << " instFlux: " << _instFlux << " instFluxErr: " << _instFluxErr << " id: " << _id
82  << " valid: " << _valid;
83  }
84 
85  void setInstFluxAndErr(double instFlux, double instFluxErr) {
86  _instFlux = instFlux;
87  _instMag = magFromFlux(instFlux);
88  _instFluxErr = instFluxErr;
89  _instMagErr = magErrFromFluxErr(instFlux, instFluxErr);
90  }
91 
92  double getInstFlux() const { return _instFlux; }
93  double getInstFluxErr() const { return _instFluxErr; }
94  double getInstMag() const { return _instMag; }
95  double getInstMagErr() const { return _instMagErr; }
96 
97  void setId(afw::table::RecordId id) { _id = id; }
98  afw::table::RecordId getId() { return _id; }
99 
101  double getMagWeight() const { return (_instFlux * _instFlux / (_instFluxErr * _instFluxErr)); }
102 
103  double getXFocal() const { return _xFocal; }
104  void setXFocal(double xFocal) { _xFocal = xFocal; }
105  double getYFocal() const { return _yFocal; }
106  void setYFocal(double yFocal) { _yFocal = yFocal; }
107 
108  std::shared_ptr<FittedStar> getFittedStar() const { return _fittedStar; };
109 
110  CcdImage const &getCcdImage() const { return *_ccdImage; };
111 
112  void setCcdImage(const CcdImage *ccdImage) { _ccdImage = ccdImage; };
113 
115  bool isValid() const { return _valid; }
117  void setValid(bool v) { _valid = v; }
118 
119 private:
120  afw::table::RecordId _id; // id in original catalog
121 
122  // on-chip flux, in ADU
123  double _instFlux;
124  double _instFluxErr;
125 
126  const CcdImage *_ccdImage;
127  // Note: _fittedStar is not const, but measuredStar won't modify it.
128  std::shared_ptr<FittedStar> _fittedStar;
129  bool _valid;
130 
131  double _xFocal, _yFocal;
132 
133  // on-sensor "magnitudes", used when fitting the MagnitudeModel.
134  double _instMag;
135  double _instMagErr;
136 };
137 
138 /****** MeasuredStarList */
139 
141 class MeasuredStarList : public StarList<MeasuredStar> {
142 public:
144 
145  void setCcdImage(const CcdImage *_ccdImage);
146 };
147 
148 typedef MeasuredStarList::const_iterator MeasuredStarCIterator;
149 typedef MeasuredStarList::iterator MeasuredStarIterator;
150 
153 const BaseStarList &Measured2Base(const MeasuredStarList &This);
154 const BaseStarList *Measured2Base(const MeasuredStarList *This);
155 } // namespace jointcal
156 } // namespace lsst
157 
158 #endif // LSST_JOINTCAL_MEASURED_STAR_H
void setXFocal(double xFocal)
Definition: MeasuredStar.h:104
virtual void dump(std::ostream &stream=std::cout) const
utility
Definition: BaseStar.h:82
MeasuredStarList::iterator MeasuredStarIterator
Definition: MeasuredStar.h:149
MeasuredStar(BaseStar const &baseStar)
Definition: MeasuredStar.h:56
CcdImage const & getCcdImage() const
Definition: MeasuredStar.h:110
MeasuredStar & operator=(MeasuredStar const &)=delete
void setCcdImage(const CcdImage *ccdImage)
Definition: MeasuredStar.h:112
A list of MeasuredStar. They are usually filled in Associations::createCcdImage.
Definition: MeasuredStar.h:141
void setYFocal(double yFocal)
Definition: MeasuredStar.h:106
The base class for handling stars. Used by all matching routines.
Definition: BaseStar.h:50
afw::table::RecordId getId()
Definition: MeasuredStar.h:98
void dump(std::ostream &stream=std::cout) const
utility
Definition: MeasuredStar.h:79
std::lists of Stars.
Definition: StarList.h:58
void setFittedStar(std::shared_ptr< FittedStar > fittedStar)
Definition: MeasuredStar.h:74
Class for a simple mapping implementing a generic Gtransfo.
MeasuredStarList::const_iterator MeasuredStarCIterator
Definition: MeasuredStar.h:148
void setInstFluxAndErr(double instFlux, double instFluxErr)
Definition: MeasuredStar.h:85
double getInstMagErr() const
Definition: MeasuredStar.h:95
double getInstFluxErr() const
Definition: MeasuredStar.h:93
objects measured on actual images.
Definition: MeasuredStar.h:42
double getMagWeight() const
the inverse of the mag variance
Definition: MeasuredStar.h:101
T move(T... args)
void setValid(bool v)
Fits may use that to discard outliers.
Definition: MeasuredStar.h:117
BaseStarList & Measured2Base(MeasuredStarList &This)
Definition: MeasuredStar.cc:58
Handler of an actual image from a single CCD.
Definition: CcdImage.h:64
void setId(afw::table::RecordId id)
Definition: MeasuredStar.h:97
bool isValid() const
Fits may use that to discard outliers.
Definition: MeasuredStar.h:115
std::shared_ptr< FittedStar > getFittedStar() const
Definition: MeasuredStar.h:108
STL class.