LSSTApplications  18.0.0+106,18.0.0+50,19.0.0,19.0.0+1,19.0.0+10,19.0.0+11,19.0.0+13,19.0.0+17,19.0.0+2,19.0.0-1-g20d9b18+6,19.0.0-1-g425ff20,19.0.0-1-g5549ca4,19.0.0-1-g580fafe+6,19.0.0-1-g6fe20d0+1,19.0.0-1-g7011481+9,19.0.0-1-g8c57eb9+6,19.0.0-1-gb5175dc+11,19.0.0-1-gdc0e4a7+9,19.0.0-1-ge272bc4+6,19.0.0-1-ge3aa853,19.0.0-10-g448f008b,19.0.0-12-g6990b2c,19.0.0-2-g0d9f9cd+11,19.0.0-2-g3d9e4fb2+11,19.0.0-2-g5037de4,19.0.0-2-gb96a1c4+3,19.0.0-2-gd955cfd+15,19.0.0-3-g2d13df8,19.0.0-3-g6f3c7dc,19.0.0-4-g725f80e+11,19.0.0-4-ga671dab3b+1,19.0.0-4-gad373c5+3,19.0.0-5-ga2acb9c+2,19.0.0-5-gfe96e6c+2,w.2020.01
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/geom/Box.h"
38 #include "lsst/sphgeom/Circle.h"
39 
40 #include "lsst/jointcal/RefStar.h"
42 #include "lsst/jointcal/CcdImage.h"
43 #include "lsst/jointcal/Point.h"
45 
47 
48 namespace lsst {
49 namespace jointcal {
50 
52 
54 class Associations {
55 public:
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 
81  Associations(CcdImageList const &imageList)
82  : ccdImageList(imageList),
83  _commonTangentPoint(Point(std::numeric_limits<double>::quiet_NaN(),
84  std::numeric_limits<double>::quiet_NaN())) {}
85 
87  Associations(Associations const &) = delete;
88  Associations(Associations &&) = delete;
89  Associations &operator=(Associations const &) = delete;
90  Associations &operator=(Associations &&) = delete;
91 
96 
102  void setCommonTangentPoint(lsst::geom::Point2D const &commonTangentPoint);
103 
105  Point getCommonTangentPoint() const { return _commonTangentPoint; }
106 
123  lsst::geom::Box2I const &bbox, std::string const &filter,
126  lsst::jointcal::JointcalControl const &control);
127 
131  void addCcdImage(std::shared_ptr<CcdImage> const ccdImage) { ccdImageList.push_back(ccdImage); }
132 
134  void associateCatalogs(const double matchCutInArcsec = 0, const bool useFittedList = false,
135  const bool enlargeFittedList = true);
136 
151  std::string const &fluxField, float refCoordinateErr, bool rejectBadFluxes = false);
152 
155  void deprojectFittedStars();
156 
158 /* If Color is "g-i", then the color is assigned from columns "g" and "i" of the colored catalog. */
159 #ifdef TODO
160  void setFittedStarColors(std::string const &dicStarListName, std::string const &color,
161  double matchCutArcSec);
162 #endif
163 
169  void prepareFittedStars(int minMeasurements);
170 
171  CcdImageList const &getCcdImageList() const { return ccdImageList; }
172 
174  unsigned getNFilters() const { return 1; }
175 
183 
187  int nCcdImagesValidForFit() const;
188 
192  size_t nFittedStarsWithAssociatedRefStar() const;
193 
194 private:
195  void associateRefStars(double matchCutInArcsec, const AstrometryTransform *transform);
196 
197  void assignMags();
198 
204  void selectFittedStars(int minMeasurements);
205 
212  void normalizeFittedStars() const;
213 
214  Point _commonTangentPoint;
215 };
216 
217 } // namespace jointcal
218 } // namespace lsst
219 #endif // LSST_JOINTCAL_ASSOCIATIONS_H
AmpInfoBoxKey bbox
Definition: Amplifier.cc:117
This file declares a class for representing circular regions on the unit sphere.
unsigned getNFilters() const
Number of different bands in the input image list. Not implemented so far.
Definition: Associations.h:174
int nCcdImagesValidForFit() const
return the number of CcdImages with non-empty catalogs to-be-fit.
A point in a plane.
Definition: Point.h:36
STL namespace.
Point getCommonTangentPoint() const
can be used to project sidereal coordinates related to the image set on a plane.
Definition: Associations.h:105
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
STL class.
The class that implements the relations between MeasuredStar and FittedStar.
Definition: Associations.h:54
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
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.
size_t nFittedStarsWithAssociatedRefStar() const
Return the number of fittedStars that have an associated refStar.
T push_back(T... args)
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:76
A list of FittedStar s. Such a list is typically constructed by Associations.
Definition: FittedStar.h:123
table::Key< int > detector
void deprojectFittedStars()
Sends back the fitted stars coordinates on the sky FittedStarsList::inTangentPlaneCoordinates keeps t...
CcdImageList const & getCcdImageList() const
Definition: Associations.h:171
Circle is a circular region on the unit sphere that contains its boundary.
Definition: Circle.h:46
T size(T... args)
void setCommonTangentPoint(lsst::geom::Point2D const &commonTangentPoint)
Sets a shared tangent point for all ccdImages.
Definition: Associations.cc:87
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.
a virtual (interface) class for geometric transformations.
Associations()
Source selection is performed in python, so Associations&#39; constructor only initializes a couple of va...
Definition: Associations.h:69
Associations(CcdImageList const &imageList)
Create an Associations object from a pre-built list of ccdImages.
Definition: Associations.h:81
lsst::sphgeom::Circle computeBoundingCircle() const
Return the bounding circle in on-sky (RA, Dec) coordinates containing all CcdImages.
Definition: Associations.cc:92
Associations & operator=(Associations const &)=delete
An integer coordinate rectangle.
Definition: Box.h:55
void addCcdImage(std::shared_ptr< CcdImage > const ccdImage)
Add a pre-constructed ccdImage to the ccdImageList.
Definition: Associations.h:131
FittedStarList fittedStarList
Definition: Associations.h:58