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
|
Transform LSST spatial data, such as lsst::geom::Point2D and lsst::geom::SpherePoint, using an AST mapping. More...
#include <Transform.h>
Public Types | |
using | FromArray = typename FromEndpoint::Array |
using | FromPoint = typename FromEndpoint::Point |
using | ToArray = typename ToEndpoint::Array |
using | ToPoint = typename ToEndpoint::Point |
Public Member Functions | |
Transform (Transform const &)=default | |
Transform (Transform &&)=default | |
Transform & | operator= (Transform const &)=delete |
Transform & | operator= (Transform &&)=delete |
~Transform () override=default | |
Transform (ast::Mapping const &mapping, bool simplify=true) | |
Construct a Transform from a deep copy of an ast::Mapping. More... | |
Transform (ast::FrameSet const &frameSet, bool simplify=true) | |
Construct a Transform from a deep copy of a ast::FrameSet. More... | |
bool | hasForward () const |
Test if this method has a forward transform. More... | |
bool | hasInverse () const |
Test if this method has an inverse transform. More... | |
FromEndpoint | getFromEndpoint () const |
Get the "from" endpoint. More... | |
std::shared_ptr< const ast::Mapping > | getMapping () const |
Get the contained mapping. More... | |
ToEndpoint | getToEndpoint () const |
Get the "to" endpoint. More... | |
ToPoint | applyForward (FromPoint const &point) const |
Transform one point in the forward direction ("from" to "to") More... | |
ToArray | applyForward (FromArray const &array) const |
Transform an array of points in the forward direction ("from" to "to") More... | |
FromPoint | applyInverse (ToPoint const &point) const |
Transform one point in the inverse direction ("to" to "from") More... | |
FromArray | applyInverse (ToArray const &array) const |
Transform an array of points in the inverse direction ("to" to "from") More... | |
std::shared_ptr< Transform< ToEndpoint, FromEndpoint > > | inverted () const |
The inverse of this Transform. More... | |
Eigen::MatrixXd | getJacobian (FromPoint const &x) const |
The Jacobian matrix of this Transform. More... | |
template<class NextToEndpoint > | |
std::shared_ptr< Transform< FromEndpoint, NextToEndpoint > > | then (Transform< ToEndpoint, NextToEndpoint > const &next, bool simplify=true) const |
Concatenate two Transforms. More... | |
void | writeStream (std::ostream &os) const |
Serialize this Transform to an output stream. More... | |
std::string | writeString () const |
Serialize this Transform to a string, using the same format as writeStream. More... | |
bool | isPersistable () const noexcept override |
Whether the Transform is persistable via afw::table::io (always true). 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... | |
Static Public Member Functions | |
static std::string | getShortClassName () |
Return a short version of the class name with no punctuation. More... | |
static std::shared_ptr< Transform< FromEndpoint, ToEndpoint > > | readStream (std::istream &is) |
Deserialize a Transform of this type from an input stream. More... | |
static std::shared_ptr< Transform< FromEndpoint, ToEndpoint > > | readString (std::string &str) |
Deserialize a Transform of this type from a string, using the same format as readStream. More... | |
static std::shared_ptr< Transform< FromEndpoint, ToEndpoint > > | readFits (fits::Fits &fitsfile) |
Read an object from an already open FITS object. More... | |
static std::shared_ptr< Transform< FromEndpoint, ToEndpoint > > | readFits (std::string const &fileName, int hdu=fits::DEFAULT_HDU) |
Read an object from a regular FITS file. More... | |
static std::shared_ptr< Transform< FromEndpoint, ToEndpoint > > | readFits (fits::MemFileManager &manager, int hdu=fits::DEFAULT_HDU) |
Read an object from a FITS file in memory. More... | |
static std::shared_ptr< Transform< FromEndpoint, ToEndpoint > > | dynamicCast (std::shared_ptr< Persistable > const &ptr) |
Dynamically cast a shared_ptr. More... | |
Protected Types | |
using | OutputArchiveHandle = io::OutputArchiveHandle |
Protected Member Functions | |
Transform (std::shared_ptr< ast::Mapping > mapping) | |
Construct a Transform from a shared pointer to an ast::Mapping. More... | |
std::string | getPersistenceName () const override |
Return the unique name used to persist this object and look up its factory. More... | |
std::string | getPythonModule () const override |
Return the fully-qualified Python module that should be imported to guarantee that its factory is registered. More... | |
void | write (OutputArchiveHandle &handle) const override |
Write the object to one or more catalogs. More... | |
Friends | |
class | SkyWcs |
Transform LSST spatial data, such as lsst::geom::Point2D and lsst::geom::SpherePoint, using an AST mapping.
This class contains two Endpoints, to specify the "from" and "to" LSST data type, and an ast::Mapping to specify the transformation.
Depending on the ast::FrameSet or ast::Mapping used to define it, a Transform may provide either a forward transform, an inverse transform, or both. In particular, the inverse of a forward-only transform is an inverse-only transform. The hasForward and hasInverse methods can be used to check which transforms are available.
Unless otherwise stated, all constructors and methods may throw std::runtime_error
to indicate internal errors within AST.
Transforms are always immutable.
applyForward
and applyInverse
are not available because data must be copied when converting from LSST data types to the type used by astshim, so it didn't seem worth the bother. Definition at line 67 of file Transform.h.
using lsst::afw::geom::Transform< FromEndpoint, ToEndpoint >::FromArray = typename FromEndpoint::Array |
Definition at line 73 of file Transform.h.
using lsst::afw::geom::Transform< FromEndpoint, ToEndpoint >::FromPoint = typename FromEndpoint::Point |
Definition at line 74 of file Transform.h.
|
protectedinherited |
Definition at line 108 of file Persistable.h.
using lsst::afw::geom::Transform< FromEndpoint, ToEndpoint >::ToArray = typename ToEndpoint::Array |
Definition at line 75 of file Transform.h.
using lsst::afw::geom::Transform< FromEndpoint, ToEndpoint >::ToPoint = typename ToEndpoint::Point |
Definition at line 76 of file Transform.h.
|
default |
|
default |
|
overridedefault |
|
explicit |
Construct a Transform from a deep copy of an ast::Mapping.
[in] | mapping | ast::Mapping describing the desired transformation |
[in] | simplify | Simplify the mapping? This combines component mappings where it is possible to do so without affecting accuracy. |
Definition at line 44 of file Transform.cc.
|
explicit |
Construct a Transform from a deep copy of a ast::FrameSet.
The result transforms from the "base" frame to the "current" frame of the provided FrameSet. The "from" endpoint is used to normalize the "base" frame and the "to" endpoint is used to normalize the "current" frame.
This is pickier than the constructor that takes an ast::Mapping in that:
[in] | frameSet | ast::FrameSet describing the desired transformation in the usual way: from "base" frame to "current" frame |
[in] | simplify | Simplify the mapping? This combines component mappings where it is possible to do so without affecting accuracy. |
Definition at line 50 of file Transform.cc.
|
explicitprotected |
Construct a Transform from a shared pointer to an ast::Mapping.
Definition at line 74 of file Transform.cc.
ToArray lsst::afw::geom::Transform< FromEndpoint, ToEndpoint >::applyForward | ( | FromArray const & | array | ) | const |
Transform an array of points in the forward direction ("from" to "to")
The first dimension of the array must match the number of input axes, and the data order is values for the first axis, then values for the next axis, and so on, e.g. for 2 axes: x0, x1, x2, ..., y0, y1, y2...
ToPoint lsst::afw::geom::Transform< FromEndpoint, ToEndpoint >::applyForward | ( | FromPoint const & | point | ) | const |
Transform one point in the forward direction ("from" to "to")
FromArray lsst::afw::geom::Transform< FromEndpoint, ToEndpoint >::applyInverse | ( | ToArray const & | array | ) | const |
Transform an array of points in the inverse direction ("to" to "from")
The first dimension of the array must match the number of output axes, and the data order is values for the first axis, then values for the next axis, and so on, e.g. for 2 axes: x0, x1, x2, ..., y0, y1, y2...
FromPoint lsst::afw::geom::Transform< FromEndpoint, ToEndpoint >::applyInverse | ( | ToPoint const & | point | ) | const |
Transform one point in the inverse direction ("to" to "from")
|
staticinherited |
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;
lsst::pex::exceptions::LogicError | if the cast fails |
param[in] ptr The pointer to be cast.
lsst::pex::exceptions::TypeError | If the dynamic cast fails. |
Definition at line 218 of file Persistable.cc.
|
inline |
Eigen::MatrixXd lsst::afw::geom::Transform< FromEndpoint, ToEndpoint >::getJacobian | ( | FromPoint const & | x | ) | const |
The Jacobian matrix of this Transform.
Radians are used for each axis of an SpherePointEndpoint.
The matrix is defined only if this object has a forward transform.
x | the position at which the Jacobian shall be evaluated |
J
with getToEndpoint().getNAxes()
rows and getFromEndpoint().getNAxes()
columns. J(i,j)
shall be the rate of change of the i
th output coordinate with respect to the j
th input coordinate, or NaN
if the derivative cannot be calculated.x
. If the implementation requires interpolation, computation of the Jacobian may require hundreds of evaluations of applyForward. Definition at line 122 of file Transform.cc.
|
inline |
|
inlineoverrideprotectedvirtual |
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 274 of file Transform.h.
|
inlineoverrideprotectedvirtual |
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 277 of file Transform.h.
|
static |
Return a short version of the class name with no punctuation.
Used as the Python class name and for persistence as a string
Returns "Transform" + fromEndpoint.getClassPrefix() + "To" + toEndpoint.getClassPrefix(), for example "TransformPoint2ToSpherePoint" or "TransformPoint2ToGeneric".
Definition at line 137 of file Transform.cc.
|
inline |
|
inline |
Test if this method has a forward transform.
Definition at line 118 of file Transform.h.
|
inline |
Test if this method has an inverse transform.
Definition at line 125 of file Transform.h.
std::shared_ptr< Transform< ToEndpoint, FromEndpoint > > lsst::afw::geom::Transform< FromEndpoint, ToEndpoint >::inverted |
The inverse of this Transform.
applyForward
is equivalent to this Transform's applyInverse
, and vice versa.Definition at line 110 of file Transform.cc.
|
inlineoverridevirtualnoexcept |
Whether the Transform is persistable via afw::table::io (always true).
Reimplemented from lsst::afw::table::io::Persistable.
Definition at line 265 of file Transform.h.
|
delete |
|
delete |
|
inlinestaticinherited |
Read an object from an already open FITS object.
[in] | fitsfile | FITS object to read from, already positioned at the desired HDU. |
Definition at line 183 of file Persistable.h.
|
inlinestaticinherited |
Read an object from a FITS file in memory.
[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.
|
inlinestaticinherited |
Read an object from a regular FITS file.
[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.
|
static |
Deserialize a Transform of this type from an input stream.
[in] | is | input stream from which to deserialize this Transform |
Definition at line 144 of file Transform.cc.
|
static |
Deserialize a Transform of this type from a string, using the same format as readStream.
Definition at line 150 of file Transform.cc.
template std::shared_ptr< Transform< SpherePointEndpoint, SpherePointEndpoint > > lsst::afw::geom::Transform< FromEndpoint, ToEndpoint >::then< SpherePointEndpoint > | ( | Transform< ToEndpoint, NextToEndpoint > const & | next, |
bool | simplify = true |
||
) | const |
Concatenate two Transforms.
NextToEndpoint | the "to" Endpoint of next |
next | the Transform to apply after this one |
simplify | if true then produce a transform containing a single simplified mapping with no intermediate frames. |
next
to the result. Its inverse shall first apply the inverse of next
, and then the inverse of this transform.pex::exceptions::InvalidParameterError | Thrown if getToEndpoint() and next.getFromEndpoint() do not have the same number of axes. |
More than two Transforms can be combined in series. For example:
auto pixelsToSky = pixelsToFp.then(fpToField)->then(fieldToSky);
Definition at line 170 of file Transform.cc.
|
overrideprotectedvirtual |
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 240 of file Transform.cc.
|
inherited |
Write the object to an already-open FITS object.
[in] | fitsfile | Open FITS object to write to. |
Definition at line 18 of file Persistable.cc.
|
inherited |
Write the object to a FITS image in memory.
[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.
|
inherited |
Write the object to a regular FITS file.
[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.
void lsst::afw::geom::Transform< FromEndpoint, ToEndpoint >::writeStream | ( | std::ostream & | os | ) | const |
Serialize this Transform to an output stream.
Version 1 format is as follows:
[out] | os | outpu stream to which to serialize this Transform |
Definition at line 157 of file Transform.cc.
std::string lsst::afw::geom::Transform< FromEndpoint, ToEndpoint >::writeString |
Serialize this Transform to a string, using the same format as writeStream.
Definition at line 162 of file Transform.cc.
|
friend |
Definition at line 70 of file Transform.h.