lsst.jointcal  15.0
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 class Associations {
29 public:
30  CcdImageList ccdImageList; // the catalog handlers
31  RefStarList refStarList; // e.g. GAIA or SDSS reference stars
32  FittedStarList fittedStarList; // stars that are going to be fitted
33 
34  // These are strictly speaking not needed anymore (after DM-4043),
35  // but keeping them seems cleaner then exposing the lists themselves.
36  size_t refStarListSize() { return refStarList.size(); }
37  size_t fittedStarListSize() { return fittedStarList.size(); }
38 
44  : _commonTangentPoint(Point(std::numeric_limits<double>::quiet_NaN(),
45  std::numeric_limits<double>::quiet_NaN())) {}
46 
48  Associations(Associations const &) = delete;
49  Associations(Associations &&) = delete;
50  Associations &operator=(Associations const &) = delete;
51  Associations &operator=(Associations &&) = delete;
52 
58  void setCommonTangentPoint(lsst::afw::geom::Point2D const &commonTangentPoint);
59 
61  Point getCommonTangentPoint() const { return _commonTangentPoint; }
62 
80  std::string const &filter, std::shared_ptr<afw::image::PhotoCalib> photoCalib,
81  std::shared_ptr<afw::cameraGeom::Detector> detector, int visit, int ccd,
82  lsst::jointcal::JointcalControl const &control);
83 
85  void associateCatalogs(const double matchCutInArcsec = 0, const bool useFittedList = false,
86  const bool enlargeFittedList = true);
87 
101  afw::geom::Angle matchCut, std::string const &fluxField,
102  std::map<std::string, std::vector<double>> const &refFluxMap,
103  std::map<std::string, std::vector<double>> const &refFluxErrMap,
104  bool rejectBadFluxes = false);
105 
108  void deprojectFittedStars();
109 
111 /* If Color is "g-i", then the color is assigned from columns "g" and "i" of the colored catalog. */
112 #ifdef TODO
113  void setFittedStarColors(std::string const &dicStarListName, std::string const &color,
114  double matchCutArcSec);
115 #endif
116 
122  void prepareFittedStars(int minMeasurements);
123 
124  CcdImageList const &getCcdImageList() const { return ccdImageList; }
125 
127  unsigned getNFilters() const { return _filterMap.size(); }
128 
129  // Return the bounding box in (ra, dec) coordinates containing the whole catalog
131 
135  int nCcdImagesValidForFit() const;
136 
140  size_t nFittedStarsWithAssociatedRefStar() const;
141 
142 private:
143  void associateRefStars(double matchCutInArcsec, const Gtransfo *gtransfo);
144 
145  void assignMags();
146 
152  void selectFittedStars(int minMeasurements);
153 
160  void normalizeFittedStars() const;
161 
162  // Map from filter name to index in each refStar's _refFlux/_refFluxErr vector.
164 
165  Point _commonTangentPoint;
166 };
167 
168 } // namespace jointcal
169 } // namespace lsst
170 #endif // LSST_JOINTCAL_ASSOCIATIONS_H
unsigned getNFilters() const
Number of different bands in the input image list. Not implemented so far.
Definition: Associations.h:127
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.
tbl::Key< int > wcs
Point getCommonTangentPoint() const
can be used to project sidereal coordinates related to the image set on a plane.
Definition: Associations.h:61
STL class.
The class that implements the relations between MeasuredStar and FittedStar.
Definition: Associations.h:28
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:57
void collectRefStars(lsst::afw::table::SortedCatalogT< lsst::afw::table::SimpleRecord > &refCat, afw::geom::Angle matchCut, std::string const &fluxField, std::map< std::string, std::vector< double >> const &refFluxMap, std::map< std::string, std::vector< double >> const &refFluxErrMap, bool rejectBadFluxes=false)
Collect stars from an external reference catalog and associate them with fittedStars.
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.
Class for a simple mapping implementing a generic Gtransfo.
A list of FittedStar s. Such a list is typically constructed by Associations.
Definition: FittedStar.h:121
void deprojectFittedStars()
Sends back the fitted stars coordinates on the sky FittedStarsList::inTangentPlaneCoordinates keeps t...
CcdImageList const & getCcdImageList() const
Definition: Associations.h:124
void setCommonTangentPoint(lsst::afw::geom::Point2D const &commonTangentPoint)
Sets a shared tangent point for all ccdImages.
Definition: Associations.cc:52
T size(T... args)
void addImage(lsst::afw::table::SortedCatalogT< lsst::afw::table::SourceRecord > &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:41
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:43
table::Box2IKey bbox
Associations & operator=(Associations const &)=delete
FittedStarList fittedStarList
Definition: Associations.h:32