LSSTApplications  20.0.0
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;
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
lsst::jointcal::Associations::associateCatalogs
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:121
Box.h
std::string
STL class.
std::shared_ptr< lsst::afw::geom::SkyWcs >
lsst::jointcal::Associations::deprojectFittedStars
void deprojectFittedStars()
Sends back the fitted stars coordinates on the sky FittedStarsList::inTangentPlaneCoordinates keeps t...
Definition: Associations.cc:394
std::list< std::shared_ptr< CcdImage > >
lsst.pipe.tasks.assembleCoadd.filter
filter
Definition: assembleCoadd.py:335
CcdImage.h
lsst::jointcal::Associations::refStarList
RefStarList refStarList
Definition: Associations.h:57
wcs
table::Key< table::Array< std::uint8_t > > wcs
Definition: SkyWcs.cc:71
Calib.h
std::list::size
T size(T... args)
lsst::jointcal::Associations::addCcdImage
void addCcdImage(std::shared_ptr< CcdImage > const ccdImage)
Add a pre-constructed ccdImage to the ccdImageList.
Definition: Associations.h:131
lsst::jointcal::Associations::collectRefStars
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.
Definition: Associations.cc:205
SkyWcs.h
lsst::jointcal::Associations::getCommonTangentPoint
Point getCommonTangentPoint() const
can be used to project sidereal coordinates related to the image set on a plane.
Definition: Associations.h:105
lsst::jointcal::Associations::Associations
Associations(Associations const &)=delete
No moves or copies: jointcal only ever needs one Associations object.
lsst::jointcal::Associations::fittedStarList
FittedStarList fittedStarList
Definition: Associations.h:58
lsst::jointcal::Associations::ccdImageList
CcdImageList ccdImageList
Definition: Associations.h:56
Circle.h
This file declares a class for representing circular regions on the unit sphere.
std::list::push_back
T push_back(T... args)
lsst::jointcal::Associations::refStarListSize
size_t refStarListSize()
Definition: Associations.h:62
Point.h
lsst::jointcal::Associations::operator=
Associations & operator=(Associations &&)=delete
lsst::afw::table._source.SourceCatalog
Definition: _source.py:33
PropertySet.h
lsst::jointcal::Associations::Associations
Associations()
Source selection is performed in python, so Associations' constructor only initializes a couple of va...
Definition: Associations.h:69
lsst::jointcal::Associations::Associations
Associations(Associations &&)=delete
lsst::jointcal::Associations::getNFilters
unsigned getNFilters() const
Number of different bands in the input image list. Not implemented so far.
Definition: Associations.h:174
std::map
STL class.
lsst::jointcal
Definition: Associations.h:49
SortedCatalog.h
lsst::jointcal::Associations::prepareFittedStars
void prepareFittedStars(int minMeasurements)
Set the color field of FittedStar 's from a colored catalog.
Definition: Associations.cc:298
lsst::jointcal::RefStarList
Definition: RefStar.h:55
Source.h
lsst.pipe.tasks.assembleCoadd.ccd
ccd
Definition: assembleCoadd.py:336
lsst::jointcal::Associations::Associations
Associations(CcdImageList const &imageList)
Create an Associations object from a pre-built list of ccdImages.
Definition: Associations.h:81
lsst
A base class for image defects.
Definition: imageAlgorithm.dox:1
lsst::jointcal::Associations
The class that implements the relations between MeasuredStar and FittedStar.
Definition: Associations.h:54
lsst::jointcal::Associations::setCommonTangentPoint
void setCommonTangentPoint(lsst::geom::Point2D const &commonTangentPoint)
Sets a shared tangent point for all ccdImages.
Definition: Associations.cc:87
photoCalib
Key< int > photoCalib
Definition: Exposure.cc:67
std
STL namespace.
JointcalControl.h
detector
table::Key< int > detector
Definition: DetectorCollection.cc:172
lsst::geom::Point< double, 2 >
RefStar.h
lsst::jointcal::JointcalControl
Definition: JointcalControl.h:39
lsst::geom::Angle
A class representing an angle.
Definition: Angle.h:127
lsst::geom::Box2I
An integer coordinate rectangle.
Definition: Box.h:55
lsst::jointcal::Point
A point in a plane.
Definition: Point.h:36
transform
table::Key< int > transform
Definition: TransformMap.cc:299
lsst::jointcal::FittedStarList
A list of FittedStar s. Such a list is typically constructed by Associations.
Definition: FittedStar.h:123
lsst::jointcal::Associations::nCcdImagesValidForFit
int nCcdImagesValidForFit() const
return the number of CcdImages with non-empty catalogs to-be-fit.
Definition: Associations.cc:408
lsst::jointcal::Associations::getCcdImageList
CcdImageList const & getCcdImageList() const
Definition: Associations.h:171
lsst::jointcal::Associations::createCcdImage
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
lsst::jointcal::AstrometryTransform
a virtual (interface) class for geometric transformations.
Definition: AstrometryTransform.h:65
lsst.pipe.tasks.assembleCoadd.visit
visit
Definition: assembleCoadd.py:336
lsst::jointcal::Associations::nFittedStarsWithAssociatedRefStar
size_t nFittedStarsWithAssociatedRefStar() const
Return the number of fittedStars that have an associated refStar.
Definition: Associations.cc:414
lsst::sphgeom::Circle
Circle is a circular region on the unit sphere that contains its boundary.
Definition: Circle.h:46
FittedStar.h
lsst::jointcal::Associations::computeBoundingCircle
lsst::sphgeom::Circle computeBoundingCircle() const
Return the bounding circle in on-sky (RA, Dec) coordinates containing all CcdImages.
Definition: Associations.cc:92
std::numeric_limits
lsst::afw::table::SortedCatalogT
Custom catalog class for record/table subclasses that are guaranteed to have an ID,...
Definition: fwd.h:63
lsst::jointcal::Associations::computeCommonTangentPoint
void computeCommonTangentPoint()
Sets a shared tangent point for all ccdImages, using the mean of the centers of all ccdImages.
Definition: Associations.cc:76
visitInfo
Key< int > visitInfo
Definition: Exposure.cc:70
bbox
AmpInfoBoxKey bbox
Definition: Amplifier.cc:117
lsst::jointcal::Associations::fittedStarListSize
size_t fittedStarListSize()
Definition: Associations.h:63
VisitInfo.h
lsst::jointcal::Associations::operator=
Associations & operator=(Associations const &)=delete