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
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 
32 #include "lsst/afw/table/Source.h"
33 #include "lsst/afw/geom/SkyWcs.h"
34 #include "lsst/afw/image/Calib.h"
37 #include "lsst/afw/geom/Box.h"
38 
39 #include "lsst/jointcal/RefStar.h"
41 #include "lsst/jointcal/CcdImage.h"
42 #include "lsst/jointcal/Point.h"
44 
46 
47 namespace lsst {
48 namespace jointcal {
49 
51 
53 class Associations {
54 public:
55  CcdImageList ccdImageList; // the catalog handlers
56  RefStarList refStarList; // e.g. GAIA or SDSS reference stars
57  FittedStarList fittedStarList; // stars that are going to be fitted
58 
59  // These are strictly speaking not needed anymore (after DM-4043),
60  // but keeping them seems cleaner then exposing the lists themselves.
61  size_t refStarListSize() { return refStarList.size(); }
62  size_t fittedStarListSize() { return fittedStarList.size(); }
63 
69  : _commonTangentPoint(Point(std::numeric_limits<double>::quiet_NaN(),
70  std::numeric_limits<double>::quiet_NaN())) {}
71 
80  Associations(CcdImageList const &imageList)
81  : ccdImageList(imageList),
82  _commonTangentPoint(Point(std::numeric_limits<double>::quiet_NaN(),
83  std::numeric_limits<double>::quiet_NaN())) {}
84 
86  Associations(Associations const &) = delete;
87  Associations(Associations &&) = delete;
88  Associations &operator=(Associations const &) = delete;
89  Associations &operator=(Associations &&) = delete;
90 
95 
101  void setCommonTangentPoint(lsst::afw::geom::Point2D const &commonTangentPoint);
102 
104  Point getCommonTangentPoint() const { return _commonTangentPoint; }
105 
125  lsst::jointcal::JointcalControl const &control);
126 
128  void associateCatalogs(const double matchCutInArcsec = 0, const bool useFittedList = false,
129  const bool enlargeFittedList = true);
130 
142  std::string const &fluxField, bool rejectBadFluxes = false);
143 
146  void deprojectFittedStars();
147 
149 /* If Color is "g-i", then the color is assigned from columns "g" and "i" of the colored catalog. */
150 #ifdef TODO
151  void setFittedStarColors(std::string const &dicStarListName, std::string const &color,
152  double matchCutArcSec);
153 #endif
154 
160  void prepareFittedStars(int minMeasurements);
161 
162  CcdImageList const &getCcdImageList() const { return ccdImageList; }
163 
165  unsigned getNFilters() const { return 1; }
166 
167  // Return the bounding box in (ra, dec) coordinates containing the whole catalog
169 
173  int nCcdImagesValidForFit() const;
174 
178  size_t nFittedStarsWithAssociatedRefStar() const;
179 
180 private:
181  void associateRefStars(double matchCutInArcsec, const AstrometryTransform *transform);
182 
183  void assignMags();
184 
190  void selectFittedStars(int minMeasurements);
191 
198  void normalizeFittedStars() const;
199 
200  Point _commonTangentPoint;
201 };
202 
203 } // namespace jointcal
204 } // namespace lsst
205 #endif // LSST_JOINTCAL_ASSOCIATIONS_H
unsigned getNFilters() const
Number of different bands in the input image list. Not implemented so far.
Definition: Associations.h:165
int nCcdImagesValidForFit() const
return the number of CcdImages with non-empty catalogs to-be-fit.
A point in a plane.
Definition: Point.h:36
A floating-point coordinate rectangle geometry.
Definition: Box.h:294
STL namespace.
Point getCommonTangentPoint() const
can be used to project sidereal coordinates related to the image set on a plane.
Definition: Associations.h:104
STL class.
The class that implements the relations between MeasuredStar and FittedStar.
Definition: Associations.h:53
A class representing an angle.
Definition: Angle.h:127
void associateCatalogs(const double matchCutInArcsec=0, const bool useFittedList=false, const bool enlargeFittedList=true)
incrementaly builds a merged catalog of all image catalogs
Definition: Associations.cc:88
table::Key< table::Array< std::uint8_t > > wcs
Definition: SkyWcs.cc:71
STL class.
void prepareFittedStars(int minMeasurements)
Set the color field of FittedStar &#39;s from a colored catalog.
void collectRefStars(afw::table::SimpleCatalog &refCat, afw::geom::Angle matchCut, std::string const &fluxField, bool rejectBadFluxes=false)
Collect stars from an external reference catalog and associate them with fittedStars.
size_t nFittedStarsWithAssociatedRefStar() const
Return the number of fittedStars that have an associated refStar.
A base class for image defects.
Custom catalog class for record/table subclasses that are guaranteed to have an ID, and should generally be sorted by that ID.
Definition: fwd.h:63
void computeCommonTangentPoint()
Sets a shared tangent point for all ccdImages, using the mean of the centers of all ccdImages...
Definition: Associations.cc:72
A list of FittedStar s. Such a list is typically constructed by Associations.
Definition: FittedStar.h:122
table::Key< int > detector
void deprojectFittedStars()
Sends back the fitted stars coordinates on the sky FittedStarsList::inTangentPlaneCoordinates keeps t...
table::Box2IKey bbox
Definition: Detector.cc:166
CcdImageList const & getCcdImageList() const
Definition: Associations.h:162
void setCommonTangentPoint(lsst::afw::geom::Point2D const &commonTangentPoint)
Sets a shared tangent point for all ccdImages.
Definition: Associations.cc:83
T size(T... args)
void createCcdImage(afw::table::SourceCatalog &catalog, std::shared_ptr< lsst::afw::geom::SkyWcs > wcs, std::shared_ptr< lsst::afw::image::VisitInfo > visitInfo, lsst::afw::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:58
a virtual (interface) class for geometric transformations.
const lsst::afw::geom::Box2D getRaDecBBox()
Associations()
Source selection is performed in python, so Associations&#39; constructor only initializes a couple of va...
Definition: Associations.h:68
Associations(CcdImageList const &imageList)
Create an Associations object from a pre-built list of ccdImages.
Definition: Associations.h:80
Associations & operator=(Associations const &)=delete
An integer coordinate rectangle.
Definition: Box.h:54
FittedStarList fittedStarList
Definition: Associations.h:57