Template Class BaseEndpoint

Class Documentation

template<typename PointT, typename ArrayT>
class BaseEndpoint

Virtual base class for endpoints, which are helper classes for Transform

Endpoints transform points and lists of points from LSST-specific data types, such as lsst::geom::Point2D and lsst::geom::SpherePoint, to a form accepted by ast::Mapping.tran. Each type of endpoint is used for a particular LSST data type, for example:

Endpoints use the following forms of data for raw data:

  • std::vector<double> for a single point

  • ndarray<double, 2, 2> with dimensions number of axes x number of points for an array of points

Endpoints are designed as helper classes for Transform. Each transform has a two endpoints: one for input data and one for output data.

Endpoint also provides two methods to work with ast::Frames:

  • normalizeFrame verifies that a frame is the correct type, and adjusts its settings if necessary

  • makeFrame creates a new frame with the correct type and settings

Template Parameters
  • PointT: LSST data type for one point

  • ArrayT: LSST data type for an array of points

Public Types

template<>
using Point = PointT
template<>
using Array = ArrayT

Public Functions

BaseEndpoint(BaseEndpoint const&)
BaseEndpoint(BaseEndpoint&&)
BaseEndpoint &operator=(BaseEndpoint const&)
BaseEndpoint &operator=(BaseEndpoint&&)
virtual ~BaseEndpoint()
int getNAxes() const
virtual int getNPoints(Array const &arr) const = 0

Return the number of points in an array

virtual bool operator==(BaseEndpoint const &other) const

Determine whether two endpoints represent the same conversion.

Return

true iff this object and other are of exactly the same class and all visible properties are identical. This implementation requires that the objects have the same number of axes.

Warning

Two endpoints with different implementation classes will never compare equal, even if one class is conceptually equivalent to the other (e.g., a decorator). This may cause unexpected behavior when mixing related concrete endpoint classes.

Parameters
  • other: the endpoint to compare

bool operator!=(BaseEndpoint const &other) const

Determine whether two endpoints do not represent the same conversion.

Return

the inverse of operator==. See that operator’s documentation for important caveats.

virtual std::vector<double> dataFromPoint(Point const &point) const = 0

Get raw data from a single point

Return

the values in the point as a vector of size NAxess

Parameters
  • [in] point: data for a single point

Exceptions
  • lsst::pex::exceptions::InvalidParameterError: if the point has the wrong number of axes

virtual ndarray::Array<double, 2, 2> dataFromArray(Array const &arr) const = 0

Get raw data from an array of points

Return

the data as a 2-D ndarray array [nAxes, nPoints] in C order, so the in-memory view is, for example, x0, x1, x2, …, y0, y1, y2, …

Parameters
  • [in] arr: Array of points

Exceptions
  • lsst::pex::exceptions::InvalidParameterError: if the array has the wrong nAxes dimension

virtual Point pointFromData(std::vector<double> const &data) const = 0

Get a single point from raw data

Return

the corresponding point

Parameters
  • [in] data: Data as a vector of length NAxes

virtual Array arrayFromData(ndarray::Array<double, 2, 2> const &data) const = 0

Get an array of points from raw data

Return

an array of points

Parameters
  • [in] data: Raw data for an array of points, as a 2-D ndarray array [nPoints, nAxes] in C order, so the in-memory view is, for example, x0, y0, x1, y1, x2, y2, …

Exceptions
  • lsst::pex::exceptions::InvalidParameterError: if the array has the wrong nAxes dimension

virtual std::shared_ptr<ast::Frame> makeFrame() const

Create a Frame that can be used with this end point in a Transform

virtual void normalizeFrame(std::shared_ptr<ast::Frame> framePtr) const

Adjust and check the frame as needed.

Do not bother to check the number of axes because that is done elsewhere.

The base implementation does nothing.

Protected Functions

BaseEndpoint(int nAxes)

Construct a BaseEndpoint

Parameters
  • [in] nAxes: The number of axes in a point; must be > 0

Exceptions
  • lsst.pex.exceptions.InvalidParameterError: if nAxes <= 0

void _assertNAxes(int nAxes) const
int _getNAxes(ndarray::Array<double, 2, 2> const &data) const
int _getNAxes(ndarray::Array<double, 1, 1> const &data) const
int _getNAxes(std::vector<double> const &data) const
int _getNPoints(ndarray::Array<double, 2, 2> const &data) const