30 #include "boost/format.hpp"
32 #include "wcslib/wcs.h"
33 #include "wcslib/wcsfix.h"
34 #include "wcslib/wcshdr.h"
49 namespace except = lsst::pex::exceptions;
51 namespace afwCoord = lsst::afw::coord;
52 namespace afwGeom = lsst::afw::geom;
88 daf::base::Citizen(typeid(this)),
89 _wcsInfo(NULL), _nWcsInfo(0), _relax(0), _wcsfixCtrl(0), _wcshdrCtrl(0), _nReject(0),
90 _coordSystem(static_cast<afwCoord::
CoordSystem>(-1)) {
99 daf::base::Citizen(typeid(this)),
106 _coordSystem(static_cast<afwCoord::
CoordSystem>(-1))
128 (
boost::format(
"Failed to setup wcs structure with wcsset. Status %d: %s") %
129 status % wcs_errmsg[status] ).str());
150 double equinox, std::string
const & raDecSys,
151 std::string
const & cunits1, std::string
const & cunits2
153 daf::base::Citizen(typeid(this)),
160 _coordSystem(static_cast<afwCoord::
CoordSystem>(-1))
184 _hackHeader = _constHeader->deepCopy();
185 _constHeader = _hackHeader;
192 _constHeader(header), _hackHeader() {}
199 HeaderAccess access(header);
204 std::string
const& key =
"EQUINOX";
205 if (access.toRead()->exists(key) && access.toRead()->typeOf(key) ==
typeid(std::string)) {
206 double equinox = ::atof(access.toRead()->getAsString(key).c_str());
207 access.toWrite()->set(key, equinox);
214 string msg =
"Could not parse FITS WCS: no header cards found";
215 throw LSST_EXCEPT(except::InvalidParameterError, msg);
220 for (
int j=1; j<3; j++) {
221 for (
int i=0; i<=99; i++) {
223 if (!access.toRead()->exists(key)) {
226 double val = access.toRead()->getAsDouble(key);
227 access.toWrite()->remove(key);
228 access.toWrite()->add(
"X_"+key, val);
235 if( !access.toRead()->exists(
"CRPIX1") && !access.toRead()->exists(
"CRPIX1a")) {
236 string msg =
"Neither CRPIX1 not CRPIX1a found";
237 throw LSST_EXCEPT(except::InvalidParameterError, msg);
240 if( !access.toRead()->exists(
"CRPIX2") && !access.toRead()->exists(
"CRPIX2a")) {
241 string msg =
"Neither CRPIX2 not CRPIX2a found";
242 throw LSST_EXCEPT(except::InvalidParameterError, msg);
246 if( !access.toRead()->exists(
"CRVAL1") && !access.toRead()->exists(
"CRVAL1a")) {
247 string msg =
"Neither CRVAL1 not CRVAL1a found";
248 throw LSST_EXCEPT(except::InvalidParameterError, msg);
251 if( !access.toRead()->exists(
"CRVAL2") && !access.toRead()->exists(
"CRVAL2a")) {
252 string msg =
"Neither CRVAL2 not CRVAL2a found";
253 throw LSST_EXCEPT(except::InvalidParameterError, msg);
263 if(access.toRead()->exists(
"CD1_1") || access.toRead()->exists(
"CD1_2") ||
264 access.toRead()->exists(
"CD2_1") || access.toRead()->exists(
"CD2_2")) {
265 for (
int i = 1; i <= 2; ++i) {
266 for (
int j = 1; j <= 2; ++j) {
268 if (access.toRead()->exists(key)) {
269 double const val = access.toRead()->getAsDouble(key);
270 access.toWrite()->remove(key);
271 access.toWrite()->add(
"X_" + key, val);
275 if (access.toRead()->exists(key)) {
276 double const val = access.toRead()->getAsDouble(key);
277 access.toWrite()->remove(key);
278 access.toWrite()->add(
"X_" + key, val);
288 char *hdrString =
const_cast<char*
>(metadataStr.c_str());
294 if (pihStatus != 0) {
296 (
boost::format(
"Could not parse FITS WCS: wcspih status = %d (%s)") %
297 pihStatus % wcs_errmsg[pihStatus]).str());
301 const int *naxes = NULL;
304 if (fixStatus != 0) {
305 std::stringstream errStream;
306 errStream <<
"Could not parse FITS WCS: wcsfix failed " << std::endl;
307 for (
int ii = 0; ii < NWCSFIX; ++ii) {
308 if (stats[ii] >= 0) {
309 errStream <<
"\t" << ii <<
": " << stats[ii] <<
" " << wcsfix_errmsg[stats[ii]] << std::endl;
311 errStream <<
"\t" << ii <<
": " << stats[ii] << std::endl;
319 if (!(access.toRead()->exists(
"RADESYS") || access.toRead()->exists(
"RADESYSa"))) {
322 if (access.toRead()->exists(
"RADECSYS")) {
323 strncpy(
_wcsInfo->radesys, access.toRead()->getAsString(
"RADECSYS").c_str(),
STRLEN);
324 }
else if (access.toRead()->exists(
"EQUINOX") || access.toRead()->exists(
"EQUINOXa")) {
325 std::string
const EQUINOX = access.toRead()->exists(
"EQUINOX") ?
"EQUINOX" :
"EQUINOXa";
326 double const equinox = access.toRead()->getAsDouble(EQUINOX);
339 for(
int i = strlen(
_wcsInfo->radesys) - 1; i >= 0; i--) {
340 if (isspace(
_wcsInfo->radesys[i])) {
350 double const *cdelt =
_wcsInfo->cdelt;
354 cd[0] = cdelt[0]*pc[0];
355 cd[1] = cdelt[0]*pc[1];
356 cd[2] = cdelt[1]*pc[2];
357 cd[3] = cdelt[1]*pc[3];
373 double equinox, std::string
const & raDecSys,
374 std::string
const & cunits1, std::string
const & cunits2) {
377 if( (CD.rows() != 2) || (CD.cols() != 2) ) {
378 string msg =
"CD is not a 2x2 matrix";
379 throw LSST_EXCEPT(except::InvalidParameterError, msg);
383 bool isValid = (cunits1 ==
"deg");
384 isValid |= (cunits1 ==
"arcmin");
385 isValid |= (cunits1 ==
"arcsec");
386 isValid |= (cunits1 ==
"mas");
389 string msg =
"CUNITS1 must be one of {deg|arcmin|arcsec|mas}";
390 throw LSST_EXCEPT(except::InvalidParameterError, msg);
393 isValid = (cunits2 ==
"deg");
394 isValid |= (cunits2 ==
"arcmin");
395 isValid |= (cunits2 ==
"arcsec");
396 isValid |= (cunits2 ==
"mas");
399 string msg =
"CUNITS2 must be one of {deg|arcmin|arcsec|mas}";
400 throw LSST_EXCEPT(except::InvalidParameterError, msg);
404 _wcsInfo =
static_cast<struct wcsprm *
>(malloc(
sizeof(
struct wcsprm)));
406 throw LSST_EXCEPT(except::MemoryError,
"Cannot allocate WCS info");
413 (
boost::format(
"Failed to allocate memory with wcsini. Status %d: %s") %
414 status % wcs_errmsg[status] ).str());
425 for (
int i=0; i<2; ++i) {
426 for (
int j=0; j<2; ++j) {
456 (
boost::format(
"Failed to setup wcs structure with wcsset. Status %d: %s") %
457 status % wcs_errmsg[status] ).str());
465 daf::base::Citizen(typeid(this)),
467 _nWcsInfo(rhs._nWcsInfo),
469 _wcsfixCtrl(rhs._wcsfixCtrl),
470 _wcshdrCtrl(rhs._wcshdrCtrl),
471 _nReject(rhs._nReject),
472 _coordSystem(static_cast<afwCoord::
CoordSystem>(-1))
476 _wcsInfo =
static_cast<struct wcsprm *
>(calloc(rhs.
_nWcsInfo,
sizeof(
struct wcsprm)));
478 throw LSST_EXCEPT(lsst::pex::exceptions::MemoryError,
"Cannot allocate WCS info");
483 for (
int i = 0; i != rhs.
_nWcsInfo; ++i) {
487 throw LSST_EXCEPT(lsst::pex::exceptions::MemoryError,
488 (
boost::format(
"Could not copy WCS: wcscopy status = %d : %s") %
489 status % wcs_errmsg[status]).str());
497 if (&other ==
this)
return true;
508 inline bool compareArrays(
double const * a,
double const *
b,
int n) {
509 for (
int i = 0; i < n; ++i)
if (a[i] != b[i])
return false;
513 template <
typename T>
514 inline bool compareStringArrays(T a, T b,
int n) {
515 for (
int i = 0; i < n; ++i)
if (strcmp(a[i], b[i]) != 0)
return false;
519 #define CHECK_NULLS(a, b) \
522 if ((b) == NULL) return true; \
525 if ((b) == NULL) return false; \
592 for (
int i=0; i< naxis; ++i){
593 for (
int j=0; j<naxis; ++j) {
594 C(i,j) =
_wcsInfo->cd[ (i*naxis) + j ];
626 while (nQuarter < 0 ) {
641 switch (nQuarter%4) {
649 _wcsInfo->crpix[0] = -crpy + dimensions.getY();
657 _wcsInfo->crpix[0] = -crpx + dimensions.getX();
658 _wcsInfo->crpix[1] = -crpy + dimensions.getY();
666 _wcsInfo->crpix[1] = -crpx + dimensions.getX();
688 throw(
LSST_EXCEPT(except::RuntimeError,
"Wcs CD matrix is singular"));
694 static double square(
double x) {
705 const double side = 1;
724 double area = sqrt(square(dx[1]*dy[2] - dx[2]*dy[1]) +
725 square(dx[2]*dy[0] - dx[0]*dy[2]) +
726 square(dx[0]*dy[1] - dx[1]*dy[0]));
728 return area / square(side) * square(180. /
afwGeom::PI);
758 status = wcss2p(
_wcsInfo, 1, 2, skyTmp, &phi, &theta, imgcrd, pixTmp, stat);
761 (
boost::format(
"sky coordinates %s, %s degrees is not valid for this WCS")
768 (
boost::format(
"Error: wcslib returned a status code of %d at sky %s, %s deg: %s") %
807 skyTmp[
_wcsInfo->lng] = sky->getLongitude().asDegrees();
808 skyTmp[
_wcsInfo->lat] = sky->getLatitude() .asDegrees();
813 imgcrd[0] = imgcrd[1] = -1e6;
818 status = wcss2p(
_wcsInfo, 1, 2, skyTmp, &phi, &theta, imgcrd, pixTmp, stat);
821 (
boost::format(
"Error: wcslib returned a status code of %d at sky %s, %s deg: %s") %
822 status % skyTmp[0] % skyTmp[1] % wcs_errmsg[status]).str());
849 status = wcsp2s(
_wcsInfo, 1, 2, pixTmp, imgcrd, &phi, &theta, sky, &status);
852 (
boost::format(
"Error: wcslib returned a status code of %d at pixel %s, %s: %s") %
853 status % pixel1 % pixel2 % wcs_errmsg[status]).str());
861 return pixelToSky(pixel.getX(), pixel.getY());
888 int const ncompare = 4;
893 if (strncmp(type,
"RA--", ncompare) == 0) {
895 if(strcmp(radesys,
"ICRS") == 0) {
898 if(strcmp(radesys,
"FK5") == 0) {
902 (
boost::format(
"Can't create Coord object: Unrecognised radesys %s") %
906 }
else if (strncmp(type,
"GLON", ncompare) == 0) {
908 }
else if (strncmp(type,
"ELON", ncompare) == 0) {
910 }
else if (strncmp(type,
"DEC-", ncompare) == 0) {
914 if(strcmp(radesys,
"ICRS") == 0) {
917 if(strcmp(radesys,
"FK5") == 0) {
921 (
boost::format(
"Can't create Coord object: Unrecognised radesys %s") %
924 }
else if (strncmp(type,
"GLAT", ncompare) == 0) {
926 }
else if (strncmp(type,
"ELAT", ncompare) == 0) {
931 (
boost::format(
"Can't create Coord object: Unrecognised sys %s") %
967 const double side = 10;
969 typedef std::pair<lsst::afw::geom::Angle, lsst::afw::geom::Angle> AngleAngle;
974 m(0, 0) = dsky10.first.asAngularUnits(skyUnit)/side;
975 m(0, 1) = dsky01.first.asAngularUnits(skyUnit)/side;
976 m(1, 0) = dsky10.second.asAngularUnits(skyUnit)/side;
977 m(1, 1) = dsky01.second.asAngularUnits(skyUnit)/side;
979 Eigen::Vector2d sky00v;
980 sky00v << sky00.getX(), sky00.getY();
981 Eigen::Vector2d pix00v;
982 pix00v << pix00.getX(), pix00.getY();
1021 namespace lsst {
namespace afw {
namespace image {
1026 explicit WcsFactory(std::string
const & name) : table::io::PersistableFactory(name) {}
1029 InputArchive const & archive,
1030 CatalogVector const & catalogs
1039 struct WcsPersistenceHelper :
private boost::noncopyable {
1051 static WcsPersistenceHelper
const &
get() {
1052 static WcsPersistenceHelper instance;
1057 WcsPersistenceHelper() :
1059 crval(
schema.addField< table::
Point<double> >(
"crval",
"celestial reference point")),
1060 crpix(
schema.addField< table::
Point<double> >(
"crpix",
"pixel reference point")),
1061 cd(
schema.addField< table::Array<double> >(
1062 "cd",
"linear transform matrix, ordered (1_1, 2_1, 1_2, 2_2)", 4)),
1063 ctype1(
schema.addField< std::string >(
"ctype1",
"coordinate type", 72)),
1064 ctype2(
schema.addField< std::string >(
"ctype2",
"coordinate type", 72)),
1065 equinox(
schema.addField< double >(
"equinox",
"equinox of coordinates")),
1066 radesys(
schema.addField< std::string >(
"radesys",
"coordinate system for equinox", 72)),
1067 cunit1(
schema.addField< std::string >(
"cunit1",
"coordinate units", 72)),
1068 cunit2(
schema.addField< std::string >(
"cunit2",
"coordinate units", 72))
1070 schema.getCitizen().markPersistent();
1074 std::string getWcsPersistenceName() {
return "Wcs"; }
1076 WcsFactory registration(getWcsPersistenceName());
1085 WcsPersistenceHelper
const & keys = WcsPersistenceHelper::get();
1089 record->set(keys.crpix, getPixelOrigin());
1090 Eigen::Matrix2d cdIn = getCDMatrix();
1091 Eigen::Map<Eigen::Matrix2d> cdOut((*record)[keys.cd].getData());
1093 record->set(keys.ctype1, std::string(_wcsInfo[0].ctype[0]));
1094 record->set(keys.ctype2, std::string(_wcsInfo[0].ctype[1]));
1095 record->set(keys.equinox, _wcsInfo[0].equinox);
1096 record->set(keys.radesys, std::string(_wcsInfo[0].radesys));
1097 record->set(keys.cunit1, std::string(_wcsInfo[0].cunit[0]));
1098 record->set(keys.cunit2, std::string(_wcsInfo[0].cunit[1]));
1103 if (_wcsInfo[0].naxis != 2)
return false;
1104 if (std::strcmp(_wcsInfo[0].cunit[0],
"deg") != 0)
return false;
1105 if (std::strcmp(_wcsInfo[0].cunit[1],
"deg") != 0)
return false;
1110 daf::base::Citizen(typeid(this)),
1117 _coordSystem(static_cast<afw::coord::
CoordSystem>(-1))
1119 WcsPersistenceHelper
const & keys = WcsPersistenceHelper::get();
1122 afw::table::io::MalformedArchiveError,
1123 "Incorrect schema for Wcs persistence"
1127 Eigen::Matrix2d
cd = Eigen::Map<Eigen::Matrix2d const>(record[keys.cd].getData());
1129 record.
get(keys.crval), record.
get(keys.crpix),
cd,
1130 record.
get(keys.ctype1), record.
get(keys.ctype2),
1131 record.
get(keys.equinox), record.
get(keys.radesys),
1132 record.
get(keys.cunit1), record.
get(keys.cunit2)
1139 WcsPersistenceHelper
const & keys = WcsPersistenceHelper::get();
1143 PTR(
Wcs) result(
new Wcs(catalogs.front().front()));
1190 wcsMetaData->set(
"CRVAL1" + wcsName, x0,
"Column pixel of Reference Pixel");
1191 wcsMetaData->set(
"CRVAL2" + wcsName, y0,
"Row pixel of Reference Pixel");
1192 wcsMetaData->set(
"CRPIX1" + wcsName, 1,
"Column Pixel Coordinate of Reference");
1193 wcsMetaData->set(
"CRPIX2" + wcsName, 1,
"Row Pixel Coordinate of Reference");
1194 wcsMetaData->set(
"CTYPE1" + wcsName,
"LINEAR",
"Type of projection");
1195 wcsMetaData->set(
"CTYPE2" + wcsName,
"LINEAR",
"Type of projection");
1196 wcsMetaData->set(
"CUNIT1" + wcsName,
"PIXEL",
"Column unit");
1197 wcsMetaData->set(
"CUNIT2" + wcsName,
"PIXEL",
"Row unit");
1218 if (metadata->
getAsDouble(
"CRPIX1" + wcsName) == 1 &&
1221 x0 = metadata->
getAsInt(
"CRVAL1" + wcsName);
1222 y0 = metadata->
getAsInt(
"CRVAL2" + wcsName);
1226 metadata->
remove(
"CRVAL1" + wcsName);
1227 metadata->
remove(
"CRVAL2" + wcsName);
1228 metadata->
remove(
"CRPIX1" + wcsName);
1229 metadata->
remove(
"CRPIX2" + wcsName);
1230 metadata->
remove(
"CTYPE1" + wcsName);
1231 metadata->
remove(
"CTYPE1" + wcsName);
1232 metadata->
remove(
"CUNIT1" + wcsName);
1233 metadata->
remove(
"CUNIT2" + wcsName);
1235 }
catch(lsst::pex::exceptions::NotFoundError &) {
1255 std::vector<std::string> paramNames = wcsMetadata->paramNames();
1256 paramNames.push_back(
"CDELT1");
1257 paramNames.push_back(
"CDELT2");
1258 paramNames.push_back(
"LTV1");
1259 paramNames.push_back(
"LTV2");
1260 paramNames.push_back(
"PC001001");
1261 paramNames.push_back(
"PC001002");
1262 paramNames.push_back(
"PC002001");
1263 paramNames.push_back(
"PC002002");
1264 for (std::vector<std::string>::const_iterator ptr = paramNames.begin(); ptr != paramNames.end(); ++ptr) {
1282 : XYTransform(), _dst(dst), _src(src)
1288 return boost::make_shared<XYTransformFromWcsPair>(_dst->clone(), _src->clone());
1301 return _dst->skyToPixel(*
x);
1307 return _src->skyToPixel(*
x);
1313 return boost::make_shared<XYTransformFromWcsPair> (_src, _dst);
Defines the fields and offsets for a table.
int _wcsfixCtrl
Do potentially unsafe translations of non-standard unit strings? 0/1 = no/yes.
geom::Point2I getImageXY0FromMetadata(std::string const &wcsName, lsst::daf::base::PropertySet *metadata)
const int lsstToFitsPixels
boost::shared_ptr< Coord > Ptr
Schema getSchema() const
Return the Schema that holds this record's fields and keys.
virtual std::string getPersistenceName() const
Return the unique name used to persist this object and look up its factory.
BaseCatalog makeCatalog(Schema const &schema)
Return a new, empty catalog with the given schema.
geom::AffineTransform linearizePixelToSky(coord::Coord const &coord, geom::AngleUnit skyUnit=geom::degrees) const
Return the local linear approximation to Wcs::pixelToSky at a point given in sky coordinates.
WcsFactory(std::string const &name)
table::Key< table::Array< double > > cd
An object passed to Persistable::write to allow it to persist itself.
AngleUnit const radians
constant with units of radians
virtual void pixelToSkyImpl(double pixel1, double pixel2, geom::Angle skyTmp[2]) const
coord::CoordSystem _coordSystem
A custom container class for records, based on std::vector.
Class for storing ordered metadata with comments.
afw::table::Key< afw::table::Point< int > > dimensions
boost::shared_ptr< Wcs > Ptr
A base class for factory classes used to reconstruct objects from records.
geom::Point2D skyToPixel(geom::Angle sky1, geom::Angle sky2) const
Convert from sky coordinates (e.g. RA/dec) to pixel positions.
afw::coord::Coord::Ptr convertCoordToSky(coord::Coord const &coord) const
std::pair< lsst::afw::geom::Angle, lsst::afw::geom::Angle > getTangentPlaneOffset(Coord const &c) const
Get the offset on the tangent plane.
virtual bool _isSubset(Wcs const &other) const
lsst::afw::geom::Point2D GeomPoint
afw::coord::Coord::Ptr makeCorrectCoord(geom::Angle sky0, geom::Angle sky1) const
Given a sky position, use the values stored in ctype and radesys to return the correct sub-class of C...
void initWcsLibFromFits(boost::shared_ptr< lsst::daf::base::PropertySet const > const &fitsMetadata)
Parse a fits header, extract the relevant metadata and create a Wcs object.
boost::shared_ptr< PropertyList > Ptr
void initWcsLib(geom::Point2D const &crval, geom::Point2D const &crpix, Eigen::Matrix2d const &CD, std::string const &ctype1, std::string const &ctype2, double equinox, std::string const &raDecSys, std::string const &cunits1, std::string const &cunits2)
Manually initialise a wcs struct using values passed by the constructor.
virtual geom::AffineTransform linearizeSkyToPixelInternal(geom::Point2D const &pix, coord::Coord const &coord, geom::AngleUnit skyUnit) const
table::Key< std::string > radesys
geom::Point2D skyToIntermediateWorldCoord(coord::Coord const &coord) const
Convert from sky coordinates (e.g. RA/dec) to intermediate world coordinates.
virtual Ptr clone(void) const
Implementation of the WCS standard for a any projection.
boost::shared_ptr< coord::Coord > pixelToSky(double pix1, double pix2) const
Convert from pixel position to sky coordinates (e.g. RA/dec)
lsst::daf::base::PropertyList PropertyList
table::Key< std::string > ctype2
A class used to convert scalar POD types such as double to Angle.
virtual void shiftReferencePixel(double dx, double dy)
Move the pixel reference position by (dx, dy)
boost::shared_ptr< RecordT > addNew()
Create a new record, add it to the end of the catalog, and return a pointer to it.
virtual geom::Point2D skyToPixelImpl(geom::Angle sky1, geom::Angle sky2) const
table::Key< table::Point< double > > crval
table::Key< table::Point< int > > pixel
table::Key< table::Array< Kernel::Pixel > > image
A base class for objects that can be persisted via afw::table::io Archive classes.
Field< T >::Value get(Key< T > const &key) const
Return the value of a field for the given key.
lsst::daf::base::PropertySet PropertySet
virtual std::string getPythonModule() const
Return the fully-qualified Python module that should be imported to guarantee that its factory is reg...
virtual boost::shared_ptr< lsst::daf::base::PropertyList > getFitsMetadata() const
Return a PropertyList containing FITS header keywords that can be used to save the Wcs...
int contains(Schema const &other, int flags=EQUAL_KEYS) const
Test whether the given schema is a subset of this.
virtual bool isPersistable() const
Whether the Wcs is persistable using afw::table::io archives.
virtual void rotateImageBy90(int nQuarter, lsst::afw::geom::Extent2I dimensions) const
Rotate image by nQuarter times 90 degrees.
table::Key< double > equinox
bool operator==(Wcs const &other) const
#define CHECK_NULLS(a, b)
Eigen::Matrix2d getCDMatrix() const
Returns the CD matrix.
geom::Angle pixelScale() const
Returns the pixel scale [Angle/pixel].
table::Key< table::Point< double > > crpix
lsst::afw::geom::Point2D getPixelOrigin() const
Returns CRPIX (corrected to LSST convention).
const int fitsToLsstPixels
Coord::Ptr makeCoord(CoordSystem const system, lsst::afw::geom::Angle const ra, lsst::afw::geom::Angle const dec, double const epoch)
Factory function to create a Coord of arbitrary type with decimal RA,Dec.
virtual void flipImage(int flipLR, int flipTB, lsst::afw::geom::Extent2I dimensions) const
Flip CD matrix around the y-axis.
boost::shared_ptr< lsst::daf::base::PropertyList > createTrivialWcsAsPropertySet(std::string const &wcsName, int const x0=0, int const y0=0)
lsst::afw::coord::Coord::Ptr getSkyOrigin() const
Returns CRVAL. This need not be the centre of the image.
virtual geom::AffineTransform linearizePixelToSkyInternal(geom::Point2D const &pix, coord::Coord const &coord, geom::AngleUnit skyUnit) const
void shift(Extent< T, N > const &offset)
Shift the point by the given offset.
lsst::afw::image::Wcs Wcs
#define LSST_EXCEPT(type,...)
A vector of catalogs used by Persistable.
int _relax
Degree of permissiveness for wcspih (0 for strict); see wcshdr.h for details.
Base class for all records.
geom::LinearTransform getLinearTransform() const
A class used as a handle to a particular field in a table.
Wcs()
Construct an invalid Wcs given no arguments.
const double PixelZeroPos
FITS uses 1.0, SDSS uses 0.5, LSST uses 0.0 (http://dev.lsstcorp.org/trac/wiki/BottomLeftPixelProposa...
Class for storing generic metadata.
int getAsInt(std::string const &name) const
double pixArea(lsst::afw::geom::Point2D pix00) const
Sky area covered by a pixel at position pix00 in units of square degrees.
virtual void remove(std::string const &name)
geom::AffineTransform linearizeSkyToPixel(coord::Coord const &coord, geom::AngleUnit skyUnit=geom::degrees) const
Return the local linear approximation to Wcs::skyToPixel at a point given in sky coordinates.
afw::table::Key< double > b
lsst::afw::image::XYTransformFromWcsPair XYTransformFromWcsPair
table::Key< std::string > cunit1
Point< double, 2 > Point2D
#define LSST_ARCHIVE_ASSERT(EXPR)
An assertion macro used to validate the structure of an InputArchive.
CoordSystem makeCoordEnum(std::string const system)
A utility function to get the enum value of a coordinate system from a string name.
double getAsDouble(std::string const &name) const
double const PI
The ratio of a circle's circumference to diameter.
virtual void write(OutputArchiveHandle &handle) const
Write the object to one or more catalogs.
Coord::Ptr convert(CoordSystem system) const
Convert to a specified Coord type.
int stripWcsKeywords(boost::shared_ptr< lsst::daf::base::PropertySet > const &metadata, boost::shared_ptr< Wcs const > const &wcs)
int _wcshdrCtrl
Controls messages to stderr from wcshdr (0 for none); see wcshdr.h for details.
lsst::afw::coord::Coord::Ptr CoordPtr
void saveCatalog(BaseCatalog const &catalog)
Save a catalog in the archive.
Include files required for standard LSST Exception handling.
table::Key< std::string > ctype1
lsst::afw::geom::Point2D getPosition(lsst::afw::geom::AngleUnit unit=lsst::afw::geom::degrees) const
Return our contents in a Point2D object.
table::Key< std::string > cunit2
Functions to handle coordinates.