LSSTApplications  8.0.0.0+107,8.0.0.1+13,9.1+18,9.2,master-g084aeec0a4,master-g0aced2eed8+6,master-g15627eb03c,master-g28afc54ef9,master-g3391ba5ea0,master-g3d0fb8ae5f,master-g4432ae2e89+36,master-g5c3c32f3ec+17,master-g60f1e072bb+1,master-g6a3ac32d1b,master-g76a88a4307+1,master-g7bce1f4e06+57,master-g8ff4092549+31,master-g98e65bf68e,master-ga6b77976b1+53,master-gae20e2b580+3,master-gb584cd3397+53,master-gc5448b162b+1,master-gc54cf9771d,master-gc69578ece6+1,master-gcbf758c456+22,master-gcec1da163f+63,master-gcf15f11bcc,master-gd167108223,master-gf44c96c709
LSSTDataManagementBasePackage
Public Types | Public Member Functions | Static Public Attributes | Private Attributes | List of all members
lsst::ap::match::ReferencePosition Class Reference

#include <ReferencePosition.h>

Inheritance diagram for lsst::ap::match::ReferencePosition:
lsst::ap::match::BBox

Public Types

enum  Flags { MOVING = 0x1, PARALLAX = 0x2, PARALLAX_COR = 0x4 }
 

Public Member Functions

 ReferencePosition (int64_t id, lsst::afw::geom::Angle const ra, lsst::afw::geom::Angle const dec, double epoch=J2000_MJD)
 
virtual ~ReferencePosition ()
 
void clearMotion ()
 
void setMotion (double muRa, double muDecl, lsst::afw::geom::Angle parallax, double vRadial, bool trueAngle, bool parallaxCor)
 
void setTimeRange (double epoch1, double epoch2)
 
int64_t getId () const
 
double getEpoch () const
 
int getFlags () const
 
lsst::afw::coord::IcrsCoord const & getSphericalCoords () const
 
Eigen::Vector3d const & getPosition () const
 
Eigen::Vector3d const & getVelocity () const
 
Eigen::Vector3d const getPosition (double epoch) const
 
Eigen::Vector3d const getPosition (double epoch, Eigen::Vector3d const &origin) const
 
virtual double getMinCoord0 () const
 
virtual double getMaxCoord0 () const
 
virtual double getMinCoord1 () const
 
virtual double getMaxCoord1 () const
 
- Public Member Functions inherited from lsst::ap::match::BBox
virtual ~BBox ()
 

Static Public Attributes

static double const MIN_PARALLAX = 1e-11
 

Private Attributes

lsst::afw::coord::IcrsCoord _sc
 (ra, decl) at _epoch, ICRS rad More...
 
int64_t _id
 
double _epoch
 epoch of reference position, MJD More...
 
Eigen::Vector3d _p
 (x, y, z) at _epoch More...
 
Eigen::Vector3d _v
 (dx/dt, dy/dt, dz/dt) More...
 
lsst::afw::geom::Angle _parallax
 parallax, rad More...
 
lsst::afw::geom::Angle _minDecl
 
lsst::afw::geom::Angle _maxDecl
 
lsst::afw::geom::Angle _minRa
 
lsst::afw::geom::Angle _maxRa
 
int _flags
 Bit-wise OR of Flags. More...
 

Detailed Description

Position related parameters of a simulated reference catalog source. There are no errors - these are inputs to the image simulator.

Definition at line 48 of file ReferencePosition.h.

Member Enumeration Documentation

Enumerator
MOVING 

Set if the reference position has proper motion.

PARALLAX 

Set if the reference position has parallax > MIN_PARALLAX

PARALLAX_COR 

Set if parallax corrections are applied by getPosition().

Definition at line 50 of file ReferencePosition.h.

Constructor & Destructor Documentation

lsst::ap::match::ReferencePosition::ReferencePosition ( int64_t  id,
lsst::afw::geom::Angle const  ra,
lsst::afw::geom::Angle const  decl,
double  epoch = J2000_MJD 
)
inline

Constructs a stationary, infinitely distant reference position.

Parameters
idReference position id
raReference position right ascension, ICRS (radians)
declReference position declination, ICRS (radians)
epochReference position epoch, MJD

Definition at line 38 of file ReferencePosition.cc.

43  :
44  _sc(ra, decl),
45  _id(id),
46  _epoch(epoch),
47  _p(_sc.getVector().asEigen()),
48  _v(Eigen::Vector3d::Zero()),
49  _parallax(0.0),
50  _minDecl(decl),
51  _maxDecl(decl),
52  _minRa(ra),
53  _maxRa(ra),
54  _flags(0)
55 { }
lsst::afw::coord::IcrsCoord _sc
(ra, decl) at _epoch, ICRS rad
lsst::afw::geom::Angle _parallax
parallax, rad
double _epoch
epoch of reference position, MJD
int _flags
Bit-wise OR of Flags.
Eigen::Vector3d _v
(dx/dt, dy/dt, dz/dt)
lsst::afw::geom::Point3D getVector() const
Return our contents in a position vector.
Definition: Coord.cc:490
Eigen::Vector3d _p
(x, y, z) at _epoch
EigenVector const & asEigen() const
Return a fixed-size Eigen representation of the coordinate object.
virtual lsst::ap::match::ReferencePosition::~ReferencePosition ( )
inlinevirtual

Definition at line 65 of file ReferencePosition.h.

65 { }

Member Function Documentation

void lsst::ap::match::ReferencePosition::clearMotion ( )

Clears the motion parameters of this reference position.

Definition at line 54 of file ReferencePosition.cc.

54  {
55  _p = _sc.getVector().asEigen();
56  _v = Eigen::Vector3d::Zero();
57  _parallax = 0.0 * radians;
62  _flags = 0;
63 }
lsst::afw::coord::IcrsCoord _sc
(ra, decl) at _epoch, ICRS rad
lsst::afw::geom::Angle getLongitude() const
The main access method for the longitudinal coordinate.
Definition: Coord.h:112
lsst::afw::geom::Angle _parallax
parallax, rad
int _flags
Bit-wise OR of Flags.
Eigen::Vector3d _v
(dx/dt, dy/dt, dz/dt)
AngleUnit const radians
constant with units of radians
Definition: Angle.h:91
lsst::afw::geom::Point3D getVector() const
Return our contents in a position vector.
Definition: Coord.cc:490
Eigen::Vector3d _p
(x, y, z) at _epoch
EigenVector const & asEigen() const
Return a fixed-size Eigen representation of the coordinate object.
lsst::afw::geom::Angle getLatitude() const
The main access method for the latitudinal coordinate.
Definition: Coord.h:119
double lsst::ap::match::ReferencePosition::getEpoch ( ) const
inline

Returns the epoch (MJD) of this reference position.

Definition at line 65 of file ReferencePosition.cc.

65  {
66  return _epoch;
67 }
double _epoch
epoch of reference position, MJD
int lsst::ap::match::ReferencePosition::getFlags ( ) const
inline

Returns a bit-wise ORed combination of ReferencePosition::Flags describing this reference position.

Definition at line 72 of file ReferencePosition.cc.

72  {
73  return _flags;
74 }
int _flags
Bit-wise OR of Flags.
int64_t lsst::ap::match::ReferencePosition::getId ( ) const
inline

Returns the unique integer id of this reference position.

Definition at line 59 of file ReferencePosition.cc.

59  {
60  return _id;
61 }
double lsst::ap::match::ReferencePosition::getMaxCoord0 ( ) const
virtual

Implements lsst::ap::match::BBox.

Definition at line 146 of file ReferencePosition.cc.

146  {
147  return static_cast<double>(_maxRa);
148 }
double lsst::ap::match::ReferencePosition::getMaxCoord1 ( ) const
virtual

Implements lsst::ap::match::BBox.

Definition at line 154 of file ReferencePosition.cc.

154  {
155  return static_cast<double>(_maxDecl);
156 }
double lsst::ap::match::ReferencePosition::getMinCoord0 ( ) const
virtual

Implements lsst::ap::match::BBox.

Definition at line 142 of file ReferencePosition.cc.

142  {
143  return static_cast<double>(_minRa);
144 }
double lsst::ap::match::ReferencePosition::getMinCoord1 ( ) const
virtual

Implements lsst::ap::match::BBox.

Definition at line 150 of file ReferencePosition.cc.

150  {
151  return static_cast<double>(_minDecl);
152 }
Eigen::Vector3d const & lsst::ap::match::ReferencePosition::getPosition ( ) const
inline

Returns the reference position at epoch getEpoch(). If the reference position flags contain the PARALLAX bit, then this vector is in units of AU and is in the ICRS system (with an origin at the solar-system barycenter). Otherwise, this is a unit-vector - the reference position is treated as infinitely distant from an observer.

Coordinates are in the ICRS system for a barycentric observer.

Definition at line 92 of file ReferencePosition.cc.

92  {
93  return _p;
94 }
Eigen::Vector3d _p
(x, y, z) at _epoch
Eigen::Vector3d const lsst::ap::match::ReferencePosition::getPosition ( double  epoch) const
inline

Returns the reference position at epoch epoch, accounting for motion and optionally adjusting the coordinates to be geocentric rather than barycentric. The return value is normalized to be a unit 3-vector.

Note that the change to a geocentric origin is only performed if the the reference position flags contain the PARALLAX bit and ssbToGeo is true. Otherwise, the reference position is treated as infinitely distant (i.e. the change of origin has no effect),

Definition at line 114 of file ReferencePosition.cc.

114  {
115  if ((_flags & MOVING) == 0) {
116  return _p;
117  }
118  Eigen::Vector3d p = _p + _v*(epoch - _epoch);
119  if ((_flags & PARALLAX_COR) != 0) {
120  p -= lsst::ap::utils::earthPosition(epoch);
121  }
122  return p.normalized();
123 }
double _epoch
epoch of reference position, MJD
int _flags
Bit-wise OR of Flags.
Eigen::Vector3d _v
(dx/dt, dy/dt, dz/dt)
Eigen::Vector3d _p
(x, y, z) at _epoch
Set if the reference position has proper motion.
Eigen::Vector3d const earthPosition(double const epoch)
Eigen::Vector3d const lsst::ap::match::ReferencePosition::getPosition ( double  epoch,
Eigen::Vector3d const &  origin 
) const
inline

Returns the reference position at epoch epoch, with a change of origin.

See Also
getPosition(double) const

Definition at line 130 of file ReferencePosition.cc.

133  {
134  if ((_flags & MOVING) == 0) {
135  return _p;
136  }
137  Eigen::Vector3d p = _p + _v*(epoch - _epoch);
138  if ((_flags & PARALLAX_COR) != 0) {
139  p -= origin;
140  }
141  return p.normalized();
142 }
double _epoch
epoch of reference position, MJD
int _flags
Bit-wise OR of Flags.
Eigen::Vector3d _v
(dx/dt, dy/dt, dz/dt)
Eigen::Vector3d _p
(x, y, z) at _epoch
Set if the reference position has proper motion.
lsst::afw::coord::IcrsCoord const & lsst::ap::match::ReferencePosition::getSphericalCoords ( ) const
inline

Returns the ICRS spherical coordinates (rad) of the reference position at epoch getEpoch().

Definition at line 79 of file ReferencePosition.cc.

79  {
80  return _sc;
81 }
lsst::afw::coord::IcrsCoord _sc
(ra, decl) at _epoch, ICRS rad
Eigen::Vector3d const & lsst::ap::match::ReferencePosition::getVelocity ( ) const
inline

Returns the velocity of the reference position. If the reference position flags contain the PARALLAX bit, then this vector is in units of AU/day. Otherwise, units are radians/day (and will not have a radial component).

Definition at line 101 of file ReferencePosition.cc.

101  {
102  return _v;
103 }
Eigen::Vector3d _v
(dx/dt, dy/dt, dz/dt)
void lsst::ap::match::ReferencePosition::setMotion ( double  muRa,
double  muDecl,
lsst::afw::geom::Angle  parallax,
double  vRadial,
bool  trueAngle,
bool  parallaxCor 
)

Sets the motion parameters of this reference position.

Parameters
muRaRate of change of RA (true or coordinate angle), rad/day
muDeclDeclination rate of change, rad/day
parallaxParallax, rad
vRadialRadial velocity, AU/day
trueAngleIs muRa dRA/dt*cos(decl) (true) or dRA/dt (false)?
parallaxCorApply parallax corrections in getPosition()?

Definition at line 67 of file ReferencePosition.cc.

76  {
77  double sr = std::sin(_sc.getLongitude().asRadians());
78  double cr = std::cos(_sc.getLongitude().asRadians());
79  double sd = std::sin(_sc.getLatitude().asRadians());
80  double cd = std::cos(_sc.getLatitude().asRadians());
81  if (trueAngle) {
82  muRa = (cd == 0.0) ? 0.0 : muRa/cd;
83  }
84  // if parallax is tiny, treat this as a position on the celestial sphere
85  if (parallax < MIN_PARALLAX) {
86  _p.x() = cd*cr;
87  _p.y() = cd*sr;
88  _p.z() = sd;
89  double t = sd*muDecl;
90  _v.x() = -_p.y()*muRa - cr*t;
91  _v.y() = _p.x()*muRa - sr*t;
92  _v.z() = cd*muDecl;
93  _flags = MOVING;
94  return;
95  }
96  double r = 1.0 / parallax.asRadians();
97  double s = r*cd;
98  double t = r*sd*muDecl;
99  double u = cd*vRadial;
100  _p.x() = s*cr;
101  _p.y() = s*sr;
102  _p.z() = r*sd;
103  _v.x() = cr*u - _p.y()*muRa - cr*t;
104  _v.y() = sr*u + _p.x()*muRa - sr*t;
105  _v.z() = sd*vRadial + s*muDecl;
106  if (_v.squaredNorm() > 0.25*C_AU_PER_DAY*C_AU_PER_DAY) {
107  throw LSST_EXCEPT(pexExcept::RuntimeError,
108  "star velocity vector magnitude exceeds half "
109  "the speed of light");
110  }
111  _parallax = parallax;
112  _flags = MOVING | PARALLAX | (parallaxCor ? PARALLAX_COR : 0);
113 }
lsst::afw::coord::IcrsCoord _sc
(ra, decl) at _epoch, ICRS rad
table::Key< table::Array< double > > cd
Definition: Wcs.cc:1087
lsst::afw::geom::Angle getLongitude() const
The main access method for the longitudinal coordinate.
Definition: Coord.h:112
lsst::afw::geom::Angle _parallax
parallax, rad
int _flags
Bit-wise OR of Flags.
Eigen::Vector3d _v
(dx/dt, dy/dt, dz/dt)
Eigen::Vector3d _p
(x, y, z) at _epoch
double asRadians() const
Definition: Angle.h:122
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
lsst::afw::geom::Angle getLatitude() const
The main access method for the latitudinal coordinate.
Definition: Coord.h:119
Set if the reference position has proper motion.
void lsst::ap::match::ReferencePosition::setTimeRange ( double  epoch1,
double  epoch2 
)

Sets the bounding box (in spherical coordinates) of the reference position to the bounding box of its path over the given time range. If SSB to geocentric corrections are enabled, the box is additionally padded by twice the parallax.

The input epochs need not be ordered.

Definition at line 122 of file ReferencePosition.cc.

122  {
123  if ((_flags & MOVING) != 0) {
124  Eigen::Vector3d p1 = _p + _v*(epoch1 - _epoch);
125  Eigen::Vector3d p2 = _p + _v*(epoch2 - _epoch);
126  Eigen::Vector3d m = p1 + p2;
127  Angle r = std::max(angularSeparation(m, p1),
128  angularSeparation(m, p2));
129  if ((_flags & PARALLAX_COR) != 0) {
130  r += 2.0*_parallax;
131  }
132  IcrsCoord sc = cartesianToIcrs(m);
133  Angle alpha = maxAlpha(r, sc.getLatitude());
134  _minDecl = clampPhi(sc.getLatitude() - r);
135  _maxDecl = clampPhi(sc.getLatitude() + r);
136  _minRa = sc.getLongitude() - alpha;
137  _maxRa = sc.getLongitude() + alpha;
138  }
139 }
lsst::afw::geom::Angle const angularSeparation(Eigen::Vector3d const &v1, Eigen::Vector3d const &v2)
Definition: SpatialUtils.h:83
lsst::afw::geom::Angle getLongitude() const
The main access method for the longitudinal coordinate.
Definition: Coord.h:112
lsst::afw::coord::IcrsCoord const cartesianToIcrs(Eigen::Vector3d const &v)
Definition: SpatialUtils.h:74
lsst::afw::geom::Angle _parallax
parallax, rad
double _epoch
epoch of reference position, MJD
double max
Definition: attributes.cc:218
int _flags
Bit-wise OR of Flags.
Eigen::Vector3d _v
(dx/dt, dy/dt, dz/dt)
double maxAlpha(double const theta, double const centerDec)
Definition: SpatialUtil.cc:279
Eigen::Vector3d _p
(x, y, z) at _epoch
double alpha(double const theta, double const centerDec, double const dec)
Definition: SpatialUtil.cc:248
lsst::afw::geom::Angle getLatitude() const
The main access method for the latitudinal coordinate.
Definition: Coord.h:119
Set if the reference position has proper motion.
A class to handle Icrs coordinates (inherits from Coord)
Definition: Coord.h:156

Member Data Documentation

double lsst::ap::match::ReferencePosition::_epoch
private

epoch of reference position, MJD

Definition at line 99 of file ReferencePosition.h.

int lsst::ap::match::ReferencePosition::_flags
private

Bit-wise OR of Flags.

Definition at line 108 of file ReferencePosition.h.

int64_t lsst::ap::match::ReferencePosition::_id
private

Definition at line 98 of file ReferencePosition.h.

lsst::afw::geom::Angle lsst::ap::match::ReferencePosition::_maxDecl
private

Definition at line 105 of file ReferencePosition.h.

lsst::afw::geom::Angle lsst::ap::match::ReferencePosition::_maxRa
private

Definition at line 107 of file ReferencePosition.h.

lsst::afw::geom::Angle lsst::ap::match::ReferencePosition::_minDecl
private

Definition at line 104 of file ReferencePosition.h.

lsst::afw::geom::Angle lsst::ap::match::ReferencePosition::_minRa
private

Definition at line 106 of file ReferencePosition.h.

Eigen::Vector3d lsst::ap::match::ReferencePosition::_p
private

(x, y, z) at _epoch

Definition at line 100 of file ReferencePosition.h.

lsst::afw::geom::Angle lsst::ap::match::ReferencePosition::_parallax
private

parallax, rad

Definition at line 102 of file ReferencePosition.h.

lsst::afw::coord::IcrsCoord lsst::ap::match::ReferencePosition::_sc
private

(ra, decl) at _epoch, ICRS rad

Definition at line 97 of file ReferencePosition.h.

Eigen::Vector3d lsst::ap::match::ReferencePosition::_v
private

(dx/dt, dy/dt, dz/dt)

Definition at line 101 of file ReferencePosition.h.

double const lsst::ap::match::ReferencePosition::MIN_PARALLAX = 1e-11
static

Definition at line 58 of file ReferencePosition.h.


The documentation for this class was generated from the following files: