lsst.jointcal  master-g9041cab851+12
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 
9 #include "lsst/afw/table/Source.h"
10 #include "lsst/afw/image/TanWcs.h"
11 #include "lsst/afw/image/Calib.h"
12 #include "lsst/afw/image/VisitInfo.h"
13 #include "lsst/daf/base/PropertySet.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 
22 #include "lsst/afw/table/SortedCatalog.h"
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 
35 
36 public:
37  // These are strictly speaking not needed anymore (after DM-4043),
38  // but keeping them seems cleaner then exposing the lists themselves.
39  size_t refStarListSize() { return refStarList.size(); }
40  size_t fittedStarListSize() { return fittedStarList.size(); }
41 
47  : _commonTangentPoint(Point(std::numeric_limits<double>::quiet_NaN(),
48  std::numeric_limits<double>::quiet_NaN())) {}
49 
51  Associations(Associations const &) = delete;
52  Associations(Associations &&) = delete;
53  Associations &operator=(Associations const &) = delete;
54  Associations &operator=(Associations &&) = delete;
55 
61  void setCommonTangentPoint(lsst::afw::geom::Point2D const &commonTangentPoint);
62 
65 
79  void addImage(lsst::afw::table::SortedCatalogT<lsst::afw::table::SourceRecord> &catalog,
80  std::shared_ptr<lsst::afw::image::TanWcs> wcs,
81  std::shared_ptr<lsst::afw::image::VisitInfo> visitInfo, lsst::afw::geom::Box2I const &bbox,
82  std::string const &filter, std::shared_ptr<afw::image::PhotoCalib> photoCalib, int visit,
83  int ccd, std::shared_ptr<lsst::jointcal::JointcalControl> control);
84 
86  void associateCatalogs(const double matchCutInArcsec = 0, const bool useFittedList = false,
87  const bool enlargeFittedList = true);
88 
99  void collectRefStars(lsst::afw::table::SortedCatalogT<lsst::afw::table::SimpleRecord> &refCat,
100  afw::geom::Angle matchCut, std::string const &fluxField,
101  std::map<std::string, std::vector<double>> const &refFluxMap,
102  std::map<std::string, std::vector<double>> const &refFluxErrMap);
103 
106  void deprojectFittedStars();
107 
109 /* If Color is "g-i", then the color is assigned from columns "g" and "i" of the colored catalog. */
110 #ifdef TODO
111  void setFittedStarColors(std::string const &dicStarListName, std::string const &color,
112  double matchCutArcSec);
113 #endif
114 
120  void selectFittedStars(int minMeasurements);
121 
122  CcdImageList const &getCcdImageList() const { return ccdImageList; }
123 
125  unsigned getNFilters() const { return _filterMap.size(); }
126 
127  // Return the bounding box in (ra, dec) coordinates containing the whole catalog
128  const lsst::afw::geom::Box2D getRaDecBBox();
129 
133  int nCcdImagesValidForFit() const {
134  return std::count_if(
135  ccdImageList.begin(), ccdImageList.end(),
136  [](std::shared_ptr<CcdImage> const &item) { return item->getCatalogForFit().size() > 0; });
137  }
138 
139 private:
140  void associateRefStars(double matchCutInArcsec, const Gtransfo *gtransfo);
141 
142  void assignMags();
143 
144  // Map from filter name to index in each refStar's _refFlux/_refFluxErr vector.
145  std::unordered_map<std::string, std::size_t> _filterMap;
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:125
int nCcdImagesValidForFit() const
return the number of CcdImages with non-empty catalogs to-be-fit.
Definition: Associations.h:133
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:64
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 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.
Definition: Associations.h:24
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:122
void setCommonTangentPoint(lsst::afw::geom::Point2D const &commonTangentPoint)
Sets a shared tangent point for all ccdImages.
Definition: Associations.cc:52
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, int visit, int ccd, std::shared_ptr< lsst::jointcal::JointcalControl > control)
Create a ccdImage from an exposure catalog and metadata, and add it to the list.
Definition: Associations.cc:39
a virtual (interface) class for geometric transformations.
Definition: Gtransfo.h:37
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:46
std::list< std::shared_ptr< CcdImage > > CcdImageList
Definition: CcdImage.h:22
Associations & operator=(Associations const &)=delete
FittedStarList fittedStarList
Definition: Associations.h:32