LSST Applications  21.0.0+04719a4bac,21.0.0-1-ga51b5d4+f5e6047307,21.0.0-11-g2b59f77+a9c1acf22d,21.0.0-11-ga42c5b2+86977b0b17,21.0.0-12-gf4ce030+76814010d2,21.0.0-13-g1721dae+760e7a6536,21.0.0-13-g3a573fe+768d78a30a,21.0.0-15-g5a7caf0+f21cbc5713,21.0.0-16-g0fb55c1+b60e2d390c,21.0.0-19-g4cded4ca+71a93a33c0,21.0.0-2-g103fe59+bb20972958,21.0.0-2-g45278ab+04719a4bac,21.0.0-2-g5242d73+3ad5d60fb1,21.0.0-2-g7f82c8f+8babb168e8,21.0.0-2-g8f08a60+06509c8b61,21.0.0-2-g8faa9b5+616205b9df,21.0.0-2-ga326454+8babb168e8,21.0.0-2-gde069b7+5e4aea9c2f,21.0.0-2-gecfae73+1d3a86e577,21.0.0-2-gfc62afb+3ad5d60fb1,21.0.0-25-g1d57be3cd+e73869a214,21.0.0-3-g357aad2+ed88757d29,21.0.0-3-g4a4ce7f+3ad5d60fb1,21.0.0-3-g4be5c26+3ad5d60fb1,21.0.0-3-g65f322c+e0b24896a3,21.0.0-3-g7d9da8d+616205b9df,21.0.0-3-ge02ed75+a9c1acf22d,21.0.0-4-g591bb35+a9c1acf22d,21.0.0-4-g65b4814+b60e2d390c,21.0.0-4-gccdca77+0de219a2bc,21.0.0-4-ge8a399c+6c55c39e83,21.0.0-5-gd00fb1e+05fce91b99,21.0.0-6-gc675373+3ad5d60fb1,21.0.0-64-g1122c245+4fb2b8f86e,21.0.0-7-g04766d7+cd19d05db2,21.0.0-7-gdf92d54+04719a4bac,21.0.0-8-g5674e7b+d1bd76f71f,master-gac4afde19b+a9c1acf22d,w.2021.13
LSST Data Management Base Package
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
table::Key< int > id
Definition: Detector.cc:162
The base class for handling stars. Used by all matching routines.
Definition: BaseStar.h:50
virtual void print(std::ostream &out) const
utility
Definition: BaseStar.h:82
Handler of an actual image from a single CCD.
Definition: CcdImage.h:64
objects measured on actual images.
Definition: MeasuredStar.h:46
afw::table::RecordId getId()
Definition: MeasuredStar.h:103
void setFittedStar(std::shared_ptr< FittedStar > fittedStar)
Definition: MeasuredStar.h:79
MeasuredStar(MeasuredStar const &)=default
No move, allow copy constructor: we may copy the fitted StarLists when associating and matching catal...
void setValid(bool v)
Fits may use that to discard outliers.
Definition: MeasuredStar.h:122
bool isValid() const
Fits may use that to discard outliers.
Definition: MeasuredStar.h:120
void setXFocal(double xFocal)
Definition: MeasuredStar.h:109
void setCcdImage(const CcdImage *ccdImage)
Definition: MeasuredStar.h:117
std::shared_ptr< FittedStar > getFittedStar() const
Definition: MeasuredStar.h:113
void setInstFluxAndErr(double instFlux, double instFluxErr)
Definition: MeasuredStar.h:90
MeasuredStar(MeasuredStar &&)=delete
MeasuredStar & operator=(MeasuredStar &&)=delete
CcdImage const & getCcdImage() const
Definition: MeasuredStar.h:115
double getInstFluxErr() const
Definition: MeasuredStar.h:98
void setYFocal(double yFocal)
Definition: MeasuredStar.h:111
double getMagWeight() const
the inverse of the mag variance
Definition: MeasuredStar.h:106
MeasuredStar(BaseStar const &baseStar)
Definition: MeasuredStar.h:60
void print(std::ostream &out) const
utility
Definition: MeasuredStar.h:84
MeasuredStar & operator=(MeasuredStar const &)=delete
void setId(afw::table::RecordId id)
Definition: MeasuredStar.h:102
A list of MeasuredStar. They are usually filled in Associations::createCcdImage.
Definition: MeasuredStar.h:146
void setCcdImage(const CcdImage *_ccdImage)
Definition: MeasuredStar.cc:68
std::lists of Stars.
Definition: StarList.h:58
T log10(T... args)
T move(T... args)
BaseStarList & Measured2Base(MeasuredStarList &This)
Definition: MeasuredStar.cc:58
MeasuredStarList::iterator MeasuredStarIterator
Definition: MeasuredStar.h:154
MeasuredStarList::const_iterator MeasuredStarCIterator
Definition: MeasuredStar.h:153
A base class for image defects.