line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
/* |
2
|
|
|
|
|
|
|
*+ |
3
|
|
|
|
|
|
|
* Name: |
4
|
|
|
|
|
|
|
* palMapqkz |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
* Purpose: |
7
|
|
|
|
|
|
|
* Quick mean to apparent place (no proper motion or parallax). |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
* Language: |
10
|
|
|
|
|
|
|
* Starlink ANSI C |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
* Type of Module: |
13
|
|
|
|
|
|
|
* Library routine |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
* Invocation: |
16
|
|
|
|
|
|
|
* void palMapqkz( double rm, double dm, double amprms[21], |
17
|
|
|
|
|
|
|
* double *ra, double *da ) |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
* Arguments: |
20
|
|
|
|
|
|
|
* rm = double (Given) |
21
|
|
|
|
|
|
|
* Mean RA (radians). |
22
|
|
|
|
|
|
|
* dm = double (Given) |
23
|
|
|
|
|
|
|
* Mean Dec (radians). |
24
|
|
|
|
|
|
|
* amprms = double[21] (Given) |
25
|
|
|
|
|
|
|
* Star-independent mean-to-apparent parameters (see palMappa): |
26
|
|
|
|
|
|
|
* (0-3) not used |
27
|
|
|
|
|
|
|
* (4-6) heliocentric direction of the Earth (unit vector) |
28
|
|
|
|
|
|
|
* (7) not used |
29
|
|
|
|
|
|
|
* (8-10) abv: barycentric Earth velocity in units of c |
30
|
|
|
|
|
|
|
* (11) sqrt(1-v^2) where v=modulus(abv) |
31
|
|
|
|
|
|
|
* (12-20) precession/nutation (3,3) matrix |
32
|
|
|
|
|
|
|
* ra = double * (Returned) |
33
|
|
|
|
|
|
|
* Apparent RA (radians). |
34
|
|
|
|
|
|
|
* da = double * (Returned) |
35
|
|
|
|
|
|
|
* Apparent Dec (radians). |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
* Description: |
38
|
|
|
|
|
|
|
* Quick mean to apparent place: transform a star RA,dec from |
39
|
|
|
|
|
|
|
* mean place to geocentric apparent place, given the |
40
|
|
|
|
|
|
|
* star-independent parameters, and assuming zero parallax |
41
|
|
|
|
|
|
|
* and proper motion. |
42
|
|
|
|
|
|
|
* |
43
|
|
|
|
|
|
|
* Use of this function is appropriate when efficiency is important |
44
|
|
|
|
|
|
|
* and where many star positions, all with parallax and proper |
45
|
|
|
|
|
|
|
* motion either zero or already allowed for, and all referred to |
46
|
|
|
|
|
|
|
* the same equator and equinox, are to be transformed for one |
47
|
|
|
|
|
|
|
* epoch. The star-independent parameters can be obtained by |
48
|
|
|
|
|
|
|
* calling the palMappa function. |
49
|
|
|
|
|
|
|
* |
50
|
|
|
|
|
|
|
* The corresponding function for the case of non-zero parallax |
51
|
|
|
|
|
|
|
* and proper motion is palMapqk. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
* Notes: |
54
|
|
|
|
|
|
|
* - The reference systems and timescales used are IAU 2006. |
55
|
|
|
|
|
|
|
* - The mean place rm, dm and the vectors amprms[1-3] and amprms[4-6] |
56
|
|
|
|
|
|
|
* are referred to the mean equinox and equator of the epoch |
57
|
|
|
|
|
|
|
* specified when generating the precession/nutation matrix |
58
|
|
|
|
|
|
|
* amprms[12-20]. In the call to palMappa (q.v.) normally used |
59
|
|
|
|
|
|
|
* to populate amprms, this epoch is the first argument (eq). |
60
|
|
|
|
|
|
|
* - The vector amprms(4-6) is referred to the mean equinox and |
61
|
|
|
|
|
|
|
* equator of epoch eq. |
62
|
|
|
|
|
|
|
* - Strictly speaking, the routine is not valid for solar-system |
63
|
|
|
|
|
|
|
* sources, though the error will usually be extremely small. |
64
|
|
|
|
|
|
|
* However, to prevent gross errors in the case where the |
65
|
|
|
|
|
|
|
* position of the Sun is specified, the gravitational |
66
|
|
|
|
|
|
|
* deflection term is restrained within about 920 arcsec of the |
67
|
|
|
|
|
|
|
* centre of the Sun's disc. The term has a maximum value of |
68
|
|
|
|
|
|
|
* about 1.85 arcsec at this radius, and decreases to zero as |
69
|
|
|
|
|
|
|
* the centre of the disc is approached. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
* Authors: |
72
|
|
|
|
|
|
|
* PTW: Pat Wallace (STFC) |
73
|
|
|
|
|
|
|
* {enter_new_authors_here} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
* History: |
76
|
|
|
|
|
|
|
* 2012-02-13 (PTW): |
77
|
|
|
|
|
|
|
* Initial version. |
78
|
|
|
|
|
|
|
* Adapted with permission from the Fortran SLALIB library. |
79
|
|
|
|
|
|
|
* {enter_further_changes_here} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
* Copyright: |
82
|
|
|
|
|
|
|
* Copyright (C) 1999 Rutherford Appleton Laboratory |
83
|
|
|
|
|
|
|
* Copyright (C) 2012 Science and Technology Facilities Council. |
84
|
|
|
|
|
|
|
* All Rights Reserved. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
* Licence: |
87
|
|
|
|
|
|
|
* This program is free software: you can redistribute it and/or |
88
|
|
|
|
|
|
|
* modify it under the terms of the GNU Lesser General Public |
89
|
|
|
|
|
|
|
* License as published by the Free Software Foundation, either |
90
|
|
|
|
|
|
|
* version 3 of the License, or (at your option) any later |
91
|
|
|
|
|
|
|
* version. |
92
|
|
|
|
|
|
|
* |
93
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful, |
94
|
|
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
95
|
|
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
96
|
|
|
|
|
|
|
* GNU Lesser General Public License for more details. |
97
|
|
|
|
|
|
|
* |
98
|
|
|
|
|
|
|
* You should have received a copy of the GNU Lesser General |
99
|
|
|
|
|
|
|
* License along with this program. If not, see |
100
|
|
|
|
|
|
|
* . |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
* Bugs: |
103
|
|
|
|
|
|
|
* {note_any_bugs_here} |
104
|
|
|
|
|
|
|
*- |
105
|
|
|
|
|
|
|
*/ |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
#include "pal.h" |
108
|
|
|
|
|
|
|
#include "pal1sofa.h" |
109
|
|
|
|
|
|
|
|
110
|
0
|
|
|
|
|
|
void palMapqkz ( double rm, double dm, double amprms[21], double *ra, |
111
|
|
|
|
|
|
|
double *da ){ |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
/* Local Variables: */ |
114
|
|
|
|
|
|
|
int i; |
115
|
|
|
|
|
|
|
double ab1, abv[3], p[3], w, p1dv, p2[3], p3[3]; |
116
|
|
|
|
|
|
|
double gr2e, pde, pdep1, ehn[3], p1[3]; |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
/* Unpack scalar and vector parameters. */ |
119
|
0
|
|
|
|
|
|
ab1 = amprms[11]; |
120
|
0
|
|
|
|
|
|
gr2e = amprms[7]; |
121
|
0
|
0
|
|
|
|
|
for( i = 0; i < 3; i++ ) { |
122
|
0
|
|
|
|
|
|
abv[i] = amprms[i+8]; |
123
|
0
|
|
|
|
|
|
ehn[i] = amprms[i+4]; |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
/* Spherical to x,y,z. */ |
127
|
0
|
|
|
|
|
|
eraS2c( rm, dm, p ); |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
/* Light deflection (restrained within the Sun's disc) */ |
130
|
0
|
|
|
|
|
|
pde = eraPdp( p, ehn ); |
131
|
0
|
|
|
|
|
|
pdep1 = pde + 1.0; |
132
|
0
|
0
|
|
|
|
|
w = gr2e / ( pdep1 > 1.0e-5 ? pdep1 : 1.0e-5 ); |
133
|
0
|
0
|
|
|
|
|
for( i = 0; i < 3; i++) { |
134
|
0
|
|
|
|
|
|
p1[i] = p[i] + w * ( ehn[i] - pde * p[i] ); |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
/* Aberration. */ |
138
|
0
|
|
|
|
|
|
p1dv = eraPdp( p1, abv ); |
139
|
0
|
|
|
|
|
|
w = 1.0 + p1dv / ( ab1 + 1.0 ); |
140
|
0
|
0
|
|
|
|
|
for( i = 0; i < 3; i++ ) { |
141
|
0
|
|
|
|
|
|
p2[i] = ( ( ab1 * p1[i] ) + ( w * abv[i] ) ); |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
/* Precession and nutation. */ |
145
|
0
|
|
|
|
|
|
eraRxp( (double(*)[3]) &rms[12], p2, p3 ); |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
/* Geocentric apparent RA,dec. */ |
148
|
0
|
|
|
|
|
|
eraC2s( p3, ra, da ); |
149
|
0
|
|
|
|
|
|
*ra = eraAnp( *ra ); |
150
|
0
|
|
|
|
|
|
} |