line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#include "erfa.h" |
2
|
|
|
|
|
|
|
|
3
|
0
|
|
|
|
|
|
void eraAticqn(double ri, double di, eraASTROM *astrom, |
4
|
|
|
|
|
|
|
int n, eraLDBODY b[], double *rc, double *dc) |
5
|
|
|
|
|
|
|
/* |
6
|
|
|
|
|
|
|
** - - - - - - - - - |
7
|
|
|
|
|
|
|
** e r a A t i c q n |
8
|
|
|
|
|
|
|
** - - - - - - - - - |
9
|
|
|
|
|
|
|
** |
10
|
|
|
|
|
|
|
** Quick CIRS to ICRS astrometric place transformation, given the star- |
11
|
|
|
|
|
|
|
** independent astrometry parameters plus a list of light-deflecting |
12
|
|
|
|
|
|
|
** bodies. |
13
|
|
|
|
|
|
|
** |
14
|
|
|
|
|
|
|
** Use of this function is appropriate when efficiency is important and |
15
|
|
|
|
|
|
|
** where many star positions are all to be transformed for one date. |
16
|
|
|
|
|
|
|
** The star-independent astrometry parameters can be obtained by |
17
|
|
|
|
|
|
|
** calling one of the functions eraApci[13], eraApcg[13], eraApco[13] |
18
|
|
|
|
|
|
|
** or eraApcs[13]. |
19
|
|
|
|
|
|
|
* |
20
|
|
|
|
|
|
|
* If the only light-deflecting body to be taken into account is the |
21
|
|
|
|
|
|
|
* Sun, the eraAticq function can be used instead. |
22
|
|
|
|
|
|
|
** |
23
|
|
|
|
|
|
|
** Given: |
24
|
|
|
|
|
|
|
** ri,di double CIRS RA,Dec (radians) |
25
|
|
|
|
|
|
|
** astrom eraASTROM* star-independent astrometry parameters: |
26
|
|
|
|
|
|
|
** pmt double PM time interval (SSB, Julian years) |
27
|
|
|
|
|
|
|
** eb double[3] SSB to observer (vector, au) |
28
|
|
|
|
|
|
|
** eh double[3] Sun to observer (unit vector) |
29
|
|
|
|
|
|
|
** em double distance from Sun to observer (au) |
30
|
|
|
|
|
|
|
** v double[3] barycentric observer velocity (vector, c) |
31
|
|
|
|
|
|
|
** bm1 double sqrt(1-|v|^2): reciprocal of Lorenz factor |
32
|
|
|
|
|
|
|
** bpn double[3][3] bias-precession-nutation matrix |
33
|
|
|
|
|
|
|
** along double longitude + s' (radians) |
34
|
|
|
|
|
|
|
** xpl double polar motion xp wrt local meridian (radians) |
35
|
|
|
|
|
|
|
** ypl double polar motion yp wrt local meridian (radians) |
36
|
|
|
|
|
|
|
** sphi double sine of geodetic latitude |
37
|
|
|
|
|
|
|
** cphi double cosine of geodetic latitude |
38
|
|
|
|
|
|
|
** diurab double magnitude of diurnal aberration vector |
39
|
|
|
|
|
|
|
** eral double "local" Earth rotation angle (radians) |
40
|
|
|
|
|
|
|
** refa double refraction constant A (radians) |
41
|
|
|
|
|
|
|
** refb double refraction constant B (radians) |
42
|
|
|
|
|
|
|
** n int number of bodies (Note 3) |
43
|
|
|
|
|
|
|
** b eraLDBODY[n] data for each of the n bodies (Notes 3,4): |
44
|
|
|
|
|
|
|
** bm double mass of the body (solar masses, Note 5) |
45
|
|
|
|
|
|
|
** dl double deflection limiter (Note 6) |
46
|
|
|
|
|
|
|
** pv [2][3] barycentric PV of the body (au, au/day) |
47
|
|
|
|
|
|
|
** |
48
|
|
|
|
|
|
|
** Returned: |
49
|
|
|
|
|
|
|
** rc,dc double ICRS astrometric RA,Dec (radians) |
50
|
|
|
|
|
|
|
** |
51
|
|
|
|
|
|
|
** Notes: |
52
|
|
|
|
|
|
|
** |
53
|
|
|
|
|
|
|
** 1) Iterative techniques are used for the aberration and light |
54
|
|
|
|
|
|
|
** deflection corrections so that the functions eraAticqn and |
55
|
|
|
|
|
|
|
** eraAtciqn are accurate inverses; even at the edge of the Sun's |
56
|
|
|
|
|
|
|
** disk the discrepancy is only about 1 nanoarcsecond. |
57
|
|
|
|
|
|
|
** |
58
|
|
|
|
|
|
|
** 2) If the only light-deflecting body to be taken into account is the |
59
|
|
|
|
|
|
|
** Sun, the eraAticq function can be used instead. |
60
|
|
|
|
|
|
|
** |
61
|
|
|
|
|
|
|
** 3) The struct b contains n entries, one for each body to be |
62
|
|
|
|
|
|
|
** considered. If n = 0, no gravitational light deflection will be |
63
|
|
|
|
|
|
|
** applied, not even for the Sun. |
64
|
|
|
|
|
|
|
** |
65
|
|
|
|
|
|
|
** 4) The struct b should include an entry for the Sun as well as for |
66
|
|
|
|
|
|
|
** any planet or other body to be taken into account. The entries |
67
|
|
|
|
|
|
|
** should be in the order in which the light passes the body. |
68
|
|
|
|
|
|
|
** |
69
|
|
|
|
|
|
|
** 5) In the entry in the b struct for body i, the mass parameter |
70
|
|
|
|
|
|
|
** b[i].bm can, as required, be adjusted in order to allow for such |
71
|
|
|
|
|
|
|
** effects as quadrupole field. |
72
|
|
|
|
|
|
|
** |
73
|
|
|
|
|
|
|
** 6) The deflection limiter parameter b[i].dl is phi^2/2, where phi is |
74
|
|
|
|
|
|
|
** the angular separation (in radians) between star and body at |
75
|
|
|
|
|
|
|
** which limiting is applied. As phi shrinks below the chosen |
76
|
|
|
|
|
|
|
** threshold, the deflection is artificially reduced, reaching zero |
77
|
|
|
|
|
|
|
** for phi = 0. Example values suitable for a terrestrial |
78
|
|
|
|
|
|
|
** observer, together with masses, are as follows: |
79
|
|
|
|
|
|
|
** |
80
|
|
|
|
|
|
|
** body i b[i].bm b[i].dl |
81
|
|
|
|
|
|
|
** |
82
|
|
|
|
|
|
|
** Sun 1.0 6e-6 |
83
|
|
|
|
|
|
|
** Jupiter 0.00095435 3e-9 |
84
|
|
|
|
|
|
|
** Saturn 0.00028574 3e-10 |
85
|
|
|
|
|
|
|
** |
86
|
|
|
|
|
|
|
** 7) For efficiency, validation of the contents of the b array is |
87
|
|
|
|
|
|
|
** omitted. The supplied masses must be greater than zero, the |
88
|
|
|
|
|
|
|
** position and velocity vectors must be right, and the deflection |
89
|
|
|
|
|
|
|
** limiter greater than zero. |
90
|
|
|
|
|
|
|
** |
91
|
|
|
|
|
|
|
** Called: |
92
|
|
|
|
|
|
|
** eraS2c spherical coordinates to unit vector |
93
|
|
|
|
|
|
|
** eraTrxp product of transpose of r-matrix and p-vector |
94
|
|
|
|
|
|
|
** eraZp zero p-vector |
95
|
|
|
|
|
|
|
** eraAb stellar aberration |
96
|
|
|
|
|
|
|
** eraLdn light deflection by n bodies |
97
|
|
|
|
|
|
|
** eraC2s p-vector to spherical |
98
|
|
|
|
|
|
|
** eraAnp normalize angle into range +/- pi |
99
|
|
|
|
|
|
|
** |
100
|
|
|
|
|
|
|
** Copyright (C) 2013-2019, NumFOCUS Foundation. |
101
|
|
|
|
|
|
|
** Derived, with permission, from the SOFA library. See notes at end of file. |
102
|
|
|
|
|
|
|
*/ |
103
|
|
|
|
|
|
|
{ |
104
|
|
|
|
|
|
|
int j, i; |
105
|
|
|
|
|
|
|
double pi[3], ppr[3], pnat[3], pco[3], w, d[3], before[3], r2, r, |
106
|
|
|
|
|
|
|
after[3]; |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
/* CIRS RA,Dec to Cartesian. */ |
110
|
0
|
|
|
|
|
|
eraS2c(ri, di, pi); |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
/* Bias-precession-nutation, giving GCRS proper direction. */ |
113
|
0
|
|
|
|
|
|
eraTrxp(astrom->bpn, pi, ppr); |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
/* Aberration, giving GCRS natural direction. */ |
116
|
0
|
|
|
|
|
|
eraZp(d); |
117
|
0
|
0
|
|
|
|
|
for (j = 0; j < 2; j++) { |
118
|
|
|
|
|
|
|
r2 = 0.0; |
119
|
0
|
0
|
|
|
|
|
for (i = 0; i < 3; i++) { |
120
|
0
|
|
|
|
|
|
w = ppr[i] - d[i]; |
121
|
0
|
|
|
|
|
|
before[i] = w; |
122
|
0
|
|
|
|
|
|
r2 += w*w; |
123
|
|
|
|
|
|
|
} |
124
|
0
|
|
|
|
|
|
r = sqrt(r2); |
125
|
0
|
0
|
|
|
|
|
for (i = 0; i < 3; i++) { |
126
|
0
|
|
|
|
|
|
before[i] /= r; |
127
|
|
|
|
|
|
|
} |
128
|
0
|
|
|
|
|
|
eraAb(before, astrom->v, astrom->em, astrom->bm1, after); |
129
|
|
|
|
|
|
|
r2 = 0.0; |
130
|
0
|
0
|
|
|
|
|
for (i = 0; i < 3; i++) { |
131
|
0
|
|
|
|
|
|
d[i] = after[i] - before[i]; |
132
|
0
|
|
|
|
|
|
w = ppr[i] - d[i]; |
133
|
0
|
|
|
|
|
|
pnat[i] = w; |
134
|
0
|
|
|
|
|
|
r2 += w*w; |
135
|
|
|
|
|
|
|
} |
136
|
0
|
|
|
|
|
|
r = sqrt(r2); |
137
|
0
|
0
|
|
|
|
|
for (i = 0; i < 3; i++) { |
138
|
0
|
|
|
|
|
|
pnat[i] /= r; |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
/* Light deflection, giving BCRS coordinate direction. */ |
143
|
0
|
|
|
|
|
|
eraZp(d); |
144
|
0
|
0
|
|
|
|
|
for (j = 0; j < 5; j++) { |
145
|
|
|
|
|
|
|
r2 = 0.0; |
146
|
0
|
0
|
|
|
|
|
for (i = 0; i < 3; i++) { |
147
|
0
|
|
|
|
|
|
w = pnat[i] - d[i]; |
148
|
0
|
|
|
|
|
|
before[i] = w; |
149
|
0
|
|
|
|
|
|
r2 += w*w; |
150
|
|
|
|
|
|
|
} |
151
|
0
|
|
|
|
|
|
r = sqrt(r2); |
152
|
0
|
0
|
|
|
|
|
for (i = 0; i < 3; i++) { |
153
|
0
|
|
|
|
|
|
before[i] /= r; |
154
|
|
|
|
|
|
|
} |
155
|
0
|
|
|
|
|
|
eraLdn(n, b, astrom->eb, before, after); |
156
|
|
|
|
|
|
|
r2 = 0.0; |
157
|
0
|
0
|
|
|
|
|
for (i = 0; i < 3; i++) { |
158
|
0
|
|
|
|
|
|
d[i] = after[i] - before[i]; |
159
|
0
|
|
|
|
|
|
w = pnat[i] - d[i]; |
160
|
0
|
|
|
|
|
|
pco[i] = w; |
161
|
0
|
|
|
|
|
|
r2 += w*w; |
162
|
|
|
|
|
|
|
} |
163
|
0
|
|
|
|
|
|
r = sqrt(r2); |
164
|
0
|
0
|
|
|
|
|
for (i = 0; i < 3; i++) { |
165
|
0
|
|
|
|
|
|
pco[i] /= r; |
166
|
|
|
|
|
|
|
} |
167
|
|
|
|
|
|
|
} |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
/* ICRS astrometric RA,Dec. */ |
170
|
0
|
|
|
|
|
|
eraC2s(pco, &w, dc); |
171
|
0
|
|
|
|
|
|
*rc = eraAnp(w); |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
/* Finished. */ |
174
|
|
|
|
|
|
|
|
175
|
0
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
/*---------------------------------------------------------------------- |
177
|
|
|
|
|
|
|
** |
178
|
|
|
|
|
|
|
** |
179
|
|
|
|
|
|
|
** Copyright (C) 2013-2019, NumFOCUS Foundation. |
180
|
|
|
|
|
|
|
** All rights reserved. |
181
|
|
|
|
|
|
|
** |
182
|
|
|
|
|
|
|
** This library is derived, with permission, from the International |
183
|
|
|
|
|
|
|
** Astronomical Union's "Standards of Fundamental Astronomy" library, |
184
|
|
|
|
|
|
|
** available from http://www.iausofa.org. |
185
|
|
|
|
|
|
|
** |
186
|
|
|
|
|
|
|
** The ERFA version is intended to retain identical functionality to |
187
|
|
|
|
|
|
|
** the SOFA library, but made distinct through different function and |
188
|
|
|
|
|
|
|
** file names, as set out in the SOFA license conditions. The SOFA |
189
|
|
|
|
|
|
|
** original has a role as a reference standard for the IAU and IERS, |
190
|
|
|
|
|
|
|
** and consequently redistribution is permitted only in its unaltered |
191
|
|
|
|
|
|
|
** state. The ERFA version is not subject to this restriction and |
192
|
|
|
|
|
|
|
** therefore can be included in distributions which do not support the |
193
|
|
|
|
|
|
|
** concept of "read only" software. |
194
|
|
|
|
|
|
|
** |
195
|
|
|
|
|
|
|
** Although the intent is to replicate the SOFA API (other than |
196
|
|
|
|
|
|
|
** replacement of prefix names) and results (with the exception of |
197
|
|
|
|
|
|
|
** bugs; any that are discovered will be fixed), SOFA is not |
198
|
|
|
|
|
|
|
** responsible for any errors found in this version of the library. |
199
|
|
|
|
|
|
|
** |
200
|
|
|
|
|
|
|
** If you wish to acknowledge the SOFA heritage, please acknowledge |
201
|
|
|
|
|
|
|
** that you are using a library derived from SOFA, rather than SOFA |
202
|
|
|
|
|
|
|
** itself. |
203
|
|
|
|
|
|
|
** |
204
|
|
|
|
|
|
|
** |
205
|
|
|
|
|
|
|
** TERMS AND CONDITIONS |
206
|
|
|
|
|
|
|
** |
207
|
|
|
|
|
|
|
** Redistribution and use in source and binary forms, with or without |
208
|
|
|
|
|
|
|
** modification, are permitted provided that the following conditions |
209
|
|
|
|
|
|
|
** are met: |
210
|
|
|
|
|
|
|
** |
211
|
|
|
|
|
|
|
** 1 Redistributions of source code must retain the above copyright |
212
|
|
|
|
|
|
|
** notice, this list of conditions and the following disclaimer. |
213
|
|
|
|
|
|
|
** |
214
|
|
|
|
|
|
|
** 2 Redistributions in binary form must reproduce the above copyright |
215
|
|
|
|
|
|
|
** notice, this list of conditions and the following disclaimer in |
216
|
|
|
|
|
|
|
** the documentation and/or other materials provided with the |
217
|
|
|
|
|
|
|
** distribution. |
218
|
|
|
|
|
|
|
** |
219
|
|
|
|
|
|
|
** 3 Neither the name of the Standards Of Fundamental Astronomy Board, |
220
|
|
|
|
|
|
|
** the International Astronomical Union nor the names of its |
221
|
|
|
|
|
|
|
** contributors may be used to endorse or promote products derived |
222
|
|
|
|
|
|
|
** from this software without specific prior written permission. |
223
|
|
|
|
|
|
|
** |
224
|
|
|
|
|
|
|
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
225
|
|
|
|
|
|
|
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
226
|
|
|
|
|
|
|
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
227
|
|
|
|
|
|
|
** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
228
|
|
|
|
|
|
|
** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
229
|
|
|
|
|
|
|
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
230
|
|
|
|
|
|
|
** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
231
|
|
|
|
|
|
|
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
232
|
|
|
|
|
|
|
** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
233
|
|
|
|
|
|
|
** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
234
|
|
|
|
|
|
|
** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
235
|
|
|
|
|
|
|
** POSSIBILITY OF SUCH DAMAGE. |
236
|
|
|
|
|
|
|
** |
237
|
|
|
|
|
|
|
*/ |