LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
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, 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, 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. More...
 
 CcdImage (CcdImage &&)=delete
 
CcdImageoperator= (CcdImage const &)=delete
 
CcdImageoperator= (CcdImage &&)=delete
 
std::string getName () const
 Return the _name that identifies this ccdImage. More...
 
MeasuredStarList const & getWholeCatalog () const
 Gets the as-read catalog. More...
 
MeasuredStarList const & getCatalogForFit () const
 Gets the catalog to be used for fitting, which may have been cleaned-up. More...
 
MeasuredStarListgetCatalogForFit ()
 
void resetCatalogForFit ()
 Clear the catalog for fitting and set it to a copy of the whole catalog. More...
 
std::pair< int, int > countStars () const
 Count the number of valid measured and reference stars that fall within this ccdImage. More...
 
void setCommonTangentPoint (Point const &commonTangentPoint)
 Sets the common tangent point and computes necessary transforms. More...
 
jointcal::Point const & getCommonTangentPoint () const
 Gets the common tangent point, shared between all ccdImages. More...
 
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 More...
 
VisitIdType getVisit () const
 returns visit ID More...
 
std::shared_ptr< afw::cameraGeom::DetectorgetDetector () const
 
CcdImageKey getHashKey () const
 
double getAirMass () const
 Airmass. More...
 
double getEpoch () const
 
std::shared_ptr< afw::image::PhotoCalibgetPhotoCalib () const
 Return the exposure's photometric calibration. More...
 
lsst::geom::SpherePoint getBoresightRaDec () const
 Gets the boresight RA/Dec. More...
 
double getHourAngle () const
 
double getLstObs () const
 
double getSinEta () const
 Parallactic angle. More...
 
double getCosEta () const
 Parallactic angle. More...
 
double getTanZ () const
 Parallactic angle. More...
 
Point getRefractionVector () const
 
std::string getFilter () const
 return the CcdImage filter name More...
 
std::shared_ptr< AstrometryTransform > const getReadWcs () const
 the wcs read in the header. NOT updated when fitting. More...
 
Frame const & getImageFrame () const
 Frame in pixels. More...
 

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,
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,
std::string const &  fluxField 
)

Definition at line 111 of file CcdImage.cc.

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

◆ 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 153 of file CcdImage.cc.

153  {
154  int measuredStars = 0;
155  int refStars = 0;
156  for (auto const &measuredStar : _catalogForFit) {
157  if (measuredStar->isValid()) {
158  measuredStars++;
159  }
160  if ((measuredStar->getFittedStar() != nullptr) &&
161  (measuredStar->getFittedStar()->getRefStar() != nullptr)) {
162  refStars++;
163  }
164  }
165  return std::make_pair(measuredStars, refStars);
166 }
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 168 of file CcdImage.cc.

168  {
169  _commonTangentPoint = commonTangentPoint;
170 
171  auto const crval = _readWcs->getSkyWcs()->getSkyOrigin();
172  jointcal::Point tangentPoint(crval[0].asDegrees(), crval[1].asDegrees());
173 
174  /* we don't assume here that we know the internals of TanPixelToRaDec:
175  to construct pix->TP, we do pix->sky->TP, although pix->sky
176  actually goes through TP */
177  AstrometryTransformLinear identity;
178  TanRaDecToPixel raDecToTangentPlane(identity, tangentPoint);
179  _pixelToTangentPlane = compose(raDecToTangentPlane, *_readWcs);
180  TanPixelToRaDec CommonTangentPlane2RaDec(identity, commonTangentPoint);
181  _commonTangentPlaneToTangentPlane = compose(raDecToTangentPlane, CommonTangentPlane2RaDec);
182 
183  // jump from one TP to an other:
184  TanRaDecToPixel raDecToCommonTangentPlane(identity, commonTangentPoint);
185  TanPixelToRaDec TangentPlaneToRaDec(identity, tangentPoint);
186  _tangentPlaneToCommonTangentPlane = compose(raDecToCommonTangentPlane, TangentPlaneToRaDec);
187  _skyToTangentPlane.reset(new TanRaDecToPixel(identity, tangentPoint));
188 
189  // this one is needed for matches :
190  _pixelToCommonTangentPlane = compose(raDecToCommonTangentPlane, *_readWcs);
191 }
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: