lsst.jointcal  master-gc7bdbdc8f0
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/image/TanWcs.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 
79  std::string const &filter, std::shared_ptr<afw::image::PhotoCalib> photoCalib,
80  std::shared_ptr<afw::cameraGeom::Detector> detector, int visit, int ccd,
81  lsst::jointcal::JointcalControl const &control);
82 
84  void associateCatalogs(const double matchCutInArcsec = 0, const bool useFittedList = false,
85  const bool enlargeFittedList = true);
86 
98  afw::geom::Angle matchCut, std::string const &fluxField,
99  std::map<std::string, std::vector<double>> const &refFluxMap,
100  std::map<std::string, std::vector<double>> const &refFluxErrMap);
101 
104  void deprojectFittedStars();
105 
107 /* If Color is "g-i", then the color is assigned from columns "g" and "i" of the colored catalog. */
108 #ifdef TODO
109  void setFittedStarColors(std::string const &dicStarListName, std::string const &color,
110  double matchCutArcSec);
111 #endif
112 
118  void selectFittedStars(int minMeasurements);
119 
120  CcdImageList const &getCcdImageList() const { return ccdImageList; }
121 
123  unsigned getNFilters() const { return _filterMap.size(); }
124 
125  // Return the bounding box in (ra, dec) coordinates containing the whole catalog
127 
131  int nCcdImagesValidForFit() const {
132  return std::count_if(
133  ccdImageList.begin(), ccdImageList.end(),
134  [](std::shared_ptr<CcdImage> const &item) { return item->getCatalogForFit().size() > 0; });
135  }
136 
137 private:
138  void associateRefStars(double matchCutInArcsec, const Gtransfo *gtransfo);
139 
140  void assignMags();
141 
142  // Map from filter name to index in each refStar's _refFlux/_refFluxErr vector.
144 
145  Point _commonTangentPoint;
146 };
147 
148 } // namespace jointcal
149 } // namespace lsst
150 #endif // LSST_JOINTCAL_ASSOCIATIONS_H
unsigned getNFilters() const
Number of different bands in the input image list. Not implemented so far.
Definition: Associations.h:123
int nCcdImagesValidForFit() const
return the number of CcdImages with non-empty catalogs to-be-fit.
Definition: Associations.h:131
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
T end(T... args)
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:56
STL class.
void selectFittedStars(int minMeasurements)
Set the color field of FittedStar &#39;s from a colored catalog.
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)
Collect stars from an external reference catalog and associate them with fittedStars.
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:120
T count_if(T... args)
void setCommonTangentPoint(lsst::afw::geom::Point2D const &commonTangentPoint)
Sets a shared tangent point for all ccdImages.
Definition: Associations.cc:51
T size(T... args)
T begin(T... args)
a virtual (interface) class for geometric transformations.
Definition: Gtransfo.h:39
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
Associations & operator=(Associations const &)=delete
FittedStarList fittedStarList
Definition: Associations.h:32
void addImage(lsst::afw::table::SortedCatalogT< lsst::afw::table::SourceRecord > &catalog, std::shared_ptr< lsst::afw::image::TanWcs > 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:37