source: branches/FACT++_lidctrl_usb/erfa/src/pvstar.c@ 19758

Last change on this file since 19758 was 18711, checked in by tbretz, 8 years ago
Updated to ERFA 1.3.0 (no relevant code change except the leap second at the beginning of 2017)
File size: 8.5 KB
Line 
1#include "erfa.h"
2
3int 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-2016, 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
104/* Isolate the radial component of the velocity (AU/day, inertial). */
105 eraPn(pv[0], &r, x);
106 vr = eraPdp(x, pv[1]);
107 eraSxp(vr, x, ur);
108
109/* Isolate the transverse component of the velocity (AU/day, inertial). */
110 eraPmp(pv[1], ur, ut);
111 vt = eraPm(ut);
112
113/* Special-relativity dimensionless parameters. */
114 bett = vt / ERFA_DC;
115 betr = vr / ERFA_DC;
116
117/* The inertial-to-observed correction terms. */
118 d = 1.0 + betr;
119 w = 1.0 - betr*betr - bett*bett;
120 if (d == 0.0 || w < 0) return -1;
121 del = sqrt(w) - 1.0;
122
123/* Apply relativistic correction factor to radial velocity component. */
124 w = (betr != 0) ? (betr - del) / (betr * d) : 1.0;
125 eraSxp(w, ur, usr);
126
127/* Apply relativistic correction factor to tangential velocity */
128/* component. */
129 eraSxp(1.0/d, ut, ust);
130
131/* Combine the two to obtain the observed velocity vector (AU/day). */
132 eraPpp(usr, ust, pv[1]);
133
134/* Cartesian to spherical. */
135 eraPv2s(pv, &a, dec, &r, &rad, &decd, &rd);
136 if (r == 0.0) return -2;
137
138/* Return RA in range 0 to 2pi. */
139 *ra = eraAnp(a);
140
141/* Return proper motions in radians per year. */
142 *pmr = rad * ERFA_DJY;
143 *pmd = decd * ERFA_DJY;
144
145/* Return parallax in arcsec. */
146 *px = ERFA_DR2AS / r;
147
148/* Return radial velocity in km/s. */
149 *rv = 1e-3 * rd * ERFA_DAU / ERFA_DAYSEC;
150
151/* OK status. */
152 return 0;
153
154}
155/*----------------------------------------------------------------------
156**
157**
158** Copyright (C) 2013-2016, NumFOCUS Foundation.
159** All rights reserved.
160**
161** This library is derived, with permission, from the International
162** Astronomical Union's "Standards of Fundamental Astronomy" library,
163** available from http://www.iausofa.org.
164**
165** The ERFA version is intended to retain identical functionality to
166** the SOFA library, but made distinct through different function and
167** file names, as set out in the SOFA license conditions. The SOFA
168** original has a role as a reference standard for the IAU and IERS,
169** and consequently redistribution is permitted only in its unaltered
170** state. The ERFA version is not subject to this restriction and
171** therefore can be included in distributions which do not support the
172** concept of "read only" software.
173**
174** Although the intent is to replicate the SOFA API (other than
175** replacement of prefix names) and results (with the exception of
176** bugs; any that are discovered will be fixed), SOFA is not
177** responsible for any errors found in this version of the library.
178**
179** If you wish to acknowledge the SOFA heritage, please acknowledge
180** that you are using a library derived from SOFA, rather than SOFA
181** itself.
182**
183**
184** TERMS AND CONDITIONS
185**
186** Redistribution and use in source and binary forms, with or without
187** modification, are permitted provided that the following conditions
188** are met:
189**
190** 1 Redistributions of source code must retain the above copyright
191** notice, this list of conditions and the following disclaimer.
192**
193** 2 Redistributions in binary form must reproduce the above copyright
194** notice, this list of conditions and the following disclaimer in
195** the documentation and/or other materials provided with the
196** distribution.
197**
198** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
199** the International Astronomical Union nor the names of its
200** contributors may be used to endorse or promote products derived
201** from this software without specific prior written permission.
202**
203** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
204** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
205** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
206** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
207** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
208** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
209** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
210** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
211** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
212** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
213** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
214** POSSIBILITY OF SUCH DAMAGE.
215**
216*/
Note: See TracBrowser for help on using the repository browser.