LSSTApplications
20.0.0
LSSTDataManagementBasePackage
|
A 2-dimensional celestial WCS that transform pixels to ICRS RA/Dec, using the LSST standard for pixels.
More...
#include <SkyWcs.h>
|
| SkyWcs (SkyWcs const &)=default |
|
| SkyWcs (SkyWcs &&)=default |
|
SkyWcs & | operator= (SkyWcs const &)=delete |
|
SkyWcs & | operator= (SkyWcs &&)=delete |
|
| ~SkyWcs () override=default |
|
bool | operator== (SkyWcs const &other) const |
| Equality is based on the string representations being equal. More...
|
|
bool | operator!= (SkyWcs const &other) const |
|
| SkyWcs (daf::base::PropertySet &metadata, bool strip=false) |
| Construct a SkyWcs from FITS keywords. More...
|
|
| SkyWcs (ast::FrameDict const &frameDict) |
| Construct a SkyWcs from an ast::FrameDict. More...
|
|
std::shared_ptr< SkyWcs > | copyAtShiftedPixelOrigin (lsst::geom::Extent2D const &shift) const |
| Return a copy of this SkyWcs with the pixel origin shifted by the specified amount. More...
|
|
std::shared_ptr< daf::base::PropertyList > | getFitsMetadata (bool precise=false) const |
| Return the WCS as FITS WCS metadata. More...
|
|
lsst::geom::Angle | getPixelScale (lsst::geom::Point2D const &pixel) const |
| Get the pixel scale at the specified pixel position. More...
|
|
lsst::geom::Angle | getPixelScale () const |
| Get the pixel scale at the pixel origin. More...
|
|
lsst::geom::Point2D | getPixelOrigin () const |
| Get the pixel origin, in pixels, using the LSST convention. More...
|
|
lsst::geom::SpherePoint | getSkyOrigin () const |
| Get the sky origin, the celestial fiducial point. More...
|
|
Eigen::Matrix2d | getCdMatrix (lsst::geom::Point2D const &pixel) const |
| Get the 2x2 CD matrix at the specified pixel position. More...
|
|
Eigen::Matrix2d | getCdMatrix () const |
| Get the 2x2 CD matrix at the pixel origin. More...
|
|
std::shared_ptr< SkyWcs > | getTanWcs (lsst::geom::Point2D const &pixel) const |
| Get a local TAN WCS approximation to this WCS at the specified pixel position. More...
|
|
std::shared_ptr< const ast::FrameDict > | getFrameDict () const |
| Get the contained FrameDict. More...
|
|
std::shared_ptr< const TransformPoint2ToSpherePoint > | getTransform () const |
| Get a TransformPoint2ToSpherePoint that transforms pixels to sky in the forward direction and sky to pixels in the inverse direction. More...
|
|
bool | isFlipped () const |
| Does the WCS follow the convention of North=Up, East=Left? More...
|
|
bool | isPersistable () const noexcept override |
| Return true if this particular object can be persisted using afw::table::io. More...
|
|
lsst::geom::AffineTransform | linearizePixelToSky (lsst::geom::SpherePoint const &coord, lsst::geom::AngleUnit const &skyUnit) const |
| Return the local linear approximation to pixelToSky at a point given in sky coordinates. More...
|
|
lsst::geom::AffineTransform | linearizePixelToSky (lsst::geom::Point2D const &pixel, lsst::geom::AngleUnit const &skyUnit) const |
| Return the local linear approximation to pixelToSky at a point given in pixel coordinates. More...
|
|
lsst::geom::AffineTransform | linearizeSkyToPixel (lsst::geom::SpherePoint const &coord, lsst::geom::AngleUnit const &skyUnit) const |
| Return the local linear approximation to skyToPixel at a point given in sky coordinates. More...
|
|
lsst::geom::AffineTransform | linearizeSkyToPixel (lsst::geom::Point2D const &pixel, lsst::geom::AngleUnit const &skyUnit) const |
| Return the local linear approximation to skyToPixel at a point given in pixel coordinates. More...
|
|
lsst::geom::SpherePoint | pixelToSky (lsst::geom::Point2D const &pixel) const |
| Compute sky position(s) from pixel position(s) More...
|
|
lsst::geom::SpherePoint | pixelToSky (double x, double y) const |
|
std::vector< lsst::geom::SpherePoint > | pixelToSky (std::vector< lsst::geom::Point2D > const &pixels) const |
|
lsst::geom::Point2D | skyToPixel (lsst::geom::SpherePoint const &sky) const |
| Compute pixel position(s) from sky position(s) More...
|
|
std::vector< lsst::geom::Point2D > | skyToPixel (std::vector< lsst::geom::SpherePoint > const &sky) const |
|
bool | hasFitsApproximation () const |
| Does this SkyWcs have an approximate SkyWcs that can be represented as standard FITS WCS? More...
|
|
bool | isFits () const |
| Return true getFitsMetadata(true) will succeed, false if not. More...
|
|
void | writeStream (std::ostream &os) const |
| Serialize this SkyWcs to an output stream. More...
|
|
std::string | writeString () const |
| Serialize this SkyWcs to a string, using the same format as writeStream. More...
|
|
std::shared_ptr< typehandling::Storable > | cloneStorable () const override |
| Create a new SkyWcs that is a copy of this one. More...
|
|
std::string | toString () const override |
| Create a string representation of this object. More...
|
|
bool | equals (typehandling::Storable const &other) const noexcept override |
| Compare this object to another Storable. More...
|
|
virtual std::size_t | hash_value () const |
| Return a hash of this object (optional operation). More...
|
|
void | writeFits (std::string const &fileName, std::string const &mode="w") const |
| Write the object to a regular FITS file. More...
|
|
void | writeFits (fits::MemFileManager &manager, std::string const &mode="w") const |
| Write the object to a FITS image in memory. More...
|
|
void | writeFits (fits::Fits &fitsfile) const |
| Write the object to an already-open FITS object. More...
|
|
|
template<class T > |
static bool | singleClassEquals (T const &lhs, Storable const &rhs) |
| Test if a Storable is of a particular class and equal to another object. More...
|
|
A 2-dimensional celestial WCS that transform pixels to ICRS RA/Dec, using the LSST standard for pixels.
SkyWcs is an immutable object that can not only represent any standard FITS WCS, but can also contain arbitrary Transforms, e.g. to model optical distortion or pixel imperfections.
In order to make a SkyWcs that models optical distortion, say, it is usually simplest to start with a standard FITS WCS (such as a TAN WCS) as an approximation, then insert a transform that models optical distortion by calling makeModifiedWcs. However, it is also possible to build a SkyWcs entirely from transforms, if you prefer, by building an ast::FrameDict and constructing the SkyWcs from that.
Frames of reference
SkyWcs internally keeps track of the following frames of reference:
- cameraGeom::ACTUAL_PIXELS (optional): "actual" pixel position using the LSST standard. This has the same meaning as the cameraGeom::ACTUAL_PIXELS frame: actual pixels include effects such as "tree ring" distortions and electrical effects at the edge of CCDs. This frame should only be provided if there is a reasonable model for these imperfections.
- cameraGeom::PIXELS: nominal pixel position, using the LSST standard. This has the same meaning as the cameraGeom::PIXELS frame: nominal pixels may be rectangular, but are uniform in size and spacing.
- IWC: intermediate world coordinates (the FITS WCS concept).
- SKY: position on the sky as ICRS, with standard RA, Dec axis order.
Pixel position standards
The LSST standard for pixel position is: 0,0 is the center of the lower left image pixel. The FITS standard for pixel position is: 1,1 is the center of the lower left image pixel.
LSST and FITS also use a different origin for subimages:
- LSST pixel position is in the frame of reference of the parent image
- FITS pixel position is in the frame of reference of the subimage However, SkyWcs does not keep track of this difference. Code that persists and unpersists SkyWcs using FITS-WCS header cards must handle the offset, e.g. by calling
copyAtShiftedPixelOrigin
Internal details: the contained ast::FrameDict
SkyWcs contains an ast::FrameDict which transforms from pixels to sky (in radians) in the forward direction.
This FrameDict contains the named frames described in frames of reference, e.g. "SKY", "IWC", cameraGeom::PIXELS and possibly cameraGeom::ACTUAL_PIXELS. "SKY" is the current frame. If cameraGeom::ACTUAL_PIXELS is present then it is the base frame, otherwise cameraGeom::PIXELS is the base frame.
The "SKY" frame is of type ast::SkyFrame and has the following attributes:
SkyRef
is set to the sky origin of the WCS (ICRS RA, Dec) in radians.
SkyRefIs
is set to "Ignored" so that SkyRef is not used in transformations.
The other frames are of type ast::Frame and have 2 axes.
Definition at line 117 of file SkyWcs.h.
◆ OutputArchiveHandle
◆ SkyWcs() [1/4]
lsst::afw::geom::SkyWcs::SkyWcs |
( |
SkyWcs const & |
| ) |
|
|
default |
◆ SkyWcs() [2/4]
lsst::afw::geom::SkyWcs::SkyWcs |
( |
SkyWcs && |
| ) |
|
|
default |
◆ ~SkyWcs()
lsst::afw::geom::SkyWcs::~SkyWcs |
( |
| ) |
|
|
overridedefault |
◆ SkyWcs() [3/4]
Construct a SkyWcs from FITS keywords.
- Parameters
-
[in] | metadata | FITS header metadata |
[in] | strip | If true: strip items from metadata used to create the WCS, such as RADESYS, EQUINOX, CTYPE12, CRPIX12, CRVAL12, etc. Always keep keywords that might be wanted for other purpposes, including NAXIS12 and date-related keywords such as "DATE-OBS" and "TIMESYS" (but not "EQUINOX"). |
- Exceptions
-
Definition at line 156 of file SkyWcs.cc.
◆ SkyWcs() [4/4]
Construct a SkyWcs from an ast::FrameDict.
This is the most general constructor; it can be used to define any celestial WCS. Note that in many cases the result will not be exactly representable as a FITS WCS.
- Parameters
-
- Exceptions
-
Definition at line 159 of file SkyWcs.cc.
159 :
SkyWcs(_checkFrameDict(frameDict)) {}
◆ cloneStorable()
◆ copyAtShiftedPixelOrigin()
Return a copy of this SkyWcs with the pixel origin shifted by the specified amount.
new pixel origin = the old pixel origin + shift
- Parameters
-
[in] | shift | The amount by which to shift the pixel origin (pixels) |
Definition at line 213 of file SkyWcs.cc.
◆ dynamicCast()
Dynamically cast a shared_ptr.
Dynamically cast a shared pointer and raise on failure.
You must provide an explicit template instantiation in the .cc file for each class that inherits from PersistableFacade. Designed to work around RTTI issues on macOS with hidden symbols;
- Exceptions
-
param[in] ptr The pointer to be cast.
- Returns
- The cast pointer.
- Exceptions
-
Definition at line 218 of file Persistable.cc.
19 auto result = std::dynamic_pointer_cast<T>(
ptr);
21 throw LSST_EXCEPT(pex::exceptions::TypeError,
"Dynamic pointer cast failed");
◆ equals()
◆ getCdMatrix() [1/2]
Eigen::Matrix2d lsst::afw::geom::SkyWcs::getCdMatrix |
( |
| ) |
const |
Get the 2x2 CD matrix at the pixel origin.
The elements are in degrees
Definition at line 204 of file SkyWcs.cc.
◆ getCdMatrix() [2/2]
Eigen::Matrix2d lsst::afw::geom::SkyWcs::getCdMatrix |
( |
lsst::geom::Point2D const & |
pixel | ) |
const |
Get the 2x2 CD matrix at the specified pixel position.
The elements are in degrees
Definition at line 198 of file SkyWcs.cc.
201 return pixelToIwcTransform.getJacobian(
pixel);
◆ getFitsMetadata()
Return the WCS as FITS WCS metadata.
- Parameters
-
[in] | precise | Fail if the WCS cannot be accurately represented as FITS metadata? If False then return an approximation. For now that approximation is pure TAN but as of DM-13170 it will be a fit TAN-SIP. The required precision is set by constant TIGHT_FITS_TOL in SkyWcs.cc |
FITS representations of WCS are described in "Representations of World Coordinates in FITS" by Greisen and Calabretta and several related papers.
The required precision is hard-coded as constant TIGHT_FITS_TOL in SkyWcs.cc
- Exceptions
-
Definition at line 218 of file SkyWcs.cc.
223 auto const iwcToSky = thisDict->getMapping(
"IWC",
"SKY");
224 auto const gridToSky = gridToPixel.
then(*pixelToIwc).
then(*iwcToSky);
229 os <<
"Encoding=FITS-WCS, CDMatrix=1, FitsAxisOrder=<copy>, FitsTol=" << TIGHT_FITS_TOL;
232 int const nObjectsWritten = fitsChan.write(
frameSet);
234 if (nObjectsWritten == 0) {
237 "Could not represent this SkyWcs using FITS-WCS metadata");
242 header = tanWcs->getFitsMetadata(
true);
249 header->remove(
"DATE-OBS");
250 header->remove(
"MJD-OBS");
253 bool const hasCd11 = header->exists(
"CD1_1");
254 bool const hasCd12 = header->exists(
"CD1_2");
255 bool const hasCd21 = header->exists(
"CD2_1");
256 bool const hasCd22 = header->exists(
"CD2_2");
257 if (hasCd11 || hasCd12 || hasCd21 || hasCd22) {
258 if (!hasCd11) header->set(
"CD1_1", 0.0,
"Transformation matrix element");
259 if (!hasCd12) header->set(
"CD1_2", 0.0,
"Transformation matrix element");
260 if (!hasCd21) header->set(
"CD2_1", 0.0,
"Transformation matrix element");
261 if (!hasCd22) header->set(
"CD2_2", 0.0,
"Transformation matrix element");
◆ getFrameDict()
◆ getPersistenceName()
std::string lsst::afw::geom::SkyWcs::getPersistenceName |
( |
| ) |
const |
|
overrideprotectedvirtual |
Return the unique name used to persist this object and look up its factory.
Must be less than ArchiveIndexSchema::MAX_NAME_LENGTH characters.
Reimplemented from lsst::afw::table::io::Persistable.
Definition at line 382 of file SkyWcs.cc.
382 {
return getSkyWcsPersistenceName(); }
◆ getPixelOrigin()
Get the pixel origin, in pixels, using the LSST convention.
This is CRPIX1 - 1, CRPIX2 -1 in FITS terminology
Definition at line 215 of file SkyWcs.h.
215 {
return _pixelOrigin; };
◆ getPixelScale() [1/2]
Get the pixel scale at the pixel origin.
The scale is the square root of the area of the specified pixel on the sky.
The value is cached, so this is a cheap call.
Definition at line 208 of file SkyWcs.h.
208 {
return _pixelScaleAtOrigin; };
◆ getPixelScale() [2/2]
Get the pixel scale at the specified pixel position.
The scale is the square root of the area of the specified pixel on the sky.
- Warning
- Unlike getPixelScale() the value is not cached, even if pixel = pixel origin.
Definition at line 163 of file SkyWcs.cc.
166 double const side = 1.0;
176 auto skyLL = skyVec[0].getVector();
177 auto skyDx = skyVec[1].getVector() - skyLL;
178 auto skyDy = skyVec[2].getVector() - skyLL;
183 double skyAreaSq = skyDx.cross(skyDy).getSquaredNorm();
◆ getPythonModule()
std::string lsst::afw::geom::SkyWcs::getPythonModule |
( |
| ) |
const |
|
overrideprotectedvirtual |
Return the fully-qualified Python module that should be imported to guarantee that its factory is registered.
Must be less than ArchiveIndexSchema::MAX_MODULE_LENGTH characters.
Will be ignored if empty.
Reimplemented from lsst::afw::table::io::Persistable.
Definition at line 384 of file SkyWcs.cc.
384 {
return "lsst.afw.geom"; }
◆ getShortClassName()
std::string lsst::afw::geom::SkyWcs::getShortClassName |
( |
| ) |
|
|
static |
Definition at line 299 of file SkyWcs.cc.
299 {
return "SkyWcs"; };
◆ getSkyOrigin()
Get the sky origin, the celestial fiducial point.
This is CRVAL1, CRVAL2 in FITS terminology
Definition at line 187 of file SkyWcs.cc.
189 auto skyFrame = std::dynamic_pointer_cast<ast::SkyFrame>(
192 throw LSST_EXCEPT(pex::exceptions::LogicError,
"Current frame is not a SkyFrame");
194 auto const crvalRad = skyFrame->getSkyRef();
◆ getTanWcs()
Get a local TAN WCS approximation to this WCS at the specified pixel position.
Definition at line 206 of file SkyWcs.cc.
210 return std::make_shared<SkyWcs>(*metadata);
◆ getTransform()
Get a TransformPoint2ToSpherePoint that transforms pixels to sky in the forward direction and sky to pixels in the inverse direction.
Definition at line 257 of file SkyWcs.h.
257 {
return _transform; };
◆ hasFitsApproximation()
bool lsst::afw::geom::SkyWcs::hasFitsApproximation |
( |
| ) |
const |
|
inline |
Does this SkyWcs have an approximate SkyWcs that can be represented as standard FITS WCS?
This feature is not yet implemented, so hasFitsApproximation is always false.
Definition at line 364 of file SkyWcs.h.
◆ hash_value()
std::size_t lsst::afw::typehandling::Storable::hash_value |
( |
| ) |
const |
|
virtualinherited |
◆ isFits()
bool lsst::afw::geom::SkyWcs::isFits |
( |
| ) |
const |
Return true getFitsMetadata(true) will succeed, false if not.
In other words, true indicates that the WCS can be accurately represented using FITS WCS metadata.
Definition at line 269 of file SkyWcs.cc.
◆ isFlipped()
bool lsst::afw::geom::SkyWcs::isFlipped |
( |
| ) |
const |
Does the WCS follow the convention of North=Up, East=Left?
- Returns
- False/true if E is along -X/+X when the N/E axes are rotated so that N is along image +Y.
- Exceptions
-
Definition at line 301 of file SkyWcs.cc.
304 throw(
LSST_EXCEPT(pex::exceptions::RuntimeError,
"CD matrix is singular"));
◆ isPersistable()
bool lsst::afw::geom::SkyWcs::isPersistable |
( |
| ) |
const |
|
inlineoverridevirtualnoexcept |
◆ linearizePixelToSky() [1/2]
Return the local linear approximation to pixelToSky at a point given in pixel coordinates.
The local linear approximation is defined such the following is true (ignoring floating-point errors):
wcs.linearizePixelToSky(pixel, skyUnit)(pixel) == wcs.pixelToSky(pixel).getPosition(skyUnit)
(lsst::geom::AffineTransform::operator() applies the transform in the forward direction)
- Parameters
-
[in] | pixel | Position in pixel coordinates where transform is desired. |
[in] | skyUnit | Units to use for sky coordinates; units of matrix elements will be skyUnits/pixel. |
Definition at line 284 of file SkyWcs.cc.
286 return _linearizePixelToSky(pix,
pixelToSky(pix), skyUnit);
◆ linearizePixelToSky() [2/2]
Return the local linear approximation to pixelToSky at a point given in sky coordinates.
The local linear approximation is defined such the following is true (ignoring floating-point errors):
wcs.linearizePixelToSky(sky, skyUnit)(wcs.skyToPixel(sky)) == sky.getPosition(skyUnit);
(lsst::geom::AffineTransform::operator() applies the transform in the forward direction)
- Parameters
-
[in] | coord | Position in sky coordinates where transform is desired. |
[in] | skyUnit | Units to use for sky coordinates; units of matrix elements will be skyUnits/pixel. |
Definition at line 280 of file SkyWcs.cc.
282 return _linearizePixelToSky(
skyToPixel(coord), coord, skyUnit);
◆ linearizeSkyToPixel() [1/2]
Return the local linear approximation to skyToPixel at a point given in pixel coordinates.
The local linear approximation is defined such the following is true (ignoring floating-point errors):
wcs.linearizeSkyToPixel(pixel, skyUnit)(wcs.pixelToSky(pixel).getPosition(skyUnit)) == pixel
(lsst::geom::AffineTransform::operator() applies the transform in the forward direction)
- Parameters
-
[in] | pixel | Position in pixel coordinates where transform is desired. |
[in] | skyUnit | Units to use for sky coordinates; units of matrix elements will be pixels/skyUnit. |
Definition at line 294 of file SkyWcs.cc.
296 return _linearizeSkyToPixel(pix,
pixelToSky(pix), skyUnit);
◆ linearizeSkyToPixel() [2/2]
Return the local linear approximation to skyToPixel at a point given in sky coordinates.
The local linear approximation is defined such the following is true (ignoring floating-point errors):
wcs.linearizeSkyToPixel(sky, skyUnit)(sky.getPosition(skyUnit)) == wcs.skyToPixel(sky)
(lsst::geom::AffineTransform::operator() applies the transform in the forward direction)
- Parameters
-
[in] | coord | Position in sky coordinates where transform is desired. |
[in] | skyUnit | Units to use for sky coordinates; units of matrix elements will be pixels/skyUnit. |
Definition at line 289 of file SkyWcs.cc.
291 return _linearizeSkyToPixel(
skyToPixel(coord), coord, skyUnit);
◆ operator!=()
bool lsst::afw::geom::SkyWcs::operator!= |
( |
SkyWcs const & |
other | ) |
const |
|
inline |
◆ operator=() [1/2]
◆ operator=() [2/2]
SkyWcs& lsst::afw::geom::SkyWcs::operator= |
( |
SkyWcs const & |
| ) |
|
|
delete |
◆ operator==()
bool lsst::afw::geom::SkyWcs::operator== |
( |
SkyWcs const & |
other | ) |
const |
Equality is based on the string representations being equal.
Two SkyWcs constructed the same way will be equal, and a SkyWcs that has been saved and restored will be equal to the original. However, it is possible to construct two SkyWcs that behave identically as far as transforming points go, but will compare as unequal due to subtle internal differences, such as a contained ast::Mapping that has a different ID in one SkyWcs than another.
Thus equality is primarily useful for testing persistence.
Definition at line 161 of file SkyWcs.cc.
◆ pixelToSky() [1/3]
◆ pixelToSky() [2/3]
Compute sky position(s) from pixel position(s)
Definition at line 334 of file SkyWcs.h.
335 return _transform->applyForward(
pixel);
◆ pixelToSky() [3/3]
Definition at line 340 of file SkyWcs.h.
341 return _transform->applyForward(pixels);
◆ readFits() [1/3]
Read an object from an already open FITS object.
- Parameters
-
[in] | fitsfile | FITS object to read from, already positioned at the desired HDU. |
Definition at line 183 of file Persistable.h.
184 return dynamicCast(Persistable::_readFits(fitsfile));
◆ readFits() [2/3]
Read an object from a FITS file in memory.
- Parameters
-
[in] | manager | Manager for the memory to read from. |
[in] | hdu | HDU to read, where 0 is the primary. The special value of afw::fits::DEFAULT_HDU skips the primary HDU if it is empty. |
Definition at line 205 of file Persistable.h.
206 return dynamicCast(Persistable::_readFits(manager, hdu));
◆ readFits() [3/3]
Read an object from a regular FITS file.
- Parameters
-
[in] | fileName | Name of the file to read. |
[in] | hdu | HDU to read, where 0 is the primary. The special value of afw::fits::DEFAULT_HDU skips the primary HDU if it is empty. |
Definition at line 194 of file Persistable.h.
195 return dynamicCast(Persistable::_readFits(fileName, hdu));
◆ readStream()
Deserialize a SkyWcs from an input stream.
- Parameters
-
[in] | is | input stream from which to deserialize this SkyWcs |
Definition at line 309 of file SkyWcs.cc.
316 is >> shortClassName;
326 auto frameSet = std::dynamic_pointer_cast<ast::FrameSet>(astObjectPtr);
329 os <<
"The AST serialization was read as a " << astObjectPtr->getClassName()
330 <<
" instead of a FrameSet";
334 return std::make_shared<SkyWcs>(frameDict);
◆ readString()
Deserialize a SkyWcs from a string, using the same format as readStream.
Definition at line 337 of file SkyWcs.cc.
◆ singleClassEquals()
template<class T >
static bool lsst::afw::typehandling::Storable::singleClassEquals |
( |
T const & |
lhs, |
|
|
Storable const & |
rhs |
|
) |
| |
|
inlinestaticprotectedinherited |
Test if a Storable is of a particular class and equal to another object.
This method template simplifies implementations of equals that delegate to operator==
without supporting cross-class comparisons.
- Template Parameters
-
T | The class expected of the two objects to be compared. |
- Parameters
-
lhs,rhs | The objects to compare. Note that rhs need not be a T , while lhs must be. |
- Returns
true
if rhs
is a T
and lhs == rhs
; false
otherwise.
- Exception Safety\n Provides the same level of exception safety as operator==.
- Most implementations of
operator==
do not throw.
- Note
- This method template calls
operator==
with both arguments of compile-time type T const&
. Its use is not recommended if there would be any ambiguity as to which operator==
gets picked by overload resolution.
This method template is typically called from equals as:
bool MyType::equals(Storable const& other) const noexcept {
return singleClassEquals(*this, other);
}
Definition at line 151 of file Storable.h.
152 auto typedRhs =
dynamic_cast<T const*
>(&rhs);
153 if (typedRhs !=
nullptr) {
154 return lhs == *typedRhs;
◆ skyToPixel() [1/2]
Compute pixel position(s) from sky position(s)
Definition at line 349 of file SkyWcs.h.
350 return _transform->applyInverse(sky);
◆ skyToPixel() [2/2]
Definition at line 352 of file SkyWcs.h.
353 return _transform->applyInverse(sky);
◆ toString()
std::string lsst::afw::geom::SkyWcs::toString |
( |
| ) |
const |
|
overridevirtual |
Create a string representation of this object.
An example of the output might look like this (note the newlines):
FITS standard SkyWcs:
Sky Origin: (0.000000, +45.000000)
Pixel Origin: (100, 100)
Pixel Scale: 1 arcsec/pixel
Reimplemented from lsst::afw::typehandling::Storable.
Definition at line 357 of file SkyWcs.cc.
360 os <<
"FITS standard SkyWcs:";
362 os <<
"Non-standard SkyWcs (Frames: ";
◆ write()
Write the object to one or more catalogs.
The handle object passed to this function provides an interface for adding new catalogs and adding nested objects to the same archive (while checking for duplicates). See OutputArchiveHandle for more information.
Reimplemented from lsst::afw::table::io::Persistable.
Definition at line 386 of file SkyWcs.cc.
387 SkyWcsPersistenceHelper
const&
keys = SkyWcsPersistenceHelper::get();
391 handle.saveCatalog(cat);
◆ writeFits() [1/3]
void lsst::afw::table::io::Persistable::writeFits |
( |
fits::Fits & |
fitsfile | ) |
const |
|
inherited |
Write the object to an already-open FITS object.
- Parameters
-
[in] | fitsfile | Open FITS object to write to. |
Definition at line 18 of file Persistable.cc.
19 OutputArchive archive;
21 archive.writeFits(fitsfile);
◆ writeFits() [2/3]
Write the object to a FITS image in memory.
- Parameters
-
[in] | manager | Name of the file to write to. |
[in] | mode | If "w", any existing file with the given name will be overwritten. If "a", new HDUs will be appended to an existing file. |
Definition at line 29 of file Persistable.cc.
◆ writeFits() [3/3]
void lsst::afw::table::io::Persistable::writeFits |
( |
std::string const & |
fileName, |
|
|
std::string const & |
mode = "w" |
|
) |
| const |
|
inherited |
Write the object to a regular FITS file.
- Parameters
-
[in] | fileName | Name of the file to write to. |
[in] | mode | If "w", any existing file with the given name will be overwritten. If "a", new HDUs will be appended to an existing file. |
Definition at line 24 of file Persistable.cc.
◆ writeStream()
void lsst::afw::geom::SkyWcs::writeStream |
( |
std::ostream & |
os | ) |
const |
Serialize this SkyWcs to an output stream.
Version 1 format is as follows:
If and when fits approximation is supported, the approximate WCS will be written as a second FrameDict immediately following the first.
- Parameters
-
[out] | os | output stream to which to serialize this SkyWcs |
Definition at line 342 of file SkyWcs.cc.
◆ writeString()
std::string lsst::afw::geom::SkyWcs::writeString |
( |
| ) |
const |
Serialize this SkyWcs to a string, using the same format as writeStream.
Definition at line 347 of file SkyWcs.cc.
◆ operator<<()
Output operator for Storable.
- Parameters
-
os | the desired output stream |
storable | the object to print |
- Returns
- a reference to
os
- Exceptions
-
UnsupportedOperationException | Thrown if storable does not have an implementation of Storable::toString. |
Definition at line 174 of file Storable.h.
175 return os << storable.toString();
The documentation for this class was generated from the following files:
- /j/snowflake/release/lsstsw/stack/1a1d771/Linux64/afw/20.0.0/include/lsst/afw/geom/SkyWcs.h
- /j/snowflake/release/lsstsw/stack/1a1d771/Linux64/afw/20.0.0/src/geom/SkyWcs.cc
std::shared_ptr< Mapping > getMapping(int from, std::string const &to) const
Variant of FrameSet::getMapping with the second frame specified by domain.
bool isFits() const
Return true getFitsMetadata(true) will succeed, false if not.
void writeFits(std::string const &fileName, std::string const &mode="w") const
Write the object to a regular FITS file.
A FrameSet consists of a set of one or more Frames (which describe coordinate systems),...
lsst::geom::SpherePoint SpherePoint
table::Key< int > version
SeriesMap then(Mapping const &next) const
Return a series compound mapping this(first(input)) containing shallow copies of the original.
std::shared_ptr< daf::base::PropertyList > getPropertyListFromFitsChan(ast::FitsChan &fitsChan)
Copy values from an AST FitsChan into a PropertyList.
A specialized form of Channel which reads and writes FITS header cards.
A FrameSet whose frames can be referenced by domain name.
std::shared_ptr< SkyWcs > makeModifiedWcs(TransformPoint2ToPoint2 const &pixelTransform, SkyWcs const &wcs, bool modifyActualPixels)
Create a new SkyWcs whose pixels are transformed by pixelTransform, as described below.
table::PointKey< double > crval
std::shared_ptr< Frame > getFrame(std::string const &domain, bool copy=true) const
Variant of getFrame(int, bool) where the frame is specified by domain name.
Channel provides input/output of AST objects.
SkyWcs(SkyWcs const &)=default
A stream for ast::Channel.
std::shared_ptr< ast::FrameDict > readLsstSkyWcs(daf::base::PropertySet &metadata, bool strip=true)
Read an LSST celestial WCS FrameDict from a FITS header.
static std::string getShortClassName()
Frame is used to represent a coordinate system.
static constexpr int CURRENT
index of current frame
lsst::geom::Point2D skyToPixel(lsst::geom::SpherePoint const &sky) const
Compute pixel position(s) from sky position(s)
ShiftMap is a linear Mapping which shifts each axis by a specified constant value.
Eigen::Matrix2d getCdMatrix() const
Get the 2x2 CD matrix at the pixel origin.
ItemVariant const * other
void show(std::ostream &os, bool showComments=true) const
Print a textual description the object to an ostream.
Transform< Point2Endpoint, Point2Endpoint > TransformPoint2ToPoint2
table::PointKey< int > pixel
lsst::geom::SpherePoint pixelToSky(lsst::geom::Point2D const &pixel) const
Compute sky position(s) from pixel position(s)
String-based source and sink for channels.
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
std::shared_ptr< Object > read()
Read an object from a channel.
std::shared_ptr< SkyWcs > getTanWcs(lsst::geom::Point2D const &pixel) const
Get a local TAN WCS approximation to this WCS at the specified pixel position.
CatalogT< BaseRecord > BaseCatalog
std::shared_ptr< const ast::FrameDict > getFrameDict() const
Get the contained FrameDict.
static std::shared_ptr< SkyWcs > dynamicCast(std::shared_ptr< Persistable > const &ptr)
Dynamically cast a shared_ptr.
static constexpr int BASE
index of base frame
std::shared_ptr< daf::base::PropertyList > getFitsMetadata(bool precise=false) const
Return the WCS as FITS WCS metadata.
lsst::geom::Angle getPixelScale() const
Get the pixel scale at the pixel origin.
bool hasFitsApproximation() const
Does this SkyWcs have an approximate SkyWcs that can be represented as standard FITS WCS?
constexpr AngleUnit radians
constant with units of radians
Extent< double, 2 > Extent2D
lsst::geom::Point2D getPixelOrigin() const
Get the pixel origin, in pixels, using the LSST convention.
std::shared_ptr< daf::base::PropertyList > makeSimpleWcsMetadata(lsst::geom::Point2D const &crpix, lsst::geom::SpherePoint const &crval, Eigen::Matrix2d const &cdMatrix, std::string const &projection="TAN")
Make FITS metadata for a simple FITS WCS (one with no distortion).
std::string writeString() const
Serialize this SkyWcs to a string, using the same format as writeStream.
static std::shared_ptr< SkyWcs > readStream(std::istream &is)
Deserialize a SkyWcs from an input stream.
constexpr double asArcseconds() const noexcept
Return an Angle's value in arcseconds.
lsst::geom::SpherePoint getSkyOrigin() const
Get the sky origin, the celestial fiducial point.
void writeStream(std::ostream &os) const
Serialize this SkyWcs to an output stream.
std::set< std::string > getAllDomains() const
Get the domain names for all contained Frames (excluding frames with empty or defaulted domain names)...
Reports errors that are due to events beyond the control of the program.
static bool singleClassEquals(T const &lhs, Storable const &rhs)
Test if a Storable is of a particular class and equal to another object.