LSSTApplications  1.1.2+25,10.0+13,10.0+132,10.0+133,10.0+224,10.0+41,10.0+8,10.0-1-g0f53050+14,10.0-1-g4b7b172+19,10.0-1-g61a5bae+98,10.0-1-g7408a83+3,10.0-1-gc1e0f5a+19,10.0-1-gdb4482e+14,10.0-11-g3947115+2,10.0-12-g8719d8b+2,10.0-15-ga3f480f+1,10.0-2-g4f67435,10.0-2-gcb4bc6c+26,10.0-28-gf7f57a9+1,10.0-3-g1bbe32c+14,10.0-3-g5b46d21,10.0-4-g027f45f+5,10.0-4-g86f66b5+2,10.0-4-gc4fccf3+24,10.0-40-g4349866+2,10.0-5-g766159b,10.0-5-gca2295e+25,10.0-6-g462a451+1
LSSTDataManagementBasePackage
Classes | Enumerations | Functions
lsst.afw.coord Namespace Reference

Classes

class  Coord
 
class  IcrsCoord
 A class to handle Icrs coordinates (inherits from Coord) More...
 
class  Fk5Coord
 A class to handle Fk5 coordinates (inherits from Coord) More...
 
class  GalacticCoord
 A class to handle Galactic coordinates (inherits from Coord) More...
 
class  EclipticCoord
 A class to handle Ecliptic coordinates (inherits from Coord) More...
 
class  TopocentricCoord
 A class to handle topocentric (AltAz) coordinates (inherits from Coord) More...
 
class  Observatory
 Store information about an observatory ... lat/long, elevation. More...
 

Enumerations

enum  CoordSystem {
  FK5, ICRS, GALACTIC, ECLIPTIC,
  TOPOCENTRIC
}
 

Functions

CoordSystem makeCoordEnum (std::string const system)
 A utility function to get the enum value of a coordinate system from a string name. More...
 
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. More...
 
Coord::Ptr makeCoord (CoordSystem const system, std::string const ra, std::string const dec, double const epoch)
 Factory function to create a Coord of arbitrary type with string RA [in degrees, not hours!], Dec. More...
 
Coord::Ptr makeCoord (CoordSystem const system, lsst::afw::geom::Point2D const &p2d, lsst::afw::geom::AngleUnit unit, double const epoch)
 Factory function to create a Coord of arbitrary type with Point2D. More...
 
Coord::Ptr makeCoord (CoordSystem const system, lsst::afw::geom::Point3D const &p3d, double const epoch, bool normalize=true, lsst::afw::geom::Angle const defaultLongitude=lsst::afw::geom::Angle(0.))
 Factory function to create a Coord of arbitrary type with a Point3D. More...
 
Coord::Ptr makeCoord (CoordSystem const system)
 Lightweight factory to make an empty coord. More...
 
Coord::Ptr makeCoord (CoordSystem const system, lsst::afw::geom::Angle const ra, lsst::afw::geom::Angle const dec)
 Factory function to create a Coord of arbitrary type with decimal RA,Dec in degrees. More...
 
Coord::Ptr makeCoord (CoordSystem const system, std::string const ra, std::string const dec)
 Factory function to create a Coord of arbitrary type with string RA [in degrees, not hours!], Dec. More...
 
Coord::Ptr makeCoord (CoordSystem const system, lsst::afw::geom::Point2D const &p2d, lsst::afw::geom::AngleUnit unit)
 Factory function to create a Coord of arbitrary type with Point2D. More...
 
Coord::Ptr makeCoord (CoordSystem const system, lsst::afw::geom::Point3D const &p3d, bool normalize=true, lsst::afw::geom::Angle const defaultLongitude=lsst::afw::geom::Angle(0.))
 Factory function to create a Coord of arbitrary type with a Point3D. More...
 
lsst::afw::geom::Angle eclipticPoleInclination (double const epoch)
 get the inclination of the ecliptic pole (obliquity) at epoch More...
 
lsst::afw::geom::Angle dmsStringToAngle (std::string const dms)
 Convert a dd:mm:ss string to Angle. More...
 
lsst::afw::geom::Angle hmsStringToAngle (std::string const hms)
 Convert a hh:mm:ss string to Angle. More...
 
std::string angleToDmsString (lsst::afw::geom::Angle const deg)
 a Function to convert a coordinate in decimal degrees to a string with form dd:mm:ss More...
 
std::string angleToHmsString (lsst::afw::geom::Angle const deg)
 a function to convert decimal degrees to a string with form hh:mm:ss.s More...
 
std::ostream & operator<< (std::ostream &os, Coord const &coord)
 
std::ostream & operator<< (std::ostream &os, Observatory const &obs)
 

Enumeration Type Documentation

Enumerator
FK5 
ICRS 
GALACTIC 
ECLIPTIC 
TOPOCENTRIC 

Definition at line 54 of file Coord.h.

Function Documentation

std::string lsst::afw::coord::angleToDmsString ( lsst::afw::geom::Angle const  deg)

a Function to convert a coordinate in decimal degrees to a string with form dd:mm:ss

Todo:
allow a user specified format

Definition at line 292 of file Coord.cc.

292  {
293  return angleToXmsString(a, afwGeom::degrees);
294 }
AngleUnit const degrees
Definition: Angle.h:92
std::string lsst::afw::coord::angleToHmsString ( lsst::afw::geom::Angle const  deg)

a function to convert decimal degrees to a string with form hh:mm:ss.s

Definition at line 299 of file Coord.cc.

299  {
300  return angleToXmsString(a, afwGeom::hours);
301 }
AngleUnit const hours
Definition: Angle.h:93
afwGeom::Angle lsst::afw::coord::dmsStringToAngle ( std::string const  dms)

Convert a dd:mm:ss string to Angle.

Parameters
dmsCoord as a string in dd:mm:ss format

Definition at line 343 of file Coord.cc.

345  {
346  return xmsStringToAngle(dms, afwGeom::degrees);
347 }
AngleUnit const degrees
Definition: Angle.h:92
afwGeom::Angle lsst::afw::coord::eclipticPoleInclination ( double const  epoch)

get the inclination of the ecliptic pole (obliquity) at epoch

Parameters
epochdesired epoch for inclination

Definition at line 353 of file Coord.cc.

355  {
356  double const T = (epoch - 2000.0)/100.0;
357  return (23.0 + 26.0/60.0 + (21.448 - 46.82*T - 0.0006*T*T - 0.0018*T*T*T)/3600.0) * afwGeom::degrees;
358 }
AngleUnit const degrees
Definition: Angle.h:92
afwGeom::Angle lsst::afw::coord::hmsStringToAngle ( std::string const  hms)

Convert a hh:mm:ss string to Angle.

Definition at line 334 of file Coord.cc.

336  {
337  return xmsStringToAngle(hms, afwGeom::hours);
338 }
AngleUnit const hours
Definition: Angle.h:93
afwCoord::Coord::Ptr lsst::afw::coord::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.

Note
This factory allows the epoch to be specified but will throw if used with ICRS or Galactic
Most of the other factories (which accept epochs) just call this one indirectly.
Parameters
systemthe system (equ, fk5, galactic ..)
raright ascension
decdeclination
epochepoch of coordinate

Definition at line 1210 of file Coord.cc.

1215  {
1216 
1217  switch (system) {
1218  case FK5:
1219  return boost::shared_ptr<Fk5Coord>(new Fk5Coord(ra, dec, epoch));
1220  break;
1221  case ICRS:
1222  throw LSST_EXCEPT(ex::InvalidParameterError,
1223  "ICRS has no epoch, use overloaded makeCoord with args (system, ra, dec).");
1224  break;
1225  case GALACTIC:
1226  throw LSST_EXCEPT(ex::InvalidParameterError,
1227  "Galactic has no epoch, use overloaded makeCoord with (system, ra, dec).");
1228  break;
1229  case ECLIPTIC:
1230  return boost::shared_ptr<EclipticCoord>(new EclipticCoord(ra, dec, epoch));
1231  break;
1232  case TOPOCENTRIC:
1233  throw LSST_EXCEPT(ex::InvalidParameterError,
1234  "Cannot make Topocentric with makeCoord() (must also specify Observatory).\n"
1235  "Instantiate TopocentricCoord() directly.");
1236  break;
1237  default:
1238  throw LSST_EXCEPT(ex::InvalidParameterError,
1239  "Undefined CoordSystem: only FK5, ICRS, GALACTIC, ECLIPTIC, and TOPOCENTRIC allowed.");
1240  break;
1241 
1242  }
1243 
1244 }
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
afwCoord::Coord::Ptr lsst::afw::coord::makeCoord ( CoordSystem const  system,
std::string const  ra,
std::string const  dec,
double const  epoch 
)

Factory function to create a Coord of arbitrary type with string RA [in degrees, not hours!], Dec.

Note
This factory accepts epoch. There is an overloaded version which uses a default.
Parameters
systemthe system (equ, fk5, galactic ..)
raright ascension
decdeclination
epochepoch of coordinate

Definition at line 1362 of file Coord.cc.

1367  {
1368  return makeCoord(system, dmsStringToAngle(ra), dmsStringToAngle(dec), epoch);
1369 }
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.
Definition: Coord.cc:1210
lsst::afw::geom::Angle dmsStringToAngle(std::string const dms)
Convert a dd:mm:ss string to Angle.
Definition: Coord.cc:343
afwCoord::Coord::Ptr lsst::afw::coord::makeCoord ( CoordSystem const  system,
lsst::afw::geom::Point2D const &  p2d,
lsst::afw::geom::AngleUnit  unit,
double const  epoch 
)

Factory function to create a Coord of arbitrary type with Point2D.

Note
This factory accepts epoch. There is an overloaded version which uses a default.
Parameters
systemthe system (equ, fk5, galactic ..)
p2dthe (eg) ra,dec in a Point2D
unitthe units (eg. degrees, radians)
epochepoch of coordinate

Definition at line 1326 of file Coord.cc.

1331  {
1332  if (unit == afwGeom::hours) {
1333  return makeCoord(system, afwGeom::Angle(p2d.getX(), afwGeom::hours), afwGeom::Angle(p2d.getY(), afwGeom::degrees), epoch);
1334  } else {
1335  return makeCoord(system, afwGeom::Angle(p2d.getX(), unit), afwGeom::Angle(p2d.getY(), unit), epoch);
1336  }
1337 }
AngleUnit const hours
Definition: Angle.h:93
AngleUnit const degrees
Definition: Angle.h:92
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.
Definition: Coord.cc:1210
afwCoord::Coord::Ptr lsst::afw::coord::makeCoord ( CoordSystem const  system,
lsst::afw::geom::Point3D const &  p3d,
double const  epoch,
bool  normalize = true,
lsst::afw::geom::Angle const  defaultLongitude = lsst::afw::geom::Angle(0.) 
)

Factory function to create a Coord of arbitrary type with a Point3D.

Note
This factory accepts epoch. There is an overloaded version which uses a default.
Parameters
systemthe system (equ, fk5, galactic ..)
p3dthe coord in Point3D format
epochepoch of coordinate
normalizenormalize the p3d provided
defaultLongitudelongitude to use if x=y=0

Definition at line 1295 of file Coord.cc.

1301  {
1302  Coord c(p3d, 2000.0, normalize, defaultLongitude);
1303  return makeCoord(system, c.getLongitude(), c.getLatitude(), epoch);
1304 }
lsst::afw::coord::Coord Coord
Definition: misc.h:39
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.
Definition: Coord.cc:1210
afwCoord::Coord::Ptr lsst::afw::coord::makeCoord ( CoordSystem const  system)

Lightweight factory to make an empty coord.

Parameters
systemthe system (FK5, ICRS, etc)

Definition at line 1388 of file Coord.cc.

1390  {
1391  switch (system) {
1392  case FK5:
1393  return boost::shared_ptr<Fk5Coord>(new Fk5Coord());
1394  break;
1395  case ICRS:
1396  return boost::shared_ptr<IcrsCoord>(new IcrsCoord());
1397  break;
1398  case GALACTIC:
1399  return boost::shared_ptr<GalacticCoord>(new GalacticCoord());
1400  break;
1401  case ECLIPTIC:
1402  return boost::shared_ptr<EclipticCoord>(new EclipticCoord());
1403  break;
1404  case TOPOCENTRIC:
1405  throw LSST_EXCEPT(ex::InvalidParameterError,
1406  "Cannot make Topocentric with makeCoord() (must also specify Observatory).\n"
1407  "Instantiate TopocentricCoord() directly.");
1408  break;
1409  default:
1410  throw LSST_EXCEPT(ex::InvalidParameterError,
1411  "Undefined CoordSystem: only FK5, ICRS, GALACTIC, ECLIPTIC, allowed.");
1412  break;
1413 
1414  }
1415 }
lsst::afw::coord::IcrsCoord IcrsCoord
Definition: misc.h:41
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
afwCoord::Coord::Ptr lsst::afw::coord::makeCoord ( CoordSystem const  system,
lsst::afw::geom::Angle const  ra,
lsst::afw::geom::Angle const  dec 
)

Factory function to create a Coord of arbitrary type with decimal RA,Dec in degrees.

Note
This factory assumes a default epoch
Most of the other factories (which don't accept epoch) call this one.
Parameters
systemthe system (equ, fk5, galactic ..)
raright ascension
decdeclination

Definition at line 1254 of file Coord.cc.

1258  {
1259 
1260  switch (system) {
1261  case FK5:
1262  return boost::shared_ptr<Fk5Coord>(new Fk5Coord(ra, dec, 2000.0));
1263  break;
1264  case ICRS:
1265  return boost::shared_ptr<IcrsCoord>(new IcrsCoord(ra, dec));
1266  break;
1267  case GALACTIC:
1268  return boost::shared_ptr<GalacticCoord>(new GalacticCoord(ra, dec));
1269  break;
1270  case ECLIPTIC:
1271  return boost::shared_ptr<EclipticCoord>(new EclipticCoord(ra, dec, 2000.0));
1272  break;
1273  case TOPOCENTRIC:
1274  throw LSST_EXCEPT(ex::InvalidParameterError,
1275  "Cannot make Topocentric with makeCoord() (must also specify Observatory).\n"
1276  "Instantiate TopocentricCoord() directly.");
1277  break;
1278  default:
1279  throw LSST_EXCEPT(ex::InvalidParameterError,
1280  "Undefined CoordSystem: only FK5, ICRS, GALACTIC, ECLIPTIC, and TOPOCENTRIC allowed.");
1281  break;
1282 
1283  }
1284 
1285 }
lsst::afw::coord::IcrsCoord IcrsCoord
Definition: misc.h:41
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
afwCoord::Coord::Ptr lsst::afw::coord::makeCoord ( CoordSystem const  system,
std::string const  ra,
std::string const  dec 
)

Factory function to create a Coord of arbitrary type with string RA [in degrees, not hours!], Dec.

Note
This factory uses a default epoch. There is an overloaded version which accepts an epoch.
Parameters
systemthe system (equ, fk5, galactic ..)
raright ascension
decdeclination

Definition at line 1375 of file Coord.cc.

1379  {
1380  return makeCoord(system, dmsStringToAngle(ra), dmsStringToAngle(dec));
1381 }
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.
Definition: Coord.cc:1210
lsst::afw::geom::Angle dmsStringToAngle(std::string const dms)
Convert a dd:mm:ss string to Angle.
Definition: Coord.cc:343
afwCoord::Coord::Ptr lsst::afw::coord::makeCoord ( CoordSystem const  system,
lsst::afw::geom::Point2D const &  p2d,
lsst::afw::geom::AngleUnit  unit 
)

Factory function to create a Coord of arbitrary type with Point2D.

Note
This factory uses a default epoch. There is an overloaded version which accepts an epoch.
Parameters
systemthe system (equ, fk5, galactic ..)
p2dthe (eg) ra,dec in a Point2D
unitthe units (eg. degrees, radians)

Definition at line 1345 of file Coord.cc.

1349  {
1350  if (unit == afwGeom::hours) {
1351  return makeCoord(system, afwGeom::Angle(p2d.getX(), afwGeom::hours), afwGeom::Angle(p2d.getY(), afwGeom::degrees));
1352  } else {
1353  return makeCoord(system, afwGeom::Angle(p2d.getX(), unit), afwGeom::Angle(p2d.getY(), unit));
1354  }
1355 }
AngleUnit const hours
Definition: Angle.h:93
AngleUnit const degrees
Definition: Angle.h:92
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.
Definition: Coord.cc:1210
afwCoord::Coord::Ptr lsst::afw::coord::makeCoord ( CoordSystem const  system,
lsst::afw::geom::Point3D const &  p3d,
bool  normalize = true,
lsst::afw::geom::Angle const  defaultLongitude = lsst::afw::geom::Angle(0.) 
)

Factory function to create a Coord of arbitrary type with a Point3D.

Note
This factory uses a default epoch. There is an overloaded version which accepts an epoch.
Parameters
systemthe system (equ, fk5, galactic ..)
p3dthe coord in Point3D format
normalizenormalize the p3d provided
defaultLongitudelongitude to use if x=y=0

Definition at line 1311 of file Coord.cc.

1316  {
1317  Coord c(p3d, 2000.0, normalize, defaultLongitude);
1318  return makeCoord(system, c.getLongitude(), c.getLatitude());
1319 }
lsst::afw::coord::Coord Coord
Definition: misc.h:39
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.
Definition: Coord.cc:1210
afwCoord::CoordSystem lsst::afw::coord::makeCoordEnum ( std::string const  system)

A utility function to get the enum value of a coordinate system from a string name.

Definition at line 116 of file Coord.cc.

116  {
117  static CoordSystemMap idmap = getCoordSystemMap();
118  if (idmap.find(system) != idmap.end()) {
119  return idmap[system];
120  } else {
121  throw LSST_EXCEPT(ex::InvalidParameterError, "System " + system + " not defined.");
122  }
123 }
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
std::ostream & lsst::afw::coord::operator<< ( std::ostream &  os,
coord::Observatory const &  obs 
)

Print an Observatory to the stream

Parameters
osStream to print to
obsthe Observatory to print

Definition at line 158 of file Observatory.cc.

161 {
162  return os << (boost::format("%gW, %gN %g")
163  % obs.getLatitude().asDegrees()
164  % obs.getLongitude().asDegrees()
165  % obs.getElevation()).str();
166 }
std::ostream & lsst::afw::coord::operator<< ( std::ostream &  os,
afwCoord::Coord const &  coord 
)

Definition at line 1417 of file Coord.cc.

1417  {
1418  return os << coord.getPosition() << "@" << coord.getEpoch();
1419 }