File Coverage

erfasrc/src/fk524.c
Criterion Covered Total %
statement 0 40 0.0
branch 0 10 0.0
condition n/a
subroutine n/a
pod n/a
total 0 50 0.0


line stmt bran cond sub pod time code
1             #include "erfa.h"
2              
3 0           void eraFk524(double r2000, double d2000,
4             double dr2000, double dd2000,
5             double p2000, double v2000,
6             double *r1950, double *d1950,
7             double *dr1950, double *dd1950,
8             double *p1950, double *v1950)
9             /*
10             ** - - - - - - - - -
11             ** e r a F k 5 2 4
12             ** - - - - - - - - -
13             **
14             ** Convert J2000.0 FK5 star catalog data to B1950.0 FK4.
15             **
16             ** Given: (all J2000.0, FK5)
17             ** r2000,d2000 double J2000.0 RA,Dec (rad)
18             ** dr2000,dd2000 double J2000.0 proper motions (rad/Jul.yr)
19             ** p2000 double parallax (arcsec)
20             ** v2000 double radial velocity (km/s, +ve = moving away)
21             **
22             ** Returned: (all B1950.0, FK4)
23             ** r1950,d1950 double B1950.0 RA,Dec (rad)
24             ** dr1950,dd1950 double B1950.0 proper motions (rad/trop.yr)
25             ** p1950 double parallax (arcsec)
26             ** v1950 double radial velocity (km/s, +ve = moving away)
27             **
28             ** Notes:
29             **
30             ** 1) The proper motions in RA are dRA/dt rather than cos(Dec)*dRA/dt,
31             ** and are per year rather than per century.
32             **
33             ** 2) The conversion is somewhat complicated, for several reasons:
34             **
35             ** . Change of standard epoch from J2000.0 to B1950.0.
36             **
37             ** . An intermediate transition date of 1984 January 1.0 TT.
38             **
39             ** . A change of precession model.
40             **
41             ** . Change of time unit for proper motion (Julian to tropical).
42             **
43             ** . FK4 positions include the E-terms of aberration, to simplify
44             ** the hand computation of annual aberration. FK5 positions
45             ** assume a rigorous aberration computation based on the Earth's
46             ** barycentric velocity.
47             **
48             ** . The E-terms also affect proper motions, and in particular cause
49             ** objects at large distances to exhibit fictitious proper
50             ** motions.
51             **
52             ** The algorithm is based on Smith et al. (1989) and Yallop et al.
53             ** (1989), which presented a matrix method due to Standish (1982) as
54             ** developed by Aoki et al. (1983), using Kinoshita's development of
55             ** Andoyer's post-Newcomb precession. The numerical constants from
56             ** Seidelmann (1992) are used canonically.
57             **
58             ** 4) In the FK4 catalog the proper motions of stars within 10 degrees
59             ** of the poles do not embody differential E-terms effects and
60             ** should, strictly speaking, be handled in a different manner from
61             ** stars outside these regions. However, given the general lack of
62             ** homogeneity of the star data available for routine astrometry,
63             ** the difficulties of handling positions that may have been
64             ** determined from astrometric fields spanning the polar and non-
65             ** polar regions, the likelihood that the differential E-terms
66             ** effect was not taken into account when allowing for proper motion
67             ** in past astrometry, and the undesirability of a discontinuity in
68             ** the algorithm, the decision has been made in this ERFA algorithm
69             ** to include the effects of differential E-terms on the proper
70             ** motions for all stars, whether polar or not. At epoch J2000.0,
71             ** and measuring "on the sky" rather than in terms of RA change, the
72             ** errors resulting from this simplification are less than
73             ** 1 milliarcsecond in position and 1 milliarcsecond per century in
74             ** proper motion.
75             **
76             ** Called:
77             ** eraAnp normalize angle into range 0 to 2pi
78             ** eraPdp scalar product of two p-vectors
79             ** eraPm modulus of p-vector
80             ** eraPmp p-vector minus p-vector
81             ** eraPpp p-vector pluus p-vector
82             ** eraPv2s pv-vector to spherical coordinates
83             ** eraS2pv spherical coordinates to pv-vector
84             ** eraSxp multiply p-vector by scalar
85             **
86             ** References:
87             **
88             ** Aoki, S. et al., 1983, "Conversion matrix of epoch B1950.0
89             ** FK4-based positions of stars to epoch J2000.0 positions in
90             ** accordance with the new IAU resolutions". Astron.Astrophys.
91             ** 128, 263-267.
92             **
93             ** Seidelmann, P.K. (ed), 1992, "Explanatory Supplement to the
94             ** Astronomical Almanac", ISBN 0-935702-68-7.
95             **
96             ** Smith, C.A. et al., 1989, "The transformation of astrometric
97             ** catalog systems to the equinox J2000.0". Astron.J. 97, 265.
98             **
99             ** Standish, E.M., 1982, "Conversion of positions and proper motions
100             ** from B1950.0 to the IAU system at J2000.0". Astron.Astrophys.,
101             ** 115, 1, 20-22.
102             **
103             ** Yallop, B.D. et al., 1989, "Transformation of mean star places
104             ** from FK4 B1950.0 to FK5 J2000.0 using matrices in 6-space".
105             ** Astron.J. 97, 274.
106             **
107             ** Copyright (C) 2013-2020, NumFOCUS Foundation.
108             ** Derived, with permission, from the SOFA library. See notes at end of file.
109             */
110             {
111             /* Radians per year to arcsec per century */
112             const double PMF = 100.0*ERFA_DR2AS;
113              
114             /* Small number to avoid arithmetic problems */
115             const double TINY = 1e-30;
116              
117             /* Miscellaneous */
118             double r, d, ur, ud, px, rv, pxvf, w, rd;
119             int i, j, k, l;
120              
121             /* Vectors, p and pv */
122             double r0[2][3], r1[2][3], p1[3], p2[3], pv[2][3];
123              
124             /*
125             ** CANONICAL CONSTANTS (Seidelmann 1992)
126             */
127              
128             /* Km per sec to AU per tropical century */
129             /* = 86400 * 36524.2198782 / 149597870.7 */
130             const double VF = 21.095;
131              
132             /* Constant pv-vector (cf. Seidelmann 3.591-2, vectors A and Adot) */
133             static double a[2][3] = {
134             { -1.62557e-6, -0.31919e-6, -0.13843e-6 },
135             { +1.245e-3, -1.580e-3, -0.659e-3 }
136             };
137              
138             /* 3x2 matrix of pv-vectors (cf. Seidelmann 3.592-1, matrix M^-1) */
139             static double em[2][3][2][3] = {
140              
141             { { { +0.9999256795, +0.0111814828, +0.0048590039, },
142             { -0.00000242389840, -0.00000002710544, -0.00000001177742 } },
143              
144             { { -0.0111814828, +0.9999374849, -0.0000271771, },
145             { +0.00000002710544, -0.00000242392702, +0.00000000006585 } },
146              
147             { { -0.0048590040, -0.0000271557, +0.9999881946, },
148             { +0.00000001177742, +0.00000000006585, -0.00000242404995 } } },
149              
150             { { { -0.000551, +0.238509, -0.435614, },
151             { +0.99990432, +0.01118145, +0.00485852 } },
152              
153             { { -0.238560, -0.002667, +0.012254, },
154             { -0.01118145, +0.99991613, -0.00002717 } },
155              
156             { { +0.435730, -0.008541, +0.002117, },
157             { -0.00485852, -0.00002716, +0.99996684 } } }
158              
159             };
160              
161             /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
162              
163             /* The FK5 data (units radians and arcsec per Julian century). */
164 0           r = r2000;
165 0           d = d2000;
166 0           ur = dr2000*PMF;
167 0           ud = dd2000*PMF;
168             px = p2000;
169             rv = v2000;
170              
171             /* Express as a pv-vector. */
172 0           pxvf = px * VF;
173 0           w = rv * pxvf;
174 0           eraS2pv(r, d, 1.0, ur, ud, w, r0);
175              
176             /* Convert pv-vector to Bessel-Newcomb system (cf. Seidelmann 3.592-1). */
177 0 0         for ( i = 0; i < 2; i++ ) {
178 0 0         for ( j = 0; j < 3; j++ ) {
179 0           w = 0.0;
180 0 0         for ( k = 0; k < 2; k++ ) {
181 0 0         for ( l = 0; l < 3; l++ ) {
182 0           w += em[i][j][k][l] * r0[k][l];
183             }
184             }
185 0           r1[i][j] = w;
186             }
187             }
188              
189             /* Apply E-terms (equivalent to Seidelmann 3.592-3, one iteration). */
190              
191             /* Direction. */
192 0           w = eraPm(r1[0]);
193 0           eraSxp(eraPdp(r1[0],a[0]), r1[0], p1);
194 0           eraSxp(w, a[0], p2);
195 0           eraPmp(p2, p1, p1);
196 0           eraPpp(r1[0], p1, p1);
197              
198             /* Recompute length. */
199 0           w = eraPm(p1);
200              
201             /* Direction. */
202 0           eraSxp(eraPdp(r1[0],a[0]), r1[0], p1);
203 0           eraSxp(w, a[0], p2);
204 0           eraPmp(p2, p1, p1);
205 0           eraPpp(r1[0], p1, pv[0]);
206              
207             /* Derivative. */
208 0           eraSxp(eraPdp(r1[0],a[1]), pv[0], p1);
209 0           eraSxp(w, a[1], p2);
210 0           eraPmp(p2, p1, p1);
211 0           eraPpp(r1[1], p1, pv[1]);
212              
213             /* Revert to catalog form. */
214 0           eraPv2s(pv, &r, &d, &w, &ur, &ud, &rd);
215 0 0         if ( px > TINY ) {
216 0           rv = rd/pxvf;
217 0           px = px/w;
218             }
219              
220             /* Return the results. */
221 0           *r1950 = eraAnp(r);
222 0           *d1950 = d;
223 0           *dr1950 = ur/PMF;
224 0           *dd1950 = ud/PMF;
225 0           *p1950 = px;
226 0           *v1950 = rv;
227              
228             /* Finished. */
229              
230 0           }
231             /*----------------------------------------------------------------------
232             **
233             **
234             ** Copyright (C) 2013-2020, NumFOCUS Foundation.
235             ** All rights reserved.
236             **
237             ** This library is derived, with permission, from the International
238             ** Astronomical Union's "Standards of Fundamental Astronomy" library,
239             ** available from http://www.iausofa.org.
240             **
241             ** The ERFA version is intended to retain identical functionality to
242             ** the SOFA library, but made distinct through different function and
243             ** file names, as set out in the SOFA license conditions. The SOFA
244             ** original has a role as a reference standard for the IAU and IERS,
245             ** and consequently redistribution is permitted only in its unaltered
246             ** state. The ERFA version is not subject to this restriction and
247             ** therefore can be included in distributions which do not support the
248             ** concept of "read only" software.
249             **
250             ** Although the intent is to replicate the SOFA API (other than
251             ** replacement of prefix names) and results (with the exception of
252             ** bugs; any that are discovered will be fixed), SOFA is not
253             ** responsible for any errors found in this version of the library.
254             **
255             ** If you wish to acknowledge the SOFA heritage, please acknowledge
256             ** that you are using a library derived from SOFA, rather than SOFA
257             ** itself.
258             **
259             **
260             ** TERMS AND CONDITIONS
261             **
262             ** Redistribution and use in source and binary forms, with or without
263             ** modification, are permitted provided that the following conditions
264             ** are met:
265             **
266             ** 1 Redistributions of source code must retain the above copyright
267             ** notice, this list of conditions and the following disclaimer.
268             **
269             ** 2 Redistributions in binary form must reproduce the above copyright
270             ** notice, this list of conditions and the following disclaimer in
271             ** the documentation and/or other materials provided with the
272             ** distribution.
273             **
274             ** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
275             ** the International Astronomical Union nor the names of its
276             ** contributors may be used to endorse or promote products derived
277             ** from this software without specific prior written permission.
278             **
279             ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
280             ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
281             ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
282             ** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
283             ** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
284             ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
285             ** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
286             ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
287             ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
288             ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
289             ** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
290             ** POSSIBILITY OF SUCH DAMAGE.
291             **
292             */