lsst.jointcal g33d62baed8+4eef92c78d
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 <string>
29#include <iostream>
30#include <list>
31
37#include "lsst/geom/Box.h"
38#include "lsst/sphgeom/Circle.h"
39
43#include "lsst/jointcal/Point.h"
45
47
48namespace lsst {
49namespace jointcal {
50
52
55public:
56 CcdImageList ccdImageList; // the catalog handlers
57 RefStarList refStarList; // e.g. GAIA or SDSS reference stars
58 FittedStarList fittedStarList; // stars that are going to be fitted
59
60 // These are strictly speaking not needed anymore (after DM-4043),
61 // but keeping them seems cleaner then exposing the lists themselves.
62 size_t refStarListSize() { return refStarList.size(); }
63 size_t fittedStarListSize() { return fittedStarList.size(); }
64
70 : _commonTangentPoint(Point(std::numeric_limits<double>::quiet_NaN(),
71 std::numeric_limits<double>::quiet_NaN())),
72 _maxMeasuredStars(0) {}
73
83 Associations(CcdImageList const &imageList, double epoch = 0)
84 : ccdImageList(imageList),
85 _commonTangentPoint(Point(std::numeric_limits<double>::quiet_NaN(),
86 std::numeric_limits<double>::quiet_NaN())),
87 _maxMeasuredStars(0),
88 _epoch(epoch) {}
89
91 Associations(Associations const &) = delete;
95
100
107 void setCommonTangentPoint(lsst::geom::Point2D const &commonTangentPoint);
108 Point getCommonTangentPoint() const { return _commonTangentPoint; }
110
112 size_t getMaxMeasuredStars() const { return _maxMeasuredStars; }
113
118 double getEpoch() const { return _epoch; }
119 void setEpoch(double epoch) { _epoch = epoch; }
121
139 std::shared_ptr<afw::cameraGeom::Detector> detector, int visit, int ccd,
140 lsst::jointcal::JointcalControl const &control);
141
146
148 void associateCatalogs(const double matchCutInArcsec = 0, const bool useFittedList = false,
149 const bool enlargeFittedList = true);
150
165 std::string const &fluxField, float refCoordinateErr, bool rejectBadFluxes = false);
166
170
176 void prepareFittedStars(int minMeasurements);
177
186 void cleanFittedStars();
187
188 CcdImageList const &getCcdImageList() const { return ccdImageList; }
189
191 unsigned getNFilters() const { return 1; }
192
200
204 int nCcdImagesValidForFit() const;
205
210
211private:
212 void associateRefStars(double matchCutInArcsec, const AstrometryTransform *transform);
213
214 void assignMags();
215
221 void selectFittedStars(int minMeasurements);
222
229 void normalizeFittedStars();
230
231 // Common tangent point on-sky of all of the ccdImages, typically determined by computeCommonTangentPoint.
232 // (decimal degrees)
233 Point _commonTangentPoint;
234
235 // The number of MeasuredStars at the start of fitting, before any outliers are removed.
236 // This is used to reserve space in vectors for e.g. outlier removal, but is not updated during outlier
237 // removal or cleanup, so should only be used as an upper bound on the number of MeasuredStars.
238 size_t _maxMeasuredStars;
239
240 // Julian Epoch Year (e.g. 2000.0 for J2000)
241 // Common epoch of all of the ccdImages, typically computed externally via astropy and then set.
242 double _epoch;
243};
244
245} // namespace jointcal
246} // namespace lsst
247#endif // LSST_JOINTCAL_ASSOCIATIONS_H
The class that implements the relations between MeasuredStar and FittedStar.
Definition: Associations.h:54
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:69
CcdImageList const & getCcdImageList() const
Definition: Associations.h:188
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:119
Associations(CcdImageList const &imageList, double epoch=0)
Create an Associations object from a pre-built list of ccdImages.
Definition: Associations.h:83
void createCcdImage(afw::table::SourceCatalog &catalog, std::shared_ptr< lsst::afw::geom::SkyWcs > wcs, std::shared_ptr< lsst::afw::image::VisitInfo > visitInfo, lsst::geom::Box2I const &bbox, std::string const &filter, std::shared_ptr< afw::image::PhotoCalib > photoCalib, std::shared_ptr< afw::cameraGeom::Detector > detector, int visit, int ccd, lsst::jointcal::JointcalControl const &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:191
Associations(Associations &&)=delete
size_t getMaxMeasuredStars() const
The number of MeasuredStars at the start of fitting, before any outliers are removed.
Definition: Associations.h:112
void setCommonTangentPoint(lsst::geom::Point2D const &commonTangentPoint)
Shared tangent point for all ccdImages (decimal degrees).
Definition: Associations.cc:85
void associateCatalogs(const double matchCutInArcsec=0, const bool useFittedList=false, const bool enlargeFittedList=true)
incrementaly builds a merged catalog of all image catalogs
double getEpoch() const
Common epoch of all of the ccdImages as a Julian Epoch Year (e.g.
Definition: Associations.h:118
Point getCommonTangentPoint() const
Shared tangent point for all ccdImages (decimal degrees).
Definition: Associations.h:108
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:58
Associations & operator=(Associations &&)=delete
void prepareFittedStars(int minMeasurements)
Prepare the fittedStar list by making quality cuts and normalizing measurements.
void addCcdImage(std::shared_ptr< CcdImage > const ccdImage)
Add a pre-constructed ccdImage to the ccdImageList.
Definition: Associations.h:145
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
Class for a simple mapping implementing a generic AstrometryTransform.
STL namespace.
T push_back(T... args)
T size(T... args)