lsst.jointcal  16.0-17-g0bdc215+5
Associations.h
Go to the documentation of this file.
1 // -*- LSST-C++ -*-
2 #ifndef LSST_JOINTCAL_ASSOCIATIONS_H
3 #define LSST_JOINTCAL_ASSOCIATIONS_H
4 
5 #include <string>
6 #include <iostream>
7 #include <list>
8 
10 #include "lsst/afw/geom/SkyWcs.h"
11 #include "lsst/afw/image/Calib.h"
14 #include "lsst/afw/geom/Box.h"
15 
16 #include "lsst/jointcal/RefStar.h"
18 #include "lsst/jointcal/CcdImage.h"
19 #include "lsst/jointcal/Point.h"
21 
23 
24 namespace lsst {
25 namespace jointcal {
26 
28 
30 class Associations {
31 public:
32  CcdImageList ccdImageList; // the catalog handlers
33  RefStarList refStarList; // e.g. GAIA or SDSS reference stars
34  FittedStarList fittedStarList; // stars that are going to be fitted
35 
36  // These are strictly speaking not needed anymore (after DM-4043),
37  // but keeping them seems cleaner then exposing the lists themselves.
38  size_t refStarListSize() { return refStarList.size(); }
39  size_t fittedStarListSize() { return fittedStarList.size(); }
40 
46  : _commonTangentPoint(Point(std::numeric_limits<double>::quiet_NaN(),
47  std::numeric_limits<double>::quiet_NaN())) {}
48 
57  Associations(CcdImageList const &imageList)
58  : ccdImageList(imageList),
59  _commonTangentPoint(Point(std::numeric_limits<double>::quiet_NaN(),
60  std::numeric_limits<double>::quiet_NaN())) {}
61 
63  Associations(Associations const &) = delete;
64  Associations(Associations &&) = delete;
65  Associations &operator=(Associations const &) = delete;
66  Associations &operator=(Associations &&) = delete;
67 
72 
78  void setCommonTangentPoint(lsst::afw::geom::Point2D const &commonTangentPoint);
79 
81  Point getCommonTangentPoint() const { return _commonTangentPoint; }
82 
99  lsst::afw::geom::Box2I const &bbox, std::string const &filter,
101  std::shared_ptr<afw::cameraGeom::Detector> detector, int visit, int ccd,
102  lsst::jointcal::JointcalControl const &control);
103 
105  void associateCatalogs(const double matchCutInArcsec = 0, const bool useFittedList = false,
106  const bool enlargeFittedList = true);
107 
120  void collectRefStars(afw::table::SimpleCatalog &refCat, afw::geom::Angle matchCut,
121  std::string const &fluxField, RefFluxMapType const &refFluxMap = RefFluxMapType(),
122  RefFluxMapType const &refFluxErrMap = RefFluxMapType(),
123  bool rejectBadFluxes = false);
124 
127  void deprojectFittedStars();
128 
130 /* If Color is "g-i", then the color is assigned from columns "g" and "i" of the colored catalog. */
131 #ifdef TODO
132  void setFittedStarColors(std::string const &dicStarListName, std::string const &color,
133  double matchCutArcSec);
134 #endif
135 
141  void prepareFittedStars(int minMeasurements);
142 
143  CcdImageList const &getCcdImageList() const { return ccdImageList; }
144 
146  unsigned getNFilters() const { return _filterMap.size(); }
147 
148  // Return the bounding box in (ra, dec) coordinates containing the whole catalog
149  const lsst::afw::geom::Box2D getRaDecBBox();
150 
154  int nCcdImagesValidForFit() const;
155 
159  size_t nFittedStarsWithAssociatedRefStar() const;
160 
161 private:
162  void associateRefStars(double matchCutInArcsec, const Gtransfo *gtransfo);
163 
164  void assignMags();
165 
171  void selectFittedStars(int minMeasurements);
172 
179  void normalizeFittedStars() const;
180 
181  // Map from filter name to index in each refStar's _refFlux/_refFluxErr vector.
183 
184  Point _commonTangentPoint;
185 };
186 
187 } // namespace jointcal
188 } // namespace lsst
189 #endif // LSST_JOINTCAL_ASSOCIATIONS_H
unsigned getNFilters() const
Number of different bands in the input image list. Not implemented so far.
Definition: Associations.h:146
int nCcdImagesValidForFit() const
return the number of CcdImages with non-empty catalogs to-be-fit.
A point in a plane.
Definition: Point.h:13
STL namespace.
Point getCommonTangentPoint() const
can be used to project sidereal coordinates related to the image set on a plane.
Definition: Associations.h:81
STL class.
The class that implements the relations between MeasuredStar and FittedStar.
Definition: Associations.h:30
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:68
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.
void collectRefStars(afw::table::SimpleCatalog &refCat, afw::geom::Angle matchCut, std::string const &fluxField, RefFluxMapType const &refFluxMap=RefFluxMapType(), RefFluxMapType const &refFluxErrMap=RefFluxMapType(), bool rejectBadFluxes=false)
Collect stars from an external reference catalog and associate them with fittedStars.
table::Key< table::Array< std::uint8_t > > wcs
Class for a simple mapping implementing a generic Gtransfo.
std::map< std::string, std::vector< double > > RefFluxMapType
Definition: Associations.h:27
void computeCommonTangentPoint()
Sets a shared tangent point for all ccdImages, using the mean of the centers of all ccdImages...
Definition: Associations.cc:52
A list of FittedStar s. Such a list is typically constructed by Associations.
Definition: FittedStar.h:99
void deprojectFittedStars()
Sends back the fitted stars coordinates on the sky FittedStarsList::inTangentPlaneCoordinates keeps t...
CcdImageList const & getCcdImageList() const
Definition: Associations.h:143
void setCommonTangentPoint(lsst::afw::geom::Point2D const &commonTangentPoint)
Sets a shared tangent point for all ccdImages.
Definition: Associations.cc:63
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:38
a virtual (interface) class for geometric transformations.
Definition: Gtransfo.h:42
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:45
table::Box2IKey bbox
Associations(CcdImageList const &imageList)
Create an Associations object from a pre-built list of ccdImages.
Definition: Associations.h:57
Associations & operator=(Associations const &)=delete
FittedStarList fittedStarList
Definition: Associations.h:34