lsst.jointcal  16.0-33-g7c26e80
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 
122  lsst::afw::geom::Box2I const &bbox, std::string const &filter,
125  lsst::jointcal::JointcalControl const &control);
126 
128  void associateCatalogs(const double matchCutInArcsec = 0, const bool useFittedList = false,
129  const bool enlargeFittedList = true);
130 
141  void collectRefStars(afw::table::SimpleCatalog &refCat, afw::geom::Angle matchCut,
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
168  const lsst::afw::geom::Box2D getRaDecBBox();
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
table::Box2IKey bbox
table::Key< int > detector
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
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
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.
table::Key< table::Array< std::uint8_t > > wcs
Class for a simple mapping implementing a generic AstrometryTransform.
table::Key< int > transform
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
void deprojectFittedStars()
Sends back the fitted stars coordinates on the sky FittedStarsList::inTangentPlaneCoordinates keeps t...
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)
Key< int > visitInfo
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
FittedStarList fittedStarList
Definition: Associations.h:57