LSSTApplications  16.0-10-g0ee56ad+5,16.0-11-ga33d1f2+5,16.0-12-g3ef5c14+3,16.0-12-g71e5ef5+18,16.0-12-gbdf3636+3,16.0-13-g118c103+3,16.0-13-g8f68b0a+3,16.0-15-gbf5c1cb+4,16.0-16-gfd17674+3,16.0-17-g7c01f5c+3,16.0-18-g0a50484+1,16.0-20-ga20f992+8,16.0-21-g0e05fd4+6,16.0-21-g15e2d33+4,16.0-22-g62d8060+4,16.0-22-g847a80f+4,16.0-25-gf00d9b8+1,16.0-28-g3990c221+4,16.0-3-gf928089+3,16.0-32-g88a4f23+5,16.0-34-gd7987ad+3,16.0-37-gc7333cb+2,16.0-4-g10fc685+2,16.0-4-g18f3627+26,16.0-4-g5f3a788+26,16.0-5-gaf5c3d7+4,16.0-5-gcc1f4bb+1,16.0-6-g3b92700+4,16.0-6-g4412fcd+3,16.0-6-g7235603+4,16.0-69-g2562ce1b+2,16.0-8-g14ebd58+4,16.0-8-g2df868b+1,16.0-8-g4cec79c+6,16.0-8-gadf6c7a+1,16.0-8-gfc7ad86,16.0-82-g59ec2a54a+1,16.0-9-g5400cdc+2,16.0-9-ge6233d7+5,master-g2880f2d8cf+3,v17.0.rc1
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;
77  MeasuredStar &operator=(MeasuredStar &&) = delete;
78 
80  if (fittedStar) fittedStar->getMeasurementCount()++;
81  _fittedStar = std::move(fittedStar);
82  }
83 
84  void dump(std::ostream &stream = std::cout) const {
86  stream << " 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
void setXFocal(double xFocal)
Definition: MeasuredStar.h:109
virtual void dump(std::ostream &stream=std::cout) const
utility
Definition: BaseStar.h:82
MeasuredStarList::iterator MeasuredStarIterator
Definition: MeasuredStar.h:154
MeasuredStar(BaseStar const &baseStar)
Definition: MeasuredStar.h:60
CcdImage const & getCcdImage() const
Definition: MeasuredStar.h:115
MeasuredStar & operator=(MeasuredStar const &)=delete
void setCcdImage(const CcdImage *ccdImage)
Definition: MeasuredStar.h:117
table::Key< int > id
Definition: Detector.cc:163
T log10(T... args)
A list of MeasuredStar. They are usually filled in Associations::createCcdImage.
Definition: MeasuredStar.h:146
void setYFocal(double yFocal)
Definition: MeasuredStar.h:111
The base class for handling stars. Used by all matching routines.
Definition: BaseStar.h:50
afw::table::RecordId getId()
Definition: MeasuredStar.h:103
void dump(std::ostream &stream=std::cout) const
utility
Definition: MeasuredStar.h:84
std::lists of Stars.
Definition: StarList.h:58
void setFittedStar(std::shared_ptr< FittedStar > fittedStar)
Definition: MeasuredStar.h:79
A base class for image defects.
MeasuredStarList::const_iterator MeasuredStarCIterator
Definition: MeasuredStar.h:153
void setInstFluxAndErr(double instFlux, double instFluxErr)
Definition: MeasuredStar.h:90
double getInstFluxErr() const
Definition: MeasuredStar.h:98
objects measured on actual images.
Definition: MeasuredStar.h:46
double getMagWeight() const
the inverse of the mag variance
Definition: MeasuredStar.h:106
T move(T... args)
void setValid(bool v)
Fits may use that to discard outliers.
Definition: MeasuredStar.h:122
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:102
bool isValid() const
Fits may use that to discard outliers.
Definition: MeasuredStar.h:120
std::shared_ptr< FittedStar > getFittedStar() const
Definition: MeasuredStar.h:113
STL class.