FACT++  1.0
pvstar.c
Go to the documentation of this file.
1 #include "erfa.h"
2 
3 int eraPvstar(double pv[2][3], double *ra, double *dec,
4  double *pmr, double *pmd, double *px, double *rv)
5 /*
6 ** - - - - - - - - - -
7 ** e r a P v s t a r
8 ** - - - - - - - - - -
9 **
10 ** Convert star position+velocity vector to catalog coordinates.
11 **
12 ** Given (Note 1):
13 ** pv double[2][3] pv-vector (AU, AU/day)
14 **
15 ** Returned (Note 2):
16 ** ra double right ascension (radians)
17 ** dec double declination (radians)
18 ** pmr double RA proper motion (radians/year)
19 ** pmd double Dec proper motion (radians/year)
20 ** px double parallax (arcsec)
21 ** rv double radial velocity (km/s, positive = receding)
22 **
23 ** Returned (function value):
24 ** int status:
25 ** 0 = OK
26 ** -1 = superluminal speed (Note 5)
27 ** -2 = null position vector
28 **
29 ** Notes:
30 **
31 ** 1) The specified pv-vector is the coordinate direction (and its rate
32 ** of change) for the date at which the light leaving the star
33 ** reached the solar-system barycenter.
34 **
35 ** 2) The star data returned by this function are "observables" for an
36 ** imaginary observer at the solar-system barycenter. Proper motion
37 ** and radial velocity are, strictly, in terms of barycentric
38 ** coordinate time, TCB. For most practical applications, it is
39 ** permissible to neglect the distinction between TCB and ordinary
40 ** "proper" time on Earth (TT/TAI). The result will, as a rule, be
41 ** limited by the intrinsic accuracy of the proper-motion and
42 ** radial-velocity data; moreover, the supplied pv-vector is likely
43 ** to be merely an intermediate result (for example generated by the
44 ** function eraStarpv), so that a change of time unit will cancel
45 ** out overall.
46 **
47 ** In accordance with normal star-catalog conventions, the object's
48 ** right ascension and declination are freed from the effects of
49 ** secular aberration. The frame, which is aligned to the catalog
50 ** equator and equinox, is Lorentzian and centered on the SSB.
51 **
52 ** Summarizing, the specified pv-vector is for most stars almost
53 ** identical to the result of applying the standard geometrical
54 ** "space motion" transformation to the catalog data. The
55 ** differences, which are the subject of the Stumpff paper cited
56 ** below, are:
57 **
58 ** (i) In stars with significant radial velocity and proper motion,
59 ** the constantly changing light-time distorts the apparent proper
60 ** motion. Note that this is a classical, not a relativistic,
61 ** effect.
62 **
63 ** (ii) The transformation complies with special relativity.
64 **
65 ** 3) Care is needed with units. The star coordinates are in radians
66 ** and the proper motions in radians per Julian year, but the
67 ** parallax is in arcseconds; the radial velocity is in km/s, but
68 ** the pv-vector result is in AU and AU/day.
69 **
70 ** 4) The proper motions are the rate of change of the right ascension
71 ** and declination at the catalog epoch and are in radians per Julian
72 ** year. The RA proper motion is in terms of coordinate angle, not
73 ** true angle, and will thus be numerically larger at high
74 ** declinations.
75 **
76 ** 5) Straight-line motion at constant speed in the inertial frame is
77 ** assumed. If the speed is greater than or equal to the speed of
78 ** light, the function aborts with an error status.
79 **
80 ** 6) The inverse transformation is performed by the function eraStarpv.
81 **
82 ** Called:
83 ** eraPn decompose p-vector into modulus and direction
84 ** eraPdp scalar product of two p-vectors
85 ** eraSxp multiply p-vector by scalar
86 ** eraPmp p-vector minus p-vector
87 ** eraPm modulus of p-vector
88 ** eraPpp p-vector plus p-vector
89 ** eraPv2s pv-vector to spherical
90 ** eraAnp normalize angle into range 0 to 2pi
91 **
92 ** Reference:
93 **
94 ** Stumpff, P., 1985, Astron.Astrophys. 144, 232-240.
95 **
96 ** Copyright (C) 2013-2015, NumFOCUS Foundation.
97 ** Derived, with permission, from the SOFA library. See notes at end of file.
98 */
99 {
100  double r, x[3], vr, ur[3], vt, ut[3], bett, betr, d, w, del,
101  usr[3], ust[3], a, rad, decd, rd;
102 
103 /* Isolate the radial component of the velocity (AU/day, inertial). */
104  eraPn(pv[0], &r, x);
105  vr = eraPdp(x, pv[1]);
106  eraSxp(vr, x, ur);
107 
108 /* Isolate the transverse component of the velocity (AU/day, inertial). */
109  eraPmp(pv[1], ur, ut);
110  vt = eraPm(ut);
111 
112 /* Special-relativity dimensionless parameters. */
113  bett = vt / ERFA_DC;
114  betr = vr / ERFA_DC;
115 
116 /* The inertial-to-observed correction terms. */
117  d = 1.0 + betr;
118  w = 1.0 - betr*betr - bett*bett;
119  if (d == 0.0 || w < 0) return -1;
120  del = sqrt(w) - 1.0;
121 
122 /* Apply relativistic correction factor to radial velocity component. */
123  w = (betr != 0) ? (betr - del) / (betr * d) : 1.0;
124  eraSxp(w, ur, usr);
125 
126 /* Apply relativistic correction factor to tangential velocity */
127 /* component. */
128  eraSxp(1.0/d, ut, ust);
129 
130 /* Combine the two to obtain the observed velocity vector (AU/day). */
131  eraPpp(usr, ust, pv[1]);
132 
133 /* Cartesian to spherical. */
134  eraPv2s(pv, &a, dec, &r, &rad, &decd, &rd);
135  if (r == 0.0) return -2;
136 
137 /* Return RA in range 0 to 2pi. */
138  *ra = eraAnp(a);
139 
140 /* Return proper motions in radians per year. */
141  *pmr = rad * ERFA_DJY;
142  *pmd = decd * ERFA_DJY;
143 
144 /* Return parallax in arcsec. */
145  *px = ERFA_DR2AS / r;
146 
147 /* Return radial velocity in km/s. */
148  *rv = 1e-3 * rd * ERFA_DAU / ERFA_DAYSEC;
149 
150 /* OK status. */
151  return 0;
152 
153 }
154 /*----------------------------------------------------------------------
155 **
156 **
157 ** Copyright (C) 2013-2015, NumFOCUS Foundation.
158 ** All rights reserved.
159 **
160 ** This library is derived, with permission, from the International
161 ** Astronomical Union's "Standards of Fundamental Astronomy" library,
162 ** available from http://www.iausofa.org.
163 **
164 ** The ERFA version is intended to retain identical functionality to
165 ** the SOFA library, but made distinct through different function and
166 ** file names, as set out in the SOFA license conditions. The SOFA
167 ** original has a role as a reference standard for the IAU and IERS,
168 ** and consequently redistribution is permitted only in its unaltered
169 ** state. The ERFA version is not subject to this restriction and
170 ** therefore can be included in distributions which do not support the
171 ** concept of "read only" software.
172 **
173 ** Although the intent is to replicate the SOFA API (other than
174 ** replacement of prefix names) and results (with the exception of
175 ** bugs; any that are discovered will be fixed), SOFA is not
176 ** responsible for any errors found in this version of the library.
177 **
178 ** If you wish to acknowledge the SOFA heritage, please acknowledge
179 ** that you are using a library derived from SOFA, rather than SOFA
180 ** itself.
181 **
182 **
183 ** TERMS AND CONDITIONS
184 **
185 ** Redistribution and use in source and binary forms, with or without
186 ** modification, are permitted provided that the following conditions
187 ** are met:
188 **
189 ** 1 Redistributions of source code must retain the above copyright
190 ** notice, this list of conditions and the following disclaimer.
191 **
192 ** 2 Redistributions in binary form must reproduce the above copyright
193 ** notice, this list of conditions and the following disclaimer in
194 ** the documentation and/or other materials provided with the
195 ** distribution.
196 **
197 ** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
198 ** the International Astronomical Union nor the names of its
199 ** contributors may be used to endorse or promote products derived
200 ** from this software without specific prior written permission.
201 **
202 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
203 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
204 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
205 ** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
206 ** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
207 ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
208 ** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
209 ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
210 ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
211 ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
212 ** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
213 ** POSSIBILITY OF SUCH DAMAGE.
214 **
215 */
double eraPdp(double a[3], double b[3])
Definition: pdp.c:3
#define ERFA_DAU
Definition: erfam.h:102
void eraPv2s(double pv[2][3], double *theta, double *phi, double *r, double *td, double *pd, double *rd)
Definition: pv2s.c:3
#define ERFA_DJY
Definition: erfam.h:78
#define ERFA_DC
Definition: erfam.h:111
#define ERFA_DR2AS
Definition: erfam.h:57
double eraPm(double p[3])
Definition: pm.c:3
#define ERFA_DAYSEC
Definition: erfam.h:75
void eraPpp(double a[3], double b[3], double apb[3])
Definition: ppp.c:3
void eraSxp(double s, double p[3], double sp[3])
Definition: sxp.c:3
void eraPmp(double a[3], double b[3], double amb[3])
Definition: pmp.c:3
void eraPn(double p[3], double *r, double u[3])
Definition: pn.c:3
int eraPvstar(double pv[2][3], double *ra, double *dec, double *pmr, double *pmd, double *px, double *rv)
Definition: pvstar.c:3
double eraAnp(double a)
Definition: anp.c:3