source: branches/FACT++_lidctrl_usb/pal/palMappa.c@ 19688

Last change on this file since 19688 was 18712, checked in by tbretz, 8 years ago
Updated to PAL 0.9.7 (adds mainly light deflection to abberation which was previously missing)
File size: 3.9 KB
Line 
1/*
2*+
3* Name:
4* palMappa
5
6* Purpose:
7* Compute parameters needed by palAmpqk and palMapqk.
8
9* Language:
10* Starlink ANSI C
11
12* Type of Module:
13* Library routine
14
15* Invocation:
16* void palMappa( double eq, double date, double amprms[21] )
17
18* Arguments:
19* eq = double (Given)
20* epoch of mean equinox to be used (Julian)
21* date = double (Given)
22* TDB (JD-2400000.5)
23* amprms = double[21] (Returned)
24* star-independent mean-to-apparent parameters:
25* - (0) time interval for proper motion (Julian years)
26* - (1-3) barycentric position of the Earth (AU)
27* - (4-6) heliocentric direction of the Earth (unit vector)
28* - (7) (Schwarzschild radius of Sun)/(Sun-Earth distance)
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
33* Description:
34* Compute star-independent parameters in preparation for
35* transformations between mean place and geocentric apparent place.
36*
37* The parameters produced by this function are required in the
38* parallax, aberration, and nutation/bias/precession parts of the
39* mean/apparent transformations.
40*
41* The reference systems and timescales used are IAU 2006.
42
43* Notes:
44* - For date, the distinction between the required TDB and TT
45* is always negligible. Moreover, for all but the most
46* critical applications UTC is adequate.
47* - The vector amprms(1-3) is referred to the mean equinox and
48* equator of epoch eq.
49* - The parameters amprms produced by this function are used by
50* palAmpqk, palMapqk and palMapqkz.
51
52* Authors:
53* PTW: Pat Wallace (STFC)
54* {enter_new_authors_here}
55
56* History:
57* 2012-02-13 (PTW):
58* Initial version.
59* Adapted with permission from the Fortran SLALIB library.
60* {enter_further_changes_here}
61
62* Copyright:
63* Copyright (C) 2003 Rutherford Appleton Laboratory
64* Copyright (C) 2012 Science and Technology Facilities Council.
65* All Rights Reserved.
66
67* Licence:
68* This program is free software: you can redistribute it and/or
69* modify it under the terms of the GNU Lesser General Public
70* License as published by the Free Software Foundation, either
71* version 3 of the License, or (at your option) any later
72* version.
73*
74* This program is distributed in the hope that it will be useful,
75* but WITHOUT ANY WARRANTY; without even the implied warranty of
76* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
77* GNU Lesser General Public License for more details.
78*
79* You should have received a copy of the GNU Lesser General
80* License along with this program. If not, see
81* <http://www.gnu.org/licenses/>.
82
83* Bugs:
84* {note_any_bugs_here}
85*-
86*/
87
88#include "pal.h"
89#include "palmac.h"
90#include "pal1sofa.h"
91
92#include <string.h>
93
94void palMappa( double eq, double date, double amprms[21] ){
95
96/* Local constants */
97
98/* Gravitational radius of the Sun x 2 (2*mu/c**2, AU) */
99 const double GR2 = 2.0 * 9.87063e-9;
100
101/* Local Variables; */
102 int i;
103 double ebd[ 3 ], ehd[ 3 ], eh[ 3 ], e, vn[ 3 ], vm;
104
105/* Initialise so that unsused values are returned holding zero */
106 memset( amprms, 0, 21*sizeof( *amprms ) );
107
108/* Time interval for proper motion correction. */
109 amprms[ 0 ] = eraEpj( PAL__MJD0, date ) - eq;
110
111/* Get Earth barycentric and heliocentric position and velocity. */
112 palEvp( date, eq, ebd, &amprms[ 1 ], ehd, eh );
113
114/* Heliocentric direction of Earth (normalized) and modulus. */
115 eraPn( eh, &e, &amprms[ 4 ] );
116
117/* Light deflection parameter */
118 amprms[7] = GR2 / e;
119
120/* Aberration parameters. */
121 for( i = 0; i < 3; i++ ) {
122 amprms[ i + 8 ] = ebd[ i ]*PAL__CR;
123 }
124 eraPn( &amprms[8], &vm, vn );
125 amprms[ 11 ] = sqrt( 1.0 - vm*vm );
126
127/* NPB matrix. */
128 palPrenut( eq, date, (double(*)[ 3 ]) &amprms[ 12 ] );
129}
Note: See TracBrowser for help on using the repository browser.