File CreateWcsWithSip.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 meas
namespace astrom
namespace sip

Functions

template<class MatchT>
CreateWcsWithSip<MatchT> makeCreateWcsWithSip(std::vector<MatchT> const &matches, afw::geom::SkyWcs const &linearWcs, int const order, geom::Box2I const &bbox = geom::Box2I(), int const ngrid = 0)

Factory function for CreateWcsWithSip.

template<class MatchT>
class CreateWcsWithSip
#include <CreateWcsWithSip.h>

Measure the distortions in an image plane and express them a SIP polynomials.

Given a list of matching sources between a catalogue and an image, and a linear Wcs that describes the mapping from pixel space in the image and ra/dec space in the catalogue, calculate discrepancies between the two and compute SIP distortion polynomials to describe the discrepancy

SIP polynomials are defined in Shupe at al. (2005) ASPC 347 491.

Note that the SIP standard insists (although it is only mentioned obliquly between Eqns 3 and 4) that the lowest three terms in the distortion polynomials be zero (A00, A10, A01, B00, etc.). To achieve this, we need to adjust the values of CD and CRPIX from the input wcs. This may not be the behaviour you expect.

A Wcs may be created in a variety of ways (e.g. lsst::meas::astrom::net::GlobalAstrometrySolution ), and the list of matched sources (matches) can be generated with the matchRaDec function.

#Example usage
matches = matchRaDec(catSet, srcSet, 1.0*afwGeom.arcseconds, true)
wcs = getWcsFromSomewhere()

maxScatter=0.1
maxOrder= 10
sipObject = CreateWcsWithSip(matches, wcs, maxScatter, maxOrder)
wcs = sipObject.getNewWcs()

Note that the matches must be one-to-one; this is ensured by passing closest=true to matchRaDec.

Public Types

typedef std::shared_ptr<CreateWcsWithSip> Ptr
typedef std::shared_ptr<CreateWcsWithSip const> ConstPtr

Public Functions

CreateWcsWithSip(std::vector<MatchT> const &matches, afw::geom::SkyWcs const &linearWcs, int const order, geom::Box2I const &bbox = geom::Box2I(), int const ngrid = 0)

Construct a CreateWcsWithSip

Parameters
  • [in] matches: list of matches

  • [in] linearWcs: initial WCS, typically pure TAN but need not be

  • [in] order: SIP order for fit WCS

  • [in] bbox: bounding box over which to compute the reverse SIP transform. If empty then a bounding box is computed based on the matches, extended a bit to allow for the fact that the sources will not necessarily reach to each edge of the image. Specifially the box is grown by dimensions/sqrt(number of matches).

  • [in] ngrid: number of points along x or y for the grid of points on which the reverse SIP transform is computed

std::shared_ptr<afw::geom::SkyWcs> getNewWcs()
double getScatterInPixels() const

Compute the median separation, in pixels, between items in this object’s match list

For each match, project the reference object coord to pixels using the fit TAN-SIP WCS, and measure the radial separation to the source centroid

geom::Angle getScatterOnSky() const

Compute the median on-sky separation between items in this object’s match list

For each match, project the source centroid to RA,Dec using the fit TAN-SIP WCS, and measure the on-sky angular separation to the reference source coord.

double getLinearScatterInPixels() const

Compute the median radial separation between items in this object’s match list

For each match, project the reference object coord to pixels using the initial “linearWcs” WCS, and measure the radial separation to the source centroid.

geom::Angle getLinearScatterOnSky() const

Compute the median on-sky separation between items in this object’s match list,

For each match, project the source centroid to RA,Dec using the initial “linearWcs” WCS, and measure the on-sky angular separation to the reference source coord.

int getOrder() const

Return the number of terms in the SIP matrix.

int getNPoints() const

Return the number of points in the catalogue.

int getNGrid() const

Return the number of grid points (on each axis) used in inverse SIP transform.

Eigen::MatrixXd const getSipA()
Eigen::MatrixXd const getSipB()
Eigen::MatrixXd const getSipAp()
Eigen::MatrixXd const getSipBp()

Private Functions

void _calculateForwardMatrices()
void _calculateReverseMatrices()

Private Members

std::vector<MatchT> const _matches
geom::Box2I _bbox
int _ngrid
std::shared_ptr<const afw::geom::SkyWcs> _linearWcs
int const _sipOrder
int const _reverseSipOrder
Eigen::MatrixXd _sipA
Eigen::MatrixXd _sipB
Eigen::MatrixXd _sipAp
Eigen::MatrixXd _sipBp
std::shared_ptr<afw::geom::SkyWcs> _newWcs