LSST Applications g0b6bd0c080+a72a5dd7e6,g1182afd7b4+2a019aa3bb,g17e5ecfddb+2b8207f7de,g1d67935e3f+06cf436103,g38293774b4+ac198e9f13,g396055baef+6a2097e274,g3b44f30a73+6611e0205b,g480783c3b1+98f8679e14,g48ccf36440+89c08d0516,g4b93dc025c+98f8679e14,g5c4744a4d9+a302e8c7f0,g613e996a0d+e1c447f2e0,g6c8d09e9e7+25247a063c,g7271f0639c+98f8679e14,g7a9cd813b8+124095ede6,g9d27549199+a302e8c7f0,ga1cf026fa3+ac198e9f13,ga32aa97882+7403ac30ac,ga786bb30fb+7a139211af,gaa63f70f4e+9994eb9896,gabf319e997+ade567573c,gba47b54d5d+94dc90c3ea,gbec6a3398f+06cf436103,gc6308e37c7+07dd123edb,gc655b1545f+ade567573c,gcc9029db3c+ab229f5caf,gd01420fc67+06cf436103,gd877ba84e5+06cf436103,gdb4cecd868+6f279b5b48,ge2d134c3d5+cc4dbb2e3f,ge448b5faa6+86d1ceac1d,gecc7e12556+98f8679e14,gf3ee170dca+25247a063c,gf4ac96e456+ade567573c,gf9f5ea5b4d+ac198e9f13,gff490e6085+8c2580be5c,w.2022.27
LSST Data Management Base Package
Associations.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_ASSOCIATIONS_H
26#define LSST_JOINTCAL_ASSOCIATIONS_H
27
28#include <iostream>
29#include <list>
30#include <string>
31#include <utility>
32
38#include "lsst/geom/Box.h"
39#include "lsst/sphgeom/Circle.h"
40
44#include "lsst/jointcal/Point.h"
46
48
49namespace lsst {
50namespace jointcal {
51
53
56public:
57 CcdImageList ccdImageList; // the catalog handlers
58 RefStarList refStarList; // e.g. GAIA or SDSS reference stars
59 FittedStarList fittedStarList; // stars that are going to be fitted
60
61 // These are strictly speaking not needed anymore (after DM-4043),
62 // but keeping them seems cleaner then exposing the lists themselves.
63 size_t refStarListSize() { return refStarList.size(); }
64 size_t fittedStarListSize() { return fittedStarList.size(); }
65
71 : _commonTangentPoint(Point(std::numeric_limits<double>::quiet_NaN(),
72 std::numeric_limits<double>::quiet_NaN())),
73 _maxMeasuredStars(0) {}
74
84 Associations(CcdImageList imageList, double epoch = 0)
85 : ccdImageList(std::move(imageList)),
86 _commonTangentPoint(Point(std::numeric_limits<double>::quiet_NaN(),
87 std::numeric_limits<double>::quiet_NaN())),
88 _maxMeasuredStars(0),
89 _epoch(epoch) {}
90
92 Associations(Associations const &) = delete;
96
101
108 void setCommonTangentPoint(lsst::geom::Point2D const &commonTangentPoint);
109 Point getCommonTangentPoint() const { return _commonTangentPoint; }
111
113 size_t getMaxMeasuredStars() const { return _maxMeasuredStars; }
114
119 double getEpoch() const { return _epoch; }
120 void setEpoch(double epoch) { _epoch = epoch; }
122
141 const lsst::jointcal::JointcalControl &control);
142
146 void addCcdImage(std::shared_ptr<CcdImage> const& ccdImage) { ccdImageList.push_back(ccdImage); }
147
149 void associateCatalogs(double matchCutInArcsec = 0, bool useFittedList = false,
150 bool enlargeFittedList = true);
151
166 std::string const &fluxField, float refCoordinateErr, bool rejectBadFluxes = false);
167
171
177 void prepareFittedStars(int minMeasurements);
178
187 void cleanFittedStars();
188
189 CcdImageList const &getCcdImageList() const { return ccdImageList; }
190
192 unsigned getNFilters() const { return 1; }
193
201
205 int nCcdImagesValidForFit() const;
206
211
212private:
213 void associateRefStars(double matchCutInArcsec, const AstrometryTransform *transform);
214
215 void assignMags();
216
222 void selectFittedStars(int minMeasurements);
223
230 void normalizeFittedStars();
231
232 // Common tangent point on-sky of all of the ccdImages, typically determined by computeCommonTangentPoint.
233 // (decimal degrees)
234 Point _commonTangentPoint;
235
236 // The number of MeasuredStars at the start of fitting, before any outliers are removed.
237 // This is used to reserve space in vectors for e.g. outlier removal, but is not updated during outlier
238 // removal or cleanup, so should only be used as an upper bound on the number of MeasuredStars.
239 size_t _maxMeasuredStars;
240
241 // Julian Epoch Year (e.g. 2000.0 for J2000)
242 // Common epoch of all of the ccdImages, typically computed externally via astropy and then set.
243 double _epoch{};
244};
245
246} // namespace jointcal
247} // namespace lsst
248#endif // LSST_JOINTCAL_ASSOCIATIONS_H
AmpInfoBoxKey bbox
Definition: Amplifier.cc:117
This file declares a class for representing circular regions on the unit sphere.
table::Key< int > detector
table::Key< table::Array< std::uint8_t > > wcs
Definition: SkyWcs.cc:66
table::Key< int > transform
Custom catalog class for record/table subclasses that are guaranteed to have an ID,...
Definition: SortedCatalog.h:42
A class representing an angle.
Definition: Angle.h:128
An integer coordinate rectangle.
Definition: Box.h:55
The class that implements the relations between MeasuredStar and FittedStar.
Definition: Associations.h:55
size_t nFittedStarsWithAssociatedRefStar() const
Return the number of fittedStars that have an associated refStar.
void cleanFittedStars()
Remove FittedStars that have no measured stars; this can happen after outlier rejection.
void computeCommonTangentPoint()
Sets a shared tangent point for all ccdImages, using the mean of the centers of all ccdImages.
Definition: Associations.cc:74
Associations()
Source selection is performed in python, so Associations' constructor only initializes a couple of va...
Definition: Associations.h:70
CcdImageList const & getCcdImageList() const
Definition: Associations.h:189
lsst::sphgeom::Circle computeBoundingCircle() const
Return the bounding circle in on-sky (RA, Dec) coordinates containing all CcdImages.
Definition: Associations.cc:90
Associations & operator=(Associations const &)=delete
int nCcdImagesValidForFit() const
return the number of CcdImages with non-empty catalogs to-be-fit.
Associations(Associations const &)=delete
No moves or copies: jointcal only ever needs one Associations object.
void setEpoch(double epoch)
Common epoch of all of the ccdImages as a Julian Epoch Year (e.g.
Definition: Associations.h:120
void addCcdImage(std::shared_ptr< CcdImage > const &ccdImage)
Add a pre-constructed ccdImage to the ccdImageList.
Definition: Associations.h:146
void createCcdImage(afw::table::SourceCatalog &catalog, const std::shared_ptr< lsst::afw::geom::SkyWcs > &wcs, const std::shared_ptr< lsst::afw::image::VisitInfo > &visitInfo, const lsst::geom::Box2I &bbox, const std::string &filter, const std::shared_ptr< afw::image::PhotoCalib > &photoCalib, const std::shared_ptr< afw::cameraGeom::Detector > &detector, int visit, int ccd, const lsst::jointcal::JointcalControl &control)
Create a ccdImage from an exposure catalog and metadata, and add it to the list.
Definition: Associations.cc:62
unsigned getNFilters() const
Number of different bands in the input image list. Not implemented so far.
Definition: Associations.h:192
Associations(Associations &&)=delete
size_t getMaxMeasuredStars() const
The number of MeasuredStars at the start of fitting, before any outliers are removed.
Definition: Associations.h:113
void associateCatalogs(double matchCutInArcsec=0, bool useFittedList=false, bool enlargeFittedList=true)
incrementaly builds a merged catalog of all image catalogs
void setCommonTangentPoint(lsst::geom::Point2D const &commonTangentPoint)
Shared tangent point for all ccdImages (decimal degrees).
Definition: Associations.cc:85
Associations(CcdImageList imageList, double epoch=0)
Create an Associations object from a pre-built list of ccdImages.
Definition: Associations.h:84
double getEpoch() const
Common epoch of all of the ccdImages as a Julian Epoch Year (e.g.
Definition: Associations.h:119
Point getCommonTangentPoint() const
Shared tangent point for all ccdImages (decimal degrees).
Definition: Associations.h:109
void collectRefStars(afw::table::SimpleCatalog &refCat, geom::Angle matchCut, std::string const &fluxField, float refCoordinateErr, bool rejectBadFluxes=false)
Collect stars from an external reference catalog and associate them with fittedStars.
FittedStarList fittedStarList
Definition: Associations.h:59
Associations & operator=(Associations &&)=delete
void prepareFittedStars(int minMeasurements)
Prepare the fittedStar list by making quality cuts and normalizing measurements.
void deprojectFittedStars()
Sends back the fitted stars coordinates on the sky FittedStarsList::inTangentPlaneCoordinates keeps t...
a virtual (interface) class for geometric transformations.
A list of FittedStar s. Such a list is typically constructed by Associations.
Definition: FittedStar.h:116
A point in a plane.
Definition: Point.h:37
Circle is a circular region on the unit sphere that contains its boundary.
Definition: Circle.h:46
T move(T... args)
A base class for image defects.
STL namespace.
T push_back(T... args)
T size(T... args)
Key< int > visitInfo
Definition: Exposure.cc:70
Key< int > photoCalib
Definition: Exposure.cc:67