File Coverage

erfasrc/src/fk45z.c
Criterion Covered Total %
statement 0 18 0.0
branch 0 6 0.0
condition n/a
subroutine n/a
pod n/a
total 0 24 0.0


line stmt bran cond sub pod time code
1             #include "erfa.h"
2              
3 0           void eraFk45z(double r1950, double d1950, double bepoch,
4             double *r2000, double *d2000)
5             /*
6             ** - - - - - - - - -
7             ** e r a F k 4 5 z
8             ** - - - - - - - - -
9             **
10             ** Convert a B1950.0 FK4 star position to J2000.0 FK5, assuming zero
11             ** proper motion in the FK5 system.
12             **
13             ** This function converts a star's catalog data from the old FK4
14             ** (Bessel-Newcomb) system to the later IAU 1976 FK5 (Fricke) system,
15             ** in such a way that the FK5 proper motion is zero. Because such a
16             ** star has, in general, a non-zero proper motion in the FK4 system,
17             ** the routine requires the epoch at which the position in the FK4
18             ** system was determined.
19             **
20             ** Given:
21             ** r1950,d1950 double B1950.0 FK4 RA,Dec at epoch (rad)
22             ** bepoch double Besselian epoch (e.g. 1979.3D0)
23             **
24             ** Returned:
25             ** r2000,d2000 double J2000.0 FK5 RA,Dec (rad)
26             **
27             ** Notes:
28             **
29             ** 1) The epoch bepoch is strictly speaking Besselian, but if a
30             ** Julian epoch is supplied the result will be affected only to a
31             ** negligible extent.
32             **
33             ** 2) The method is from Appendix 2 of Aoki et al. (1983), but using
34             ** the constants of Seidelmann (1992). See the routine eraFk425
35             ** for a general introduction to the FK4 to FK5 conversion.
36             **
37             ** 3) Conversion from equinox B1950.0 FK4 to equinox J2000.0 FK5 only
38             ** is provided for. Conversions for different starting and/or
39             ** ending epochs would require additional treatment for precession,
40             ** proper motion and E-terms.
41             **
42             ** 4) In the FK4 catalog the proper motions of stars within 10 degrees
43             ** of the poles do not embody differential E-terms effects and
44             ** should, strictly speaking, be handled in a different manner from
45             ** stars outside these regions. However, given the general lack of
46             ** homogeneity of the star data available for routine astrometry,
47             ** the difficulties of handling positions that may have been
48             ** determined from astrometric fields spanning the polar and non-
49             ** polar regions, the likelihood that the differential E-terms
50             ** effect was not taken into account when allowing for proper motion
51             ** in past astrometry, and the undesirability of a discontinuity in
52             ** the algorithm, the decision has been made in this ERFA algorithm
53             ** to include the effects of differential E-terms on the proper
54             ** motions for all stars, whether polar or not. At epoch 2000.0,
55             ** and measuring "on the sky" rather than in terms of RA change, the
56             ** errors resulting from this simplification are less than
57             ** 1 milliarcsecond in position and 1 milliarcsecond per century in
58             ** proper motion.
59             **
60             ** References:
61             **
62             ** Aoki, S. et al., 1983, "Conversion matrix of epoch B1950.0
63             ** FK4-based positions of stars to epoch J2000.0 positions in
64             ** accordance with the new IAU resolutions". Astron.Astrophys.
65             ** 128, 263-267.
66             **
67             ** Seidelmann, P.K. (ed), 1992, "Explanatory Supplement to the
68             ** Astronomical Almanac", ISBN 0-935702-68-7.
69             **
70             ** Called:
71             ** eraAnp normalize angle into range 0 to 2pi
72             ** eraC2s p-vector to spherical
73             ** eraEpb2jd Besselian epoch to Julian date
74             ** eraEpj Julian date to Julian epoch
75             ** eraPdp scalar product of two p-vectors
76             ** eraPmp p-vector minus p-vector
77             ** eraPpsp p-vector plus scaled p-vector
78             ** eraPvu update a pv-vector
79             ** eraS2c spherical to p-vector
80             **
81             ** Copyright (C) 2013-2020, NumFOCUS Foundation.
82             ** Derived, with permission, from the SOFA library. See notes at end of file.
83             */
84             {
85             /* Radians per year to arcsec per century */
86             const double PMF = 100.0*ERFA_DR2AS;
87              
88             /* Position and position+velocity vectors */
89             double r0[3], p[3], pv[2][3];
90              
91             /* Miscellaneous */
92             double w, djm0, djm;
93             int i, j, k;
94              
95             /*
96             ** CANONICAL CONSTANTS (Seidelmann 1992)
97             */
98              
99             /* Vectors A and Adot (Seidelmann 3.591-2) */
100             static double a[3] = { -1.62557e-6, -0.31919e-6, -0.13843e-6 };
101             static double ad[3] = { +1.245e-3, -1.580e-3, -0.659e-3 };
102              
103             /* 3x2 matrix of p-vectors (cf. Seidelmann 3.591-4, matrix M) */
104             static double em[2][3][3] = {
105             { { +0.9999256782, -0.0111820611, -0.0048579477 },
106             { +0.0111820610, +0.9999374784, -0.0000271765 },
107             { +0.0048579479, -0.0000271474, +0.9999881997 } },
108             { { -0.000551, -0.238565, +0.435739 },
109             { +0.238514, -0.002667, -0.008541 },
110             { -0.435623, +0.012254, +0.002117 } }
111             };
112              
113             /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
114              
115             /* Spherical coordinates to p-vector. */
116 0           eraS2c(r1950, d1950, r0);
117              
118             /* Adjust p-vector A to give zero proper motion in FK5. */
119 0           w = (bepoch - 1950) / PMF;
120 0           eraPpsp(a, w, ad, p);
121              
122             /* Remove E-terms. */
123 0           eraPpsp(p, -eraPdp(r0,p), r0, p);
124 0           eraPmp(r0, p, p);
125              
126             /* Convert to Fricke system pv-vector (cf. Seidelmann 3.591-3). */
127 0 0         for ( i = 0; i < 2; i++ ) {
128 0 0         for ( j = 0; j < 3; j++ ) {
129 0           w = 0.0;
130 0 0         for ( k = 0; k < 3; k++ ) {
131 0           w += em[i][j][k] * p[k];
132             }
133 0           pv[i][j] = w;
134             }
135             }
136              
137             /* Allow for fictitious proper motion. */
138 0           eraEpb2jd(bepoch, &djm0, &djm);
139 0           w = (eraEpj(djm0,djm)-2000.0) / PMF;
140 0           eraPvu(w, pv, pv);
141              
142             /* Revert to spherical coordinates. */
143 0           eraC2s(pv[0], &w, d2000);
144 0           *r2000 = eraAnp(w);
145              
146             /* Finished. */
147              
148 0           }
149             /*----------------------------------------------------------------------
150             **
151             **
152             ** Copyright (C) 2013-2020, NumFOCUS Foundation.
153             ** All rights reserved.
154             **
155             ** This library is derived, with permission, from the International
156             ** Astronomical Union's "Standards of Fundamental Astronomy" library,
157             ** available from http://www.iausofa.org.
158             **
159             ** The ERFA version is intended to retain identical functionality to
160             ** the SOFA library, but made distinct through different function and
161             ** file names, as set out in the SOFA license conditions. The SOFA
162             ** original has a role as a reference standard for the IAU and IERS,
163             ** and consequently redistribution is permitted only in its unaltered
164             ** state. The ERFA version is not subject to this restriction and
165             ** therefore can be included in distributions which do not support the
166             ** concept of "read only" software.
167             **
168             ** Although the intent is to replicate the SOFA API (other than
169             ** replacement of prefix names) and results (with the exception of
170             ** bugs; any that are discovered will be fixed), SOFA is not
171             ** responsible for any errors found in this version of the library.
172             **
173             ** If you wish to acknowledge the SOFA heritage, please acknowledge
174             ** that you are using a library derived from SOFA, rather than SOFA
175             ** itself.
176             **
177             **
178             ** TERMS AND CONDITIONS
179             **
180             ** Redistribution and use in source and binary forms, with or without
181             ** modification, are permitted provided that the following conditions
182             ** are met:
183             **
184             ** 1 Redistributions of source code must retain the above copyright
185             ** notice, this list of conditions and the following disclaimer.
186             **
187             ** 2 Redistributions in binary form must reproduce the above copyright
188             ** notice, this list of conditions and the following disclaimer in
189             ** the documentation and/or other materials provided with the
190             ** distribution.
191             **
192             ** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
193             ** the International Astronomical Union nor the names of its
194             ** contributors may be used to endorse or promote products derived
195             ** from this software without specific prior written permission.
196             **
197             ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
198             ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
199             ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
200             ** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
201             ** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
202             ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
203             ** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
204             ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
205             ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
206             ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
207             ** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
208             ** POSSIBILITY OF SUCH DAMAGE.
209             **
210             */