source: trunk/FACT++/sofa/src/pvstar.c@ 18368

Last change on this file since 18368 was 18346, checked in by tbretz, 11 years ago
File size: 9.9 KB
Line 
1#include "sofa.h"
2
3int iauPvstar(double pv[2][3], double *ra, double *dec,
4 double *pmr, double *pmd, double *px, double *rv)
5/*
6** - - - - - - - - - -
7** i a u P v s t a r
8** - - - - - - - - - -
9**
10** Convert star position+velocity vector to catalog coordinates.
11**
12** This function is part of the International Astronomical Union's
13** SOFA (Standards Of Fundamental Astronomy) software collection.
14**
15** Status: support function.
16**
17** Given (Note 1):
18** pv double[2][3] pv-vector (AU, AU/day)
19**
20** Returned (Note 2):
21** ra double right ascension (radians)
22** dec double declination (radians)
23** pmr double RA proper motion (radians/year)
24** pmd double Dec proper motion (radians/year)
25** px double parallax (arcsec)
26** rv double radial velocity (km/s, positive = receding)
27**
28** Returned (function value):
29** int status:
30** 0 = OK
31** -1 = superluminal speed (Note 5)
32** -2 = null position vector
33**
34** Notes:
35**
36** 1) The specified pv-vector is the coordinate direction (and its rate
37** of change) for the date at which the light leaving the star
38** reached the solar-system barycenter.
39**
40** 2) The star data returned by this function are "observables" for an
41** imaginary observer at the solar-system barycenter. Proper motion
42** and radial velocity are, strictly, in terms of barycentric
43** coordinate time, TCB. For most practical applications, it is
44** permissible to neglect the distinction between TCB and ordinary
45** "proper" time on Earth (TT/TAI). The result will, as a rule, be
46** limited by the intrinsic accuracy of the proper-motion and
47** radial-velocity data; moreover, the supplied pv-vector is likely
48** to be merely an intermediate result (for example generated by the
49** function iauStarpv), so that a change of time unit will cancel
50** out overall.
51**
52** In accordance with normal star-catalog conventions, the object's
53** right ascension and declination are freed from the effects of
54** secular aberration. The frame, which is aligned to the catalog
55** equator and equinox, is Lorentzian and centered on the SSB.
56**
57** Summarizing, the specified pv-vector is for most stars almost
58** identical to the result of applying the standard geometrical
59** "space motion" transformation to the catalog data. The
60** differences, which are the subject of the Stumpff paper cited
61** below, are:
62**
63** (i) In stars with significant radial velocity and proper motion,
64** the constantly changing light-time distorts the apparent proper
65** motion. Note that this is a classical, not a relativistic,
66** effect.
67**
68** (ii) The transformation complies with special relativity.
69**
70** 3) Care is needed with units. The star coordinates are in radians
71** and the proper motions in radians per Julian year, but the
72** parallax is in arcseconds; the radial velocity is in km/s, but
73** the pv-vector result is in AU and AU/day.
74**
75** 4) The proper motions are the rate of change of the right ascension
76** and declination at the catalog epoch and are in radians per Julian
77** year. The RA proper motion is in terms of coordinate angle, not
78** true angle, and will thus be numerically larger at high
79** declinations.
80**
81** 5) Straight-line motion at constant speed in the inertial frame is
82** assumed. If the speed is greater than or equal to the speed of
83** light, the function aborts with an error status.
84**
85** 6) The inverse transformation is performed by the function iauStarpv.
86**
87** Called:
88** iauPn decompose p-vector into modulus and direction
89** iauPdp scalar product of two p-vectors
90** iauSxp multiply p-vector by scalar
91** iauPmp p-vector minus p-vector
92** iauPm modulus of p-vector
93** iauPpp p-vector plus p-vector
94** iauPv2s pv-vector to spherical
95** iauAnp normalize angle into range 0 to 2pi
96**
97** Reference:
98**
99** Stumpff, P., 1985, Astron.Astrophys. 144, 232-240.
100**
101** This revision: 2013 June 18
102**
103** SOFA release 2015-02-09
104**
105** Copyright (C) 2015 IAU SOFA Board. See notes at end.
106*/
107{
108 double r, x[3], vr, ur[3], vt, ut[3], bett, betr, d, w, del,
109 usr[3], ust[3], a, rad, decd, rd;
110
111/* Isolate the radial component of the velocity (AU/day, inertial). */
112 iauPn(pv[0], &r, x);
113 vr = iauPdp(x, pv[1]);
114 iauSxp(vr, x, ur);
115
116/* Isolate the transverse component of the velocity (AU/day, inertial). */
117 iauPmp(pv[1], ur, ut);
118 vt = iauPm(ut);
119
120/* Special-relativity dimensionless parameters. */
121 bett = vt / DC;
122 betr = vr / DC;
123
124/* The inertial-to-observed correction terms. */
125 d = 1.0 + betr;
126 w = 1.0 - betr*betr - bett*bett;
127 if (d == 0.0 || w < 0) return -1;
128 del = sqrt(w) - 1.0;
129
130/* Apply relativistic correction factor to radial velocity component. */
131 w = (betr != 0) ? (betr - del) / (betr * d) : 1.0;
132 iauSxp(w, ur, usr);
133
134/* Apply relativistic correction factor to tangential velocity */
135/* component. */
136 iauSxp(1.0/d, ut, ust);
137
138/* Combine the two to obtain the observed velocity vector (AU/day). */
139 iauPpp(usr, ust, pv[1]);
140
141/* Cartesian to spherical. */
142 iauPv2s(pv, &a, dec, &r, &rad, &decd, &rd);
143 if (r == 0.0) return -2;
144
145/* Return RA in range 0 to 2pi. */
146 *ra = iauAnp(a);
147
148/* Return proper motions in radians per year. */
149 *pmr = rad * DJY;
150 *pmd = decd * DJY;
151
152/* Return parallax in arcsec. */
153 *px = DR2AS / r;
154
155/* Return radial velocity in km/s. */
156 *rv = 1e-3 * rd * DAU / DAYSEC;
157
158/* OK status. */
159 return 0;
160
161/*----------------------------------------------------------------------
162**
163** Copyright (C) 2015
164** Standards Of Fundamental Astronomy Board
165** of the International Astronomical Union.
166**
167** =====================
168** SOFA Software License
169** =====================
170**
171** NOTICE TO USER:
172**
173** BY USING THIS SOFTWARE YOU ACCEPT THE FOLLOWING SIX TERMS AND
174** CONDITIONS WHICH APPLY TO ITS USE.
175**
176** 1. The Software is owned by the IAU SOFA Board ("SOFA").
177**
178** 2. Permission is granted to anyone to use the SOFA software for any
179** purpose, including commercial applications, free of charge and
180** without payment of royalties, subject to the conditions and
181** restrictions listed below.
182**
183** 3. You (the user) may copy and distribute SOFA source code to others,
184** and use and adapt its code and algorithms in your own software,
185** on a world-wide, royalty-free basis. That portion of your
186** distribution that does not consist of intact and unchanged copies
187** of SOFA source code files is a "derived work" that must comply
188** with the following requirements:
189**
190** a) Your work shall be marked or carry a statement that it
191** (i) uses routines and computations derived by you from
192** software provided by SOFA under license to you; and
193** (ii) does not itself constitute software provided by and/or
194** endorsed by SOFA.
195**
196** b) The source code of your derived work must contain descriptions
197** of how the derived work is based upon, contains and/or differs
198** from the original SOFA software.
199**
200** c) The names of all routines in your derived work shall not
201** include the prefix "iau" or "sofa" or trivial modifications
202** thereof such as changes of case.
203**
204** d) The origin of the SOFA components of your derived work must
205** not be misrepresented; you must not claim that you wrote the
206** original software, nor file a patent application for SOFA
207** software or algorithms embedded in the SOFA software.
208**
209** e) These requirements must be reproduced intact in any source
210** distribution and shall apply to anyone to whom you have
211** granted a further right to modify the source code of your
212** derived work.
213**
214** Note that, as originally distributed, the SOFA software is
215** intended to be a definitive implementation of the IAU standards,
216** and consequently third-party modifications are discouraged. All
217** variations, no matter how minor, must be explicitly marked as
218** such, as explained above.
219**
220** 4. You shall not cause the SOFA software to be brought into
221** disrepute, either by misuse, or use for inappropriate tasks, or
222** by inappropriate modification.
223**
224** 5. The SOFA software is provided "as is" and SOFA makes no warranty
225** as to its use or performance. SOFA does not and cannot warrant
226** the performance or results which the user may obtain by using the
227** SOFA software. SOFA makes no warranties, express or implied, as
228** to non-infringement of third party rights, merchantability, or
229** fitness for any particular purpose. In no event will SOFA be
230** liable to the user for any consequential, incidental, or special
231** damages, including any lost profits or lost savings, even if a
232** SOFA representative has been advised of such damages, or for any
233** claim by any third party.
234**
235** 6. The provision of any version of the SOFA software under the terms
236** and conditions specified herein does not imply that future
237** versions will also be made available under the same terms and
238** conditions.
239*
240** In any published work or commercial product which uses the SOFA
241** software directly, acknowledgement (see www.iausofa.org) is
242** appreciated.
243**
244** Correspondence concerning SOFA software should be addressed as
245** follows:
246**
247** By email: sofa@ukho.gov.uk
248** By post: IAU SOFA Center
249** HM Nautical Almanac Office
250** UK Hydrographic Office
251** Admiralty Way, Taunton
252** Somerset, TA1 2DN
253** United Kingdom
254**
255**--------------------------------------------------------------------*/
256}
Note: See TracBrowser for help on using the repository browser.