source: trunk/FACT++/pal/palAmpqk.c@ 18350

Last change on this file since 18350 was 18347, checked in by tbretz, 9 years ago
File size: 3.6 KB
Line 
1/*
2*+
3* Name:
4* palAmpqk
5
6* Purpose:
7* Convert star RA,Dec from geocentric apparent to mean place.
8
9* Language:
10* Starlink ANSI C
11
12* Type of Module:
13* Library routine
14
15* Invocation:
16* void palAmpqk ( double ra, double da, double amprms[21],
17* double *rm, double *dm )
18
19* Arguments:
20* ra = double (Given)
21* Apparent RA (radians).
22* da = double (Given)
23* Apparent Dec (radians).
24* amprms = double[21] (Given)
25* Star-independent mean-to-apparent parameters (see palMappa):
26* (0) time interval for proper motion (Julian years)
27* (1-3) barycentric position of the Earth (AU)
28* (4-6) not used
29* (7) not used
30* (8-10) abv: barycentric Earth velocity in units of c
31* (11) sqrt(1-v*v) where v=modulus(abv)
32* (12-20) precession/nutation (3,3) matrix
33* rm = double (Returned)
34* Mean RA (radians).
35* dm = double (Returned)
36* Mean Dec (radians).
37
38* Description:
39* Convert star RA,Dec from geocentric apparent to mean place. The "mean"
40* coordinate system is in fact close to ICRS. Use of this function
41* is appropriate when efficiency is important and where many star
42* positions are all to be transformed for one epoch and equinox. The
43* star-independent parameters can be obtained by calling the palMappa
44* function.
45
46* Authors:
47* PTW: Pat Wallace (STFC)
48* {enter_new_authors_here}
49
50* History:
51* 2012-02-13 (PTW):
52* Initial version.
53* Adapted with permission from the Fortran SLALIB library.
54* {enter_further_changes_here}
55
56* Copyright:
57* Copyright (C) 2000 Rutherford Appleton Laboratory
58* Copyright (C) 2012 Science and Technology Facilities Council.
59* All Rights Reserved.
60
61* Licence:
62* This program is free software: you can redistribute it and/or
63* modify it under the terms of the GNU Lesser General Public
64* License as published by the Free Software Foundation, either
65* version 3 of the License, or (at your option) any later
66* version.
67*
68* This program is distributed in the hope that it will be useful,
69* but WITHOUT ANY WARRANTY; without even the implied warranty of
70* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
71* GNU Lesser General Public License for more details.
72*
73* You should have received a copy of the GNU Lesser General
74* License along with this program. If not, see
75* <http://www.gnu.org/licenses/>.
76
77* Bugs:
78* {note_any_bugs_here}
79*-
80*/
81
82#include "pal.h"
83#include "pal1sofa.h"
84
85void palAmpqk ( double ra, double da, double amprms[21], double *rm,
86 double *dm ){
87
88/* Local Variables: */
89 double ab1; /* sqrt(1-v*v) where v=modulus of Earth vel */
90 double abv[3]; /* Earth velocity wrt SSB (c, FK5) */
91 double p1[3], p2[3], p3[3]; /* work vectors */
92 double ab1p1, p1dv, p1dvp1, w;
93 int i, j;
94
95/* Unpack some of the parameters */
96 ab1 = amprms[11];
97 for( i = 0; i < 3; i++ ) {
98 abv[i] = amprms[i + 8];
99 }
100
101/* Apparent RA,Dec to Cartesian */
102 eraS2c( ra, da, p3 );
103
104/* Precession and nutation */
105 eraTrxp( (double(*)[3]) &amprms[12], p3, p2 );
106
107/* Aberration */
108 ab1p1 = ab1 + 1.0;
109 for( i = 0; i < 3; i++ ) {
110 p1[i] = p2[i];
111 }
112 for( j = 0; j < 2; j++ ) {
113 p1dv = eraPdp( p1, abv );
114 p1dvp1 = 1.0 + p1dv;
115 w = 1.0 + p1dv / ab1p1;
116 for( i = 0; i < 3; i++ ) {
117 p1[i] = ( p1dvp1 * p2[i] - w * abv[i] ) / ab1;
118 }
119 eraPn( p1, &w, p3 );
120 for( i = 0; i < 3; i++ ) {
121 p1[i] = p3[i];
122 }
123 }
124
125/* Mean RA,Dec */
126 eraC2s( p1, rm, dm );
127 *rm = eraAnp( *rm );
128}
Note: See TracBrowser for help on using the repository browser.