LSST Applications g180d380827+0f66a164bb,g2079a07aa2+86d27d4dc4,g2305ad1205+7d304bc7a0,g29320951ab+500695df56,g2bbee38e9b+0e5473021a,g337abbeb29+0e5473021a,g33d1c0ed96+0e5473021a,g3a166c0a6a+0e5473021a,g3ddfee87b4+e42ea45bea,g48712c4677+36a86eeaa5,g487adcacf7+2dd8f347ac,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+c70619cc9d,g5a732f18d5+53520f316c,g5ea96fc03c+341ea1ce94,g64a986408d+f7cd9c7162,g858d7b2824+f7cd9c7162,g8a8a8dda67+585e252eca,g99cad8db69+469ab8c039,g9ddcbc5298+9a081db1e4,ga1e77700b3+15fc3df1f7,gb0e22166c9+60f28cb32d,gba4ed39666+c2a2e4ac27,gbb8dafda3b+c92fc63c7e,gbd866b1f37+f7cd9c7162,gc120e1dc64+02c66aa596,gc28159a63d+0e5473021a,gc3e9b769f7+b0068a2d9f,gcf0d15dbbd+e42ea45bea,gdaeeff99f8+f9a426f77a,ge6526c86ff+84383d05b3,ge79ae78c31+0e5473021a,gee10cc3b42+585e252eca,gff1a9f87cc+f7cd9c7162,w.2024.17
LSST Data Management Base Package
Loading...
Searching...
No Matches
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
139 const std::string &filter, const std::shared_ptr<afw::image::PhotoCalib>& photoCalib,
140 const std::shared_ptr<afw::cameraGeom::Detector>& detector, int visit, int ccd,
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.
Custom catalog class for record/table subclasses that are guaranteed to have an ID,...
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.
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.
Associations()
Source selection is performed in python, so Associations' constructor only initializes a couple of va...
CcdImageList const & getCcdImageList() const
lsst::sphgeom::Circle computeBoundingCircle() const
Return the bounding circle in on-sky (RA, Dec) coordinates containing all CcdImages.
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.
void addCcdImage(std::shared_ptr< CcdImage > const &ccdImage)
Add a pre-constructed ccdImage to the ccdImageList.
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.
unsigned getNFilters() const
Number of different bands in the input image list. Not implemented so far.
Associations(Associations &&)=delete
size_t getMaxMeasuredStars() const
The number of MeasuredStars at the start of fitting, before any outliers are removed.
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).
Associations(CcdImageList imageList, double epoch=0)
Create an Associations object from a pre-built list of ccdImages.
double getEpoch() const
Common epoch of all of the ccdImages as a Julian Epoch Year (e.g.
Point getCommonTangentPoint() const
Shared tangent point for all ccdImages (decimal degrees).
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.
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:53
T move(T... args)
STL namespace.
T push_back(T... args)
T size(T... args)
Key< int > visitInfo
Definition Exposure.cc:70