LSSTApplications  17.0+124,17.0+14,17.0+73,18.0.0+37,18.0.0+80,18.0.0-4-g68ffd23+4,18.1.0-1-g0001055+12,18.1.0-1-g03d53ef+5,18.1.0-1-g1349e88+55,18.1.0-1-g2505f39+44,18.1.0-1-g5315e5e+4,18.1.0-1-g5e4b7ea+14,18.1.0-1-g7e8fceb+4,18.1.0-1-g85f8cd4+48,18.1.0-1-g8ff0b9f+4,18.1.0-1-ga2c679d+1,18.1.0-1-gd55f500+35,18.1.0-10-gb58edde+2,18.1.0-11-g0997b02+4,18.1.0-13-gfe4edf0b+12,18.1.0-14-g259bd21+21,18.1.0-19-gdb69f3f+2,18.1.0-2-g5f9922c+24,18.1.0-2-gd3b74e5+11,18.1.0-2-gfbf3545+32,18.1.0-26-g728bddb4+5,18.1.0-27-g6ff7ca9+2,18.1.0-3-g52aa583+25,18.1.0-3-g8ea57af+9,18.1.0-3-gb69f684+42,18.1.0-3-gfcaddf3+6,18.1.0-32-gd8786685a,18.1.0-4-gf3f9b77+6,18.1.0-5-g1dd662b+2,18.1.0-5-g6dbcb01+41,18.1.0-6-gae77429+3,18.1.0-7-g9d75d83+9,18.1.0-7-gae09a6d+30,18.1.0-9-gc381ef5+4,w.2019.45
LSSTDataManagementBasePackage
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/geom/Box.h"
38 #include "lsst/sphgeom/Circle.h"
39 
40 #include "lsst/jointcal/RefStar.h"
42 #include "lsst/jointcal/CcdImage.h"
43 #include "lsst/jointcal/Point.h"
45 
47 
48 namespace lsst {
49 namespace jointcal {
50 
52 
54 class Associations {
55 public:
56  CcdImageList ccdImageList; // the catalog handlers
57  RefStarList refStarList; // e.g. GAIA or SDSS reference stars
58  FittedStarList fittedStarList; // stars that are going to be fitted
59 
60  // These are strictly speaking not needed anymore (after DM-4043),
61  // but keeping them seems cleaner then exposing the lists themselves.
62  size_t refStarListSize() { return refStarList.size(); }
63  size_t fittedStarListSize() { return fittedStarList.size(); }
64 
70  : _commonTangentPoint(Point(std::numeric_limits<double>::quiet_NaN(),
71  std::numeric_limits<double>::quiet_NaN())) {}
72 
81  Associations(CcdImageList const &imageList)
82  : ccdImageList(imageList),
83  _commonTangentPoint(Point(std::numeric_limits<double>::quiet_NaN(),
84  std::numeric_limits<double>::quiet_NaN())) {}
85 
87  Associations(Associations const &) = delete;
88  Associations(Associations &&) = delete;
89  Associations &operator=(Associations const &) = delete;
90  Associations &operator=(Associations &&) = delete;
91 
96 
102  void setCommonTangentPoint(lsst::geom::Point2D const &commonTangentPoint);
103 
105  Point getCommonTangentPoint() const { return _commonTangentPoint; }
106 
123  lsst::geom::Box2I const &bbox, std::string const &filter,
126  lsst::jointcal::JointcalControl const &control);
127 
131  void addCcdImage(std::shared_ptr<CcdImage> const ccdImage) { ccdImageList.push_back(ccdImage); }
132 
134  void associateCatalogs(const double matchCutInArcsec = 0, const bool useFittedList = false,
135  const bool enlargeFittedList = true);
136 
151  std::string const &fluxField, float refCoordinateErr, bool rejectBadFluxes = false);
152 
155  void deprojectFittedStars();
156 
158 /* If Color is "g-i", then the color is assigned from columns "g" and "i" of the colored catalog. */
159 #ifdef TODO
160  void setFittedStarColors(std::string const &dicStarListName, std::string const &color,
161  double matchCutArcSec);
162 #endif
163 
169  void prepareFittedStars(int minMeasurements);
170 
171  CcdImageList const &getCcdImageList() const { return ccdImageList; }
172 
174  unsigned getNFilters() const { return 1; }
175 
183 
187  int nCcdImagesValidForFit() const;
188 
192  size_t nFittedStarsWithAssociatedRefStar() const;
193 
194 private:
195  void associateRefStars(double matchCutInArcsec, const AstrometryTransform *transform);
196 
197  void assignMags();
198 
204  void selectFittedStars(int minMeasurements);
205 
212  void normalizeFittedStars() const;
213 
214  Point _commonTangentPoint;
215 };
216 
217 } // namespace jointcal
218 } // namespace lsst
219 #endif // LSST_JOINTCAL_ASSOCIATIONS_H
AmpInfoBoxKey bbox
Definition: Amplifier.cc:117
This file declares a class for representing circular regions on the unit sphere.
unsigned getNFilters() const
Number of different bands in the input image list. Not implemented so far.
Definition: Associations.h:174
int nCcdImagesValidForFit() const
return the number of CcdImages with non-empty catalogs to-be-fit.
A point in a plane.
Definition: Point.h:36
STL namespace.
Point getCommonTangentPoint() const
can be used to project sidereal coordinates related to the image set on a plane.
Definition: Associations.h:105
void createCcdImage(afw::table::SourceCatalog &catalog, std::shared_ptr< lsst::afw::geom::SkyWcs > wcs, std::shared_ptr< lsst::afw::image::VisitInfo > visitInfo, lsst::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:62
STL class.
The class that implements the relations between MeasuredStar and FittedStar.
Definition: Associations.h:54
A class representing an angle.
Definition: Angle.h:127
void associateCatalogs(const double matchCutInArcsec=0, const bool useFittedList=false, const bool enlargeFittedList=true)
incrementaly builds a merged catalog of all image catalogs
table::Key< table::Array< std::uint8_t > > wcs
Definition: SkyWcs.cc:71
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.
T push_back(T... args)
A base class for image defects.
Custom catalog class for record/table subclasses that are guaranteed to have an ID, and should generally be sorted by that ID.
Definition: fwd.h:63
void computeCommonTangentPoint()
Sets a shared tangent point for all ccdImages, using the mean of the centers of all ccdImages...
Definition: Associations.cc:76
A list of FittedStar s. Such a list is typically constructed by Associations.
Definition: FittedStar.h:123
table::Key< int > detector
void deprojectFittedStars()
Sends back the fitted stars coordinates on the sky FittedStarsList::inTangentPlaneCoordinates keeps t...
CcdImageList const & getCcdImageList() const
Definition: Associations.h:171
Circle is a circular region on the unit sphere that contains its boundary.
Definition: Circle.h:46
T size(T... args)
void setCommonTangentPoint(lsst::geom::Point2D const &commonTangentPoint)
Sets a shared tangent point for all ccdImages.
Definition: Associations.cc:87
void collectRefStars(afw::table::SimpleCatalog &refCat, geom::Angle matchCut, std::string const &fluxField, float refCoordinateErr, bool rejectBadFluxes=false)
Collect stars from an external reference catalog and associate them with fittedStars.
a virtual (interface) class for geometric transformations.
Associations()
Source selection is performed in python, so Associations&#39; constructor only initializes a couple of va...
Definition: Associations.h:69
Associations(CcdImageList const &imageList)
Create an Associations object from a pre-built list of ccdImages.
Definition: Associations.h:81
lsst::sphgeom::Circle computeBoundingCircle() const
Return the bounding circle in on-sky (RA, Dec) coordinates containing all CcdImages.
Definition: Associations.cc:92
Associations & operator=(Associations const &)=delete
An integer coordinate rectangle.
Definition: Box.h:55
void addCcdImage(std::shared_ptr< CcdImage > const ccdImage)
Add a pre-constructed ccdImage to the ccdImageList.
Definition: Associations.h:131
FittedStarList fittedStarList
Definition: Associations.h:58