LSSTApplications  19.0.0-14-gb0260a2+72efe9b372,20.0.0+7927753e06,20.0.0+8829bf0056,20.0.0+995114c5d2,20.0.0+b6f4b2abd1,20.0.0+bddc4f4cbe,20.0.0-1-g253301a+8829bf0056,20.0.0-1-g2b7511a+0d71a2d77f,20.0.0-1-g5b95a8c+7461dd0434,20.0.0-12-g321c96ea+23efe4bbff,20.0.0-16-gfab17e72e+fdf35455f6,20.0.0-2-g0070d88+ba3ffc8f0b,20.0.0-2-g4dae9ad+ee58a624b3,20.0.0-2-g61b8584+5d3db074ba,20.0.0-2-gb780d76+d529cf1a41,20.0.0-2-ged6426c+226a441f5f,20.0.0-2-gf072044+8829bf0056,20.0.0-2-gf1f7952+ee58a624b3,20.0.0-20-geae50cf+e37fec0aee,20.0.0-25-g3dcad98+544a109665,20.0.0-25-g5eafb0f+ee58a624b3,20.0.0-27-g64178ef+f1f297b00a,20.0.0-3-g4cc78c6+e0676b0dc8,20.0.0-3-g8f21e14+4fd2c12c9a,20.0.0-3-gbd60e8c+187b78b4b8,20.0.0-3-gbecbe05+48431fa087,20.0.0-38-ge4adf513+a12e1f8e37,20.0.0-4-g97dc21a+544a109665,20.0.0-4-gb4befbc+087873070b,20.0.0-4-gf910f65+5d3db074ba,20.0.0-5-gdfe0fee+199202a608,20.0.0-5-gfbfe500+d529cf1a41,20.0.0-6-g64f541c+d529cf1a41,20.0.0-6-g9a5b7a1+a1cd37312e,20.0.0-68-ga3f3dda+5fca18c6a4,20.0.0-9-g4aef684+e18322736b,w.2020.45
LSSTDataManagementBasePackage
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 getMjd () const
 Julian Date. More...
 
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  _mjd = visitInfo->getDate().get(lsst::daf::base::DateTime::MJD);
132  double latitude = visitInfo->getObservatory().getLatitude();
133  _lstObs = visitInfo->getEra();
134  _hourAngle = visitInfo->getBoresightHourAngle();
135 
136  // Some cameras don't manage ERA (and thus Hour Angle) properly, so it's going to be NaN.
137  // Because we need the refraction vector later, go with 0 HA to prevent crashes on that NaN.
138  if (std::isnan(_hourAngle) == true) {
139  _hourAngle = 0;
140  }
141 
142  if (_airMass == 1)
143  _sinEta = _cosEta = _tanZ = 0;
144  else {
145  double cosz = 1. / _airMass;
146  double sinz = std::sqrt(1 - cosz * cosz); // astronomers usually observe above the horizon
147  _tanZ = sinz / cosz;
148  // TODO: as part of DM-12473, we can remove all of this and just call _visitInfo.getParallacticAngle()
149  double dec = _boresightRaDec.getLatitude();
150  // x/y components of refraction angle, eta.]
151  double yEta = std::sin(_hourAngle);
152  double xEta = std::cos(dec) * std::tan(latitude) - std::sin(dec) * std::cos(_hourAngle);
153  double eta = std::atan2(yEta, xEta);
154  _sinEta = std::sin(eta);
155  _cosEta = std::cos(eta);
156  }
157 }

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

159  {
160  int measuredStars = 0;
161  int refStars = 0;
162  for (auto const &measuredStar : _catalogForFit) {
163  if (measuredStar->isValid()) {
164  measuredStars++;
165  }
166  if ((measuredStar->getFittedStar() != nullptr) &&
167  (measuredStar->getFittedStar()->getRefStar() != nullptr)) {
168  refStars++;
169  }
170  }
171  return std::make_pair(measuredStars, refStars);
172 }

◆ 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 166 of file CcdImage.h.

166 { 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 176 of file CcdImage.h.

176 { 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; }

◆ getFilter()

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

return the CcdImage filter name

Definition at line 185 of file CcdImage.h.

185 { 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 168 of file CcdImage.h.

168 { return _hourAngle; }

◆ getImageFrame()

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

Frame in pixels.

Definition at line 191 of file CcdImage.h.

191 { return _imageFrame; }

◆ getLstObs()

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

Definition at line 170 of file CcdImage.h.

170 { return _lstObs; }

◆ getMjd()

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

Julian Date.

Definition at line 158 of file CcdImage.h.

158 { return _mjd; }

◆ 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 161 of file CcdImage.h.

161 { 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 188 of file CcdImage.h.

188 { return _readWcs; }

◆ getRefractionVector()

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

Definition at line 182 of file CcdImage.h.

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

◆ getSinEta()

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

Parallactic angle.

Definition at line 173 of file CcdImage.h.

173 { 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 179 of file CcdImage.h.

179 { 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  }

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

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

The documentation for this class was generated from the following files:
std::tan
T tan(T... args)
lsst::jointcal::StarList::copyTo
void copyTo(StarList< Star > &copy) const
clears copy and makes a copy of the std::list to copy
Definition: StarList.cc:68
lsst.pipe.tasks.assembleCoadd.filter
filter
Definition: assembleCoadd.py:342
std::atan2
T atan2(T... args)
wcs
table::Key< table::Array< std::uint8_t > > wcs
Definition: SkyWcs.cc:71
std::cos
T cos(T... args)
dec
double dec
Definition: Match.cc:41
std::stringstream
STL class.
crval
table::PointKey< double > crval
Definition: OldWcs.cc:130
std::sqrt
T sqrt(T... args)
std::list::clear
T clear(T... args)
std::isnan
T isnan(T... args)
lsst::jointcal::CcdImage::getWholeCatalog
MeasuredStarList const & getWholeCatalog() const
Gets the as-read catalog.
Definition: CcdImage.h:86
lsst::daf::base::DateTime::MJD
@ MJD
Definition: DateTime.h:66
std::sin
T sin(T... args)
photoCalib
Key< int > photoCalib
Definition: Exposure.cc:67
detector
table::Key< int > detector
Definition: DetectorCollection.cc:172
lsst::geom::SpherePoint::getLatitude
Angle getLatitude() const noexcept
The latitude of this point.
Definition: SpherePoint.h:190
lsst::jointcal::Point
A point in a plane.
Definition: Point.h:36
std::stringstream::str
T str(T... args)
std::make_pair
T make_pair(T... args)
lsst::jointcal::CcdImage::getCatalogForFit
MeasuredStarList const & getCatalogForFit() const
Gets the catalog to be used for fitting, which may have been cleaned-up.
Definition: CcdImage.h:94
latitude
table::Key< lsst::geom::Angle > latitude
Definition: VisitInfo.cc:171
lsst::jointcal::compose
std::unique_ptr< AstrometryTransform > compose(AstrometryTransform const &left, AstrometryTransform const &right)
Returns a pointer to a composition of transforms, representing left(right()).
Definition: AstrometryTransform.cc:426
lsst.pipe.tasks.assembleCoadd.visit
visit
Definition: assembleCoadd.py:343
visitInfo
Key< int > visitInfo
Definition: Exposure.cc:70
bbox
AmpInfoBoxKey bbox
Definition: Amplifier.cc:117