LSST Applications g0265f82a02+093ff98f47,g02d81e74bb+3975d4ac1c,g2079a07aa2+14824f138e,g2bbee38e9b+093ff98f47,g337abbeb29+093ff98f47,g3ddfee87b4+626790451e,g3e7165581c+1687b54203,g487adcacf7+018f045a06,g50ff169b8f+5929b3527e,g52b1c1532d+a6fc98d2e7,g568d43a26c+02eca3db7e,g591dd9f2cf+3cba9d5141,g858d7b2824+3975d4ac1c,g8a8a8dda67+a6fc98d2e7,g8cdfe0ae6a+66d966b544,g99cad8db69+948283481e,g9ddcbc5298+d4bad12328,ga1e77700b3+246acaaf9c,ga2e4dd1c03+626790451e,ga8c6da7877+c38891e457,gae46bcf261+093ff98f47,gb0e22166c9+3863383f4c,gba4ed39666+9664299f35,gbb8dafda3b+dce3423368,gbeb006f7da+65b42827f3,gbf5cecdb8a+3975d4ac1c,gc0f3af6251+39f4c7265c,gc120e1dc64+1d31f3ee8b,gc28159a63d+093ff98f47,gcf0d15dbbd+626790451e,gd2a12a3803+bbf96b9899,gdaeeff99f8+a38ce5ea23,ge79ae78c31+093ff98f47,gee10cc3b42+a6fc98d2e7,gf1cff7945b+3975d4ac1c,v24.1.5.rc1
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | List of all members
lsst::jointcal::CcdImage Class Reference

Handler of an actual image from a single CCD. More...

#include <CcdImage.h>

Public Member Functions

 CcdImage (afw::table::SourceCatalog &record, const std::shared_ptr< lsst::afw::geom::SkyWcs > &wcs, const std::shared_ptr< lsst::afw::image::VisitInfo > &visitInfo, lsst::geom::Box2I const &bbox, std::string filter, std::shared_ptr< afw::image::PhotoCalib > photoCalib, std::shared_ptr< afw::cameraGeom::Detector > detector, int visit, int ccd, std::string const &fluxField)
 
 CcdImage (CcdImage const &)=delete
 No move or copy: each CCD image is unique to that ccd+visit, and Associations holds all CcdImages.
 
 CcdImage (CcdImage &&)=delete
 
CcdImageoperator= (CcdImage const &)=delete
 
CcdImageoperator= (CcdImage &&)=delete
 
std::string getName () const
 Return the _name that identifies this ccdImage.
 
MeasuredStarList const & getWholeCatalog () const
 Gets the as-read catalog.
 
MeasuredStarList const & getCatalogForFit () const
 Gets the catalog to be used for fitting, which may have been cleaned-up.
 
MeasuredStarListgetCatalogForFit ()
 
void resetCatalogForFit ()
 Clear the catalog for fitting and set it to a copy of the whole catalog.
 
std::pair< int, int > countStars () const
 Count the number of valid measured and reference stars that fall within this ccdImage.
 
void setCommonTangentPoint (Point const &commonTangentPoint)
 Sets the common tangent point and computes necessary transforms.
 
jointcal::Point const & getCommonTangentPoint () const
 Gets the common tangent point, shared between all ccdImages.
 
std::shared_ptr< AstrometryTransform > const getPixelToCommonTangentPlane () const
 
std::shared_ptr< AstrometryTransform > const getCommonTangentPlaneToTangentPlane () const
 
std::shared_ptr< AstrometryTransform > const getTangentPlaneToCommonTangentPlane () const
 
std::shared_ptr< AstrometryTransform > const getPixelToTangentPlane () const
 
std::shared_ptr< AstrometryTransform > const getSkyToTangentPlane () const
 
CcdIdType getCcdId () const
 returns ccd ID
 
VisitIdType getVisit () const
 returns visit ID
 
std::shared_ptr< afw::cameraGeom::DetectorgetDetector () const
 
CcdImageKey getHashKey () const
 
double getAirMass () const
 Airmass.
 
double getEpoch () const
 
std::shared_ptr< afw::image::PhotoCalibgetPhotoCalib () const
 Return the exposure's photometric calibration.
 
lsst::geom::SpherePoint getBoresightRaDec () const
 Gets the boresight RA/Dec.
 
double getHourAngle () const
 
double getLstObs () const
 
double getSinEta () const
 Parallactic angle.
 
double getCosEta () const
 Parallactic angle.
 
double getTanZ () const
 Parallactic angle.
 
Point getRefractionVector () const
 
std::string getFilter () const
 return the CcdImage filter name
 
std::shared_ptr< AstrometryTransform > const getReadWcs () const
 the wcs read in the header. NOT updated when fitting.
 
Frame const & getImageFrame () const
 Frame in pixels.
 

Detailed Description

Handler of an actual image from a single CCD.

NOTE: could possibly be replaced with a subclass of afw.image.Exposure?

Definition at line 64 of file CcdImage.h.

Constructor & Destructor Documentation

◆ CcdImage() [1/3]

lsst::jointcal::CcdImage::CcdImage ( afw::table::SourceCatalog & record,
const std::shared_ptr< lsst::afw::geom::SkyWcs > & wcs,
const std::shared_ptr< lsst::afw::image::VisitInfo > & visitInfo,
lsst::geom::Box2I const & bbox,
std::string filter,
std::shared_ptr< afw::image::PhotoCalib > photoCalib,
std::shared_ptr< afw::cameraGeom::Detector > detector,
int visit,
int ccd,
std::string const & fluxField )

Definition at line 113 of file CcdImage.cc.

118 : _ccdId(ccdId), _visit(visit), _photoCalib(std::move(photoCalib)), _detector(std::move(detector)), _filter(std::move(filter)) {
119 loadCatalog(catalog, fluxField);
120
121 Point lowerLeft(bbox.getMinX(), bbox.getMinY());
122 Point upperRight(bbox.getMaxX(), bbox.getMaxY());
123 _imageFrame = Frame(lowerLeft, upperRight);
124
125 _readWcs = std::make_shared<AstrometryTransformSkyWcs>(wcs);
126
128 out << visit << "_" << ccdId;
129 _name = out.str();
130
131 _boresightRaDec = visitInfo->getBoresightRaDec();
132 _airMass = visitInfo->getBoresightAirmass();
133 _epoch = visitInfo->getDate().get(lsst::daf::base::DateTime::EPOCH);
134 _lstObs = visitInfo->getEra();
135 _hourAngle = visitInfo->getBoresightHourAngle();
136
137 // Some cameras don't manage ERA (and thus Hour Angle) properly, so it's going to be NaN.
138 // Because we need the refraction vector later, go with 0 HA to prevent crashes on that NaN.
139 if (std::isnan(_hourAngle) == true) {
140 _hourAngle = 0;
141 }
142
143 if (_airMass == 1)
144 _sinEta = _cosEta = _tanZ = 0;
145 else {
146 double cosz = 1. / _airMass;
147 double sinz = std::sqrt(1 - cosz * cosz); // astronomers usually observe above the horizon
148 _tanZ = sinz / cosz;
149 lsst::geom::Angle eta = visitInfo->getBoresightParAngle();
150 _sinEta = std::sin(eta.asRadians());
151 _cosEta = std::cos(eta.asRadians());
152 }
153}
AmpInfoBoxKey bbox
Definition Amplifier.cc:117
A class representing an angle.
Definition Angle.h:128
constexpr double asRadians() const noexcept
Return an Angle's value in radians.
Definition Angle.h:173
T cos(T... args)
T isnan(T... args)
T move(T... args)
T sin(T... args)
T sqrt(T... args)
T str(T... args)
Key< int > visitInfo
Definition Exposure.cc:70

◆ CcdImage() [2/3]

lsst::jointcal::CcdImage::CcdImage ( CcdImage const & )
delete

No move or copy: each CCD image is unique to that ccd+visit, and Associations holds all CcdImages.

◆ CcdImage() [3/3]

lsst::jointcal::CcdImage::CcdImage ( CcdImage && )
delete

Member Function Documentation

◆ countStars()

std::pair< int, int > lsst::jointcal::CcdImage::countStars ( ) const

Count the number of valid measured and reference stars that fall within this ccdImage.

Measured stars are counted if they are valid. Reference stars are counted if a measured star (valid or not) has a fittedStar that has an associated refStar.

Returns
Number of (measured, reference) stars in the image.

Definition at line 155 of file CcdImage.cc.

155 {
156 int measuredStars = 0;
157 int refStars = 0;
158 for (auto const &measuredStar : _catalogForFit) {
159 if (measuredStar->isValid()) {
160 measuredStars++;
161 }
162 if ((measuredStar->getFittedStar() != nullptr) &&
163 (measuredStar->getFittedStar()->getRefStar() != nullptr)) {
164 refStars++;
165 }
166 }
167 return std::make_pair(measuredStars, refStars);
168}
T make_pair(T... args)

◆ getAirMass()

double lsst::jointcal::CcdImage::getAirMass ( ) const
inline

Airmass.

Definition at line 155 of file CcdImage.h.

155{ return _airMass; }

◆ getBoresightRaDec()

lsst::geom::SpherePoint lsst::jointcal::CcdImage::getBoresightRaDec ( ) const
inline

Gets the boresight RA/Dec.

Definition at line 165 of file CcdImage.h.

165{ return _boresightRaDec; }

◆ getCatalogForFit() [1/2]

MeasuredStarList & lsst::jointcal::CcdImage::getCatalogForFit ( )
inline

Definition at line 95 of file CcdImage.h.

95{ return _catalogForFit; }

◆ getCatalogForFit() [2/2]

MeasuredStarList const & lsst::jointcal::CcdImage::getCatalogForFit ( ) const
inline

Gets the catalog to be used for fitting, which may have been cleaned-up.

Returns
The catalog for fitting.

Definition at line 94 of file CcdImage.h.

94{ return _catalogForFit; }

◆ getCcdId()

CcdIdType lsst::jointcal::CcdImage::getCcdId ( ) const
inline

returns ccd ID

Definition at line 145 of file CcdImage.h.

145{ return _ccdId; }

◆ getCommonTangentPlaneToTangentPlane()

std::shared_ptr< AstrometryTransform > const lsst::jointcal::CcdImage::getCommonTangentPlaneToTangentPlane ( ) const
inline

Definition at line 132 of file CcdImage.h.

132 {
133 return _commonTangentPlaneToTangentPlane;
134 }

◆ getCommonTangentPoint()

jointcal::Point const & lsst::jointcal::CcdImage::getCommonTangentPoint ( ) const
inline

Gets the common tangent point, shared between all ccdImages.

Returns
The common tangent point of all ccdImages (decimal degrees).

Definition at line 126 of file CcdImage.h.

126{ return _commonTangentPoint; }

◆ getCosEta()

double lsst::jointcal::CcdImage::getCosEta ( ) const
inline

Parallactic angle.

Definition at line 175 of file CcdImage.h.

175{ return _cosEta; }

◆ getDetector()

std::shared_ptr< afw::cameraGeom::Detector > lsst::jointcal::CcdImage::getDetector ( ) const
inline

Definition at line 150 of file CcdImage.h.

150{ return _detector; }

◆ getEpoch()

double lsst::jointcal::CcdImage::getEpoch ( ) const
inline

Definition at line 157 of file CcdImage.h.

157{ return _epoch; }

◆ getFilter()

std::string lsst::jointcal::CcdImage::getFilter ( ) const
inline

return the CcdImage filter name

Definition at line 184 of file CcdImage.h.

184{ return _filter; }

◆ getHashKey()

CcdImageKey lsst::jointcal::CcdImage::getHashKey ( ) const
inline

Definition at line 152 of file CcdImage.h.

152{ return CcdImageKey{_visit, _ccdId}; }

◆ getHourAngle()

double lsst::jointcal::CcdImage::getHourAngle ( ) const
inline

Definition at line 167 of file CcdImage.h.

167{ return _hourAngle; }

◆ getImageFrame()

Frame const & lsst::jointcal::CcdImage::getImageFrame ( ) const
inline

Frame in pixels.

Definition at line 190 of file CcdImage.h.

190{ return _imageFrame; }

◆ getLstObs()

double lsst::jointcal::CcdImage::getLstObs ( ) const
inline

Definition at line 169 of file CcdImage.h.

169{ return _lstObs; }

◆ getName()

std::string lsst::jointcal::CcdImage::getName ( ) const
inline

Return the _name that identifies this ccdImage.

Definition at line 79 of file CcdImage.h.

79{ return _name; }

◆ getPhotoCalib()

std::shared_ptr< afw::image::PhotoCalib > lsst::jointcal::CcdImage::getPhotoCalib ( ) const
inline

Return the exposure's photometric calibration.

Definition at line 160 of file CcdImage.h.

160{ return _photoCalib; }

◆ getPixelToCommonTangentPlane()

std::shared_ptr< AstrometryTransform > const lsst::jointcal::CcdImage::getPixelToCommonTangentPlane ( ) const
inline

Definition at line 128 of file CcdImage.h.

128 {
129 return _pixelToCommonTangentPlane;
130 }

◆ getPixelToTangentPlane()

std::shared_ptr< AstrometryTransform > const lsst::jointcal::CcdImage::getPixelToTangentPlane ( ) const
inline

Definition at line 140 of file CcdImage.h.

140{ return _pixelToTangentPlane; }

◆ getReadWcs()

std::shared_ptr< AstrometryTransform > const lsst::jointcal::CcdImage::getReadWcs ( ) const
inline

the wcs read in the header. NOT updated when fitting.

Definition at line 187 of file CcdImage.h.

187{ return _readWcs; }

◆ getRefractionVector()

Point lsst::jointcal::CcdImage::getRefractionVector ( ) const
inline

Definition at line 181 of file CcdImage.h.

181{ return Point(_tanZ * _cosEta, _tanZ * _sinEta); }

◆ getSinEta()

double lsst::jointcal::CcdImage::getSinEta ( ) const
inline

Parallactic angle.

Definition at line 172 of file CcdImage.h.

172{ return _sinEta; }

◆ getSkyToTangentPlane()

std::shared_ptr< AstrometryTransform > const lsst::jointcal::CcdImage::getSkyToTangentPlane ( ) const
inline

Definition at line 142 of file CcdImage.h.

142{ return _skyToTangentPlane; }

◆ getTangentPlaneToCommonTangentPlane()

std::shared_ptr< AstrometryTransform > const lsst::jointcal::CcdImage::getTangentPlaneToCommonTangentPlane ( ) const
inline

Definition at line 136 of file CcdImage.h.

136 {
137 return _tangentPlaneToCommonTangentPlane;
138 }

◆ getTanZ()

double lsst::jointcal::CcdImage::getTanZ ( ) const
inline

Parallactic angle.

Definition at line 178 of file CcdImage.h.

178{ return _tanZ; }

◆ getVisit()

VisitIdType lsst::jointcal::CcdImage::getVisit ( ) const
inline

returns visit ID

Definition at line 148 of file CcdImage.h.

148{ return _visit; }

◆ getWholeCatalog()

MeasuredStarList const & lsst::jointcal::CcdImage::getWholeCatalog ( ) const
inline

Gets the as-read catalog.

Returns
The whole catalog.

Definition at line 86 of file CcdImage.h.

86{ return _wholeCatalog; }

◆ operator=() [1/2]

CcdImage & lsst::jointcal::CcdImage::operator= ( CcdImage && )
delete

◆ operator=() [2/2]

CcdImage & lsst::jointcal::CcdImage::operator= ( CcdImage const & )
delete

◆ resetCatalogForFit()

void lsst::jointcal::CcdImage::resetCatalogForFit ( )
inline

Clear the catalog for fitting and set it to a copy of the whole catalog.

Definition at line 99 of file CcdImage.h.

99 {
102 }
MeasuredStarList const & getWholeCatalog() const
Gets the as-read catalog.
Definition CcdImage.h:86
MeasuredStarList const & getCatalogForFit() const
Gets the catalog to be used for fitting, which may have been cleaned-up.
Definition CcdImage.h:94
void copyTo(StarList< Star > &copy) const
clears copy and makes a copy of the std::list to copy
Definition StarList.cc:68
T clear(T... args)

◆ setCommonTangentPoint()

void lsst::jointcal::CcdImage::setCommonTangentPoint ( Point const & commonTangentPoint)

Sets the common tangent point and computes necessary transforms.

Parameters
[in]commonTangentPointThe common tangent point of all ccdImages (decimal degrees).

Definition at line 170 of file CcdImage.cc.

170 {
171 _commonTangentPoint = commonTangentPoint;
172
173 auto const crval = _readWcs->getSkyWcs()->getSkyOrigin();
174 jointcal::Point tangentPoint(crval[0].asDegrees(), crval[1].asDegrees());
175
176 /* we don't assume here that we know the internals of TanPixelToRaDec:
177 to construct pix->TP, we do pix->sky->TP, although pix->sky
178 actually goes through TP */
179 AstrometryTransformLinear identity;
180 TanRaDecToPixel raDecToTangentPlane(identity, tangentPoint);
181 _pixelToTangentPlane = compose(raDecToTangentPlane, *_readWcs);
182 TanPixelToRaDec CommonTangentPlane2RaDec(identity, commonTangentPoint);
183 _commonTangentPlaneToTangentPlane = compose(raDecToTangentPlane, CommonTangentPlane2RaDec);
184
185 // jump from one TP to an other:
186 TanRaDecToPixel raDecToCommonTangentPlane(identity, commonTangentPoint);
187 TanPixelToRaDec TangentPlaneToRaDec(identity, tangentPoint);
188 _tangentPlaneToCommonTangentPlane = compose(raDecToCommonTangentPlane, TangentPlaneToRaDec);
189 _skyToTangentPlane.reset(new TanRaDecToPixel(identity, tangentPoint));
190
191 // this one is needed for matches :
192 _pixelToCommonTangentPlane = compose(raDecToCommonTangentPlane, *_readWcs);
193}
table::PointKey< double > crval
Definition OldWcs.cc:128
A point in a plane.
Definition Point.h:37
std::unique_ptr< AstrometryTransform > compose(AstrometryTransform const &left, AstrometryTransform const &right)
Returns a pointer to a composition of transforms, representing left(right()).

The documentation for this class was generated from the following files: