File Endpoint.h

namespace lsst

Class for a simple mapping implementing a generic AstrometryTransform.

Remove all non-astronomical counts from the Chunk Exposure’s pixels.

Forward declarations for lsst::utils::Cache

For details on the Cache class, see the Cache.h file.

It uses a template rather than a pointer so that the derived classes can use the specifics of the transform. The class simplePolyMapping overloads a few routines.

A base class for image defects

Numeric constants used by the Integrate.h integrator routines.

Compute Image Statistics

Note

Gauss-Kronrod-Patterson quadrature coefficients for use in quadpack routine qng. These coefficients were calculated with 101 decimal digit arithmetic by L. W. Fullerton, Bell Labs, Nov 1981.

Note

The Statistics class itself can only handle lsst::afw::image::MaskedImage() types. The philosophy has been to handle other types by making them look like lsst::afw::image::MaskedImage() and reusing that code. Users should have no need to instantiate a Statistics object directly, but should use the overloaded makeStatistics() factory functions.

namespace afw
namespace geom

Functions

std::ostream &operator<<(std::ostream &os, GenericEndpoint const &endpoint)

Print “GenericEndpoint(_n_)” to the ostream where _n_ is the number of axes, e.g. “GenericAxes(4)”.

std::ostream &operator<<(std::ostream &os, Point2Endpoint const &endpoint)

Print “Point2Endpoint()” to the ostream.

std::ostream &operator<<(std::ostream &os, SpherePointEndpoint const &endpoint)

Print “SpherePointEndpoint()” to the ostream.

template<typename PointT, typename ArrayT>
class BaseEndpoint
#include <Endpoint.h>

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

Private Members

int _nAxes
template<typename PointT>
class BaseVectorEndpoint : public lsst::afw::geom::BaseEndpoint<PointT, std::vector<PointT>>
#include <Endpoint.h>

Base class for endpoints with Array = std::vector<Point> where Point has 2 dimensions

Note

Subclasses must provide dataFromPoint, dataFromArray, pointFromData and arrayFromData

Public Types

template<>
using Array = std::vector<PointT>
template<>
using Point = PointT

Public Functions

BaseVectorEndpoint(BaseVectorEndpoint const&)
BaseVectorEndpoint(BaseVectorEndpoint&&)
BaseVectorEndpoint &operator=(BaseVectorEndpoint const&)
BaseVectorEndpoint &operator=(BaseVectorEndpoint&&)
~BaseVectorEndpoint()
int getNPoints(Array const &arr) const

Return the number of points in an array

Protected Functions

BaseVectorEndpoint(int nAxes)

Construct a BaseVectorEndpoint

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

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

class GenericEndpoint : public lsst::afw::geom::BaseEndpoint<std::vector<double>, ndarray::Array<double, 2, 2>>
#include <Endpoint.h>

A generic endpoint for data in the format used by ast::Mapping

Thus supports all ast frame classes and any number of axes, and thus can be used as an endpoint for any ast::Mapping.

Public Functions

GenericEndpoint(GenericEndpoint const&)
GenericEndpoint(GenericEndpoint&&)
GenericEndpoint &operator=(GenericEndpoint const&)
GenericEndpoint &operator=(GenericEndpoint&&)
GenericEndpoint(int nAxes)

Construct a GenericEndpoint with the specified number of axes

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

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

~GenericEndpoint()
int getNPoints(Array const &arr) const

Return the number of points in an array

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

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

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

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

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

Get a single point from raw data

Return

the corresponding point

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

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

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

Public Static Functions

static std::string getClassPrefix()

Get the class name prefix, e.g. “Point2” for “Point2Endpoint”.

class Point2Endpoint : public lsst::afw::geom::BaseVectorEndpoint<lsst::geom::Point2D>
#include <Endpoint.h>

An endpoint for lsst::geom::Point2D

Public Functions

Point2Endpoint(Point2Endpoint const&)
Point2Endpoint(Point2Endpoint&&)
Point2Endpoint &operator=(Point2Endpoint const&)
Point2Endpoint &operator=(Point2Endpoint&&)
Point2Endpoint()

Construct a Point2Endpoint

Point2Endpoint(int nAxes)

Construct a Point2Endpoint with nAxes specified; nAxes must equal template parameter N

This constructor is primarily used by Transform; other users are encouraged to use the default constructor.

Parameters
  • [in] nAxes: The number of axes in a point; must equal template parameter N

Exceptions
  • lsst.pex.exceptions.InvalidParameterError: if nAxes != N

~Point2Endpoint()
std::vector<double> dataFromPoint(Point const &point) const

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

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

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

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

Get a single point from raw data

Return

the corresponding point

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

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

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

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

Check that framePtr points to a Frame, not a subclass

Subclasses are forbidden because lsst::geom::Point2D is assumed to be cartesian and subclasses of Frame are not (e.g. SkyFrame, SpecFrame and TimeFrame). Note that SpecFrame and TimeFrame are 1-dimensional so they cannot be used in any case. A CmpFrame could be cartesian, but we play it safe and reject these (however, a cartesian CmpFrame ought to simplify to a Frame).

Public Static Functions

static std::string getClassPrefix()

Get the class name prefix, e.g. “Point2” for “Point2Endpoint”.

class SpherePointEndpoint : public lsst::afw::geom::BaseVectorEndpoint<lsst::geom::SpherePoint>
#include <Endpoint.h>

An endpoint for lsst::geom::SpherePoint

A SpherePointEndpoint always has 2 axes: longitude, latitude

Public Functions

SpherePointEndpoint(SpherePointEndpoint const&)
SpherePointEndpoint(SpherePointEndpoint&&)
SpherePointEndpoint &operator=(SpherePointEndpoint const&)
SpherePointEndpoint &operator=(SpherePointEndpoint&&)
SpherePointEndpoint()

Construct a SpherePointEndpoint

SpherePointEndpoint(int nAxes)

Construct a SpherePointEndpoint with nAxes specified; nAxes must equal 2

This constructor is primarily used by Transform; other users are encouraged to use the default constructor.

Parameters
  • [in] nAxes: The number of axes in a point; must equal 2

Exceptions
  • lsst.pex.exceptions.InvalidParameterError: if nAxes != 2

~SpherePointEndpoint()
std::vector<double> dataFromPoint(Point const &point) const

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

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

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

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

Get a single point from raw data

Return

the corresponding point

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

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

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

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

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

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

Check that framePtr points to a SkyFrame and set longitude axis to 0, latitude to 1.

Public Static Functions

static std::string getClassPrefix()

Get the class name prefix, e.g. “Point2” for “Point2Endpoint”.