File Coverage

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


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