1 | /*
|
---|
2 | *+
|
---|
3 | * Name:
|
---|
4 | * palTest
|
---|
5 |
|
---|
6 | * Purpose:
|
---|
7 | * Test the PAL library
|
---|
8 |
|
---|
9 | * Language:
|
---|
10 | * Starlink ANSI C
|
---|
11 |
|
---|
12 | * Type of Module:
|
---|
13 | * Application
|
---|
14 |
|
---|
15 | * Description:
|
---|
16 | * Test the PAL library is functioning correctly. Uses some of the SLA test code.
|
---|
17 |
|
---|
18 | * Authors:
|
---|
19 | * TIMJ: Tim Jenness (JAC, Hawaii)
|
---|
20 | * {enter_new_authors_here}
|
---|
21 |
|
---|
22 | * History:
|
---|
23 | * 2012-02-08 (TIMJ):
|
---|
24 | * Initial version
|
---|
25 | * Adapted with permission from the Fortran SLALIB library.
|
---|
26 | * {enter_further_changes_here}
|
---|
27 |
|
---|
28 | * Copyright:
|
---|
29 | * Copyright (C) 2012 Science and Technology Facilities Council.
|
---|
30 | * All Rights Reserved.
|
---|
31 |
|
---|
32 | * Licence:
|
---|
33 | * This program is free software; you can redistribute it and/or
|
---|
34 | * modify it under the terms of the GNU General Public License as
|
---|
35 | * published by the Free Software Foundation; either version 3 of
|
---|
36 | * the License, or (at your option) any later version.
|
---|
37 | *
|
---|
38 | * This program is distributed in the hope that it will be
|
---|
39 | * useful, but WITHOUT ANY WARRANTY; without even the implied
|
---|
40 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
---|
41 | * PURPOSE. See the GNU General Public License for more details.
|
---|
42 | *
|
---|
43 | * You should have received a copy of the GNU General Public License
|
---|
44 | * along with this program; if not, write to the Free Software
|
---|
45 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
---|
46 | * USA.
|
---|
47 |
|
---|
48 | * Bugs:
|
---|
49 | * {note_any_bugs_here}
|
---|
50 | *-
|
---|
51 | */
|
---|
52 |
|
---|
53 | #include <stdlib.h>
|
---|
54 | #include <stdio.h>
|
---|
55 | #include <string.h>
|
---|
56 |
|
---|
57 | #include "pal.h"
|
---|
58 | #include "palmac.h"
|
---|
59 |
|
---|
60 | static int verbose = 1;
|
---|
61 |
|
---|
62 | /* Support functions to allow to test results.
|
---|
63 | viv and vvd match the SOFA/ERFA implementations */
|
---|
64 |
|
---|
65 | static void viv(int ival, int ivalok, const char *func, const char *test,
|
---|
66 | int *status)
|
---|
67 | /*
|
---|
68 | ** - - - -
|
---|
69 | ** v i v
|
---|
70 | ** - - - -
|
---|
71 | **
|
---|
72 | ** Validate an integer result.
|
---|
73 | **
|
---|
74 | ** Internal function used by t_sofa_c program.
|
---|
75 | **
|
---|
76 | ** Given:
|
---|
77 | ** ival int value computed by function under test
|
---|
78 | ** ivalok int correct value
|
---|
79 | ** func char[] name of function under test
|
---|
80 | ** test char[] name of individual test
|
---|
81 | **
|
---|
82 | ** Given and returned:
|
---|
83 | ** status int set to FALSE if test fails
|
---|
84 | **
|
---|
85 | ** This revision: 2009 November 4
|
---|
86 | */
|
---|
87 | {
|
---|
88 | if (ival != ivalok) {
|
---|
89 | *status = 1;
|
---|
90 | printf("%s failed: %s want %d got %d\n",
|
---|
91 | func, test, ivalok, ival);
|
---|
92 | } else if (verbose) {
|
---|
93 | printf("%s passed: %s want %d got %d\n",
|
---|
94 | func, test, ivalok, ival);
|
---|
95 | }
|
---|
96 | return;
|
---|
97 | }
|
---|
98 |
|
---|
99 | static void vvd(double val, double valok, double dval,
|
---|
100 | const char *func, const char *test, int *status)
|
---|
101 | /*
|
---|
102 | ** - - - -
|
---|
103 | ** v v d
|
---|
104 | ** - - - -
|
---|
105 | **
|
---|
106 | ** Validate a double result.
|
---|
107 | **
|
---|
108 | ** Internal function used by t_sofa_c program.
|
---|
109 | **
|
---|
110 | ** Given:
|
---|
111 | ** val double value computed by function under test
|
---|
112 | ** valok double expected value
|
---|
113 | ** dval double maximum allowable error
|
---|
114 | ** func char[] name of function under test
|
---|
115 | ** test char[] name of individual test
|
---|
116 | **
|
---|
117 | ** Given and returned:
|
---|
118 | ** status int set to FALSE if test fails
|
---|
119 | **
|
---|
120 | ** This revision: 2008 June 8
|
---|
121 | */
|
---|
122 | {
|
---|
123 | double a, f; /* absolute and fractional error */
|
---|
124 |
|
---|
125 |
|
---|
126 | a = val - valok;
|
---|
127 | if (fabs(a) > dval) {
|
---|
128 | f = fabs(valok / a);
|
---|
129 | *status = 1;
|
---|
130 | printf("%s failed: %s want %.20g got %.20g (1/%.3g)\n",
|
---|
131 | func, test, valok, val, f);
|
---|
132 | } else if (verbose) {
|
---|
133 | printf("%s passed: %s want %.20g got %.20g\n",
|
---|
134 | func, test, valok, val);
|
---|
135 | }
|
---|
136 | return;
|
---|
137 | }
|
---|
138 |
|
---|
139 | /* Verify a string */
|
---|
140 | static void vcs( const char * val, const char * valok,
|
---|
141 | const char * func, const char * test,
|
---|
142 | int *status ) {
|
---|
143 |
|
---|
144 | if (strcmp(val, valok) != 0) {
|
---|
145 | *status = 1;
|
---|
146 | printf("%s failed: %s want %s got %s\n",
|
---|
147 | func, test, valok, val );
|
---|
148 | } else if (verbose) {
|
---|
149 | printf("%s passed: %s want %s got %s\n",
|
---|
150 | func, test, valok, val );
|
---|
151 | }
|
---|
152 | return;
|
---|
153 |
|
---|
154 | }
|
---|
155 |
|
---|
156 | /* Verify the 3x3 rmat matrix */
|
---|
157 | static void
|
---|
158 | vrmat( double rmat[3][3], double expected[3][3], const char * func,
|
---|
159 | double dval, int * status ) {
|
---|
160 | int i;
|
---|
161 | char buf[10];
|
---|
162 | for( i = 0; i < 3; i++ ) {
|
---|
163 | int j;
|
---|
164 | for( j = 0; j < 3; j++ ) {
|
---|
165 | sprintf( buf, "%d,%d", i, j );
|
---|
166 | vvd( rmat[i][j], expected[i][j], dval, func, buf, status );
|
---|
167 | }
|
---|
168 | }
|
---|
169 | }
|
---|
170 |
|
---|
171 | /* Verify a vector */
|
---|
172 | static void
|
---|
173 | vvec( int len, double *vec, double *expected, const char *func,
|
---|
174 | int *status ) {
|
---|
175 | int i;
|
---|
176 | char buf[10];
|
---|
177 | for( i = 0; i < len; i++ ) {
|
---|
178 | sprintf( buf, "%d", i );
|
---|
179 | vvd( vec[i], expected[i], 1e-12, func, buf, status );
|
---|
180 | }
|
---|
181 | }
|
---|
182 |
|
---|
183 | /******************************************************************/
|
---|
184 | /* TEST FUNCTIONS */
|
---|
185 |
|
---|
186 | /* Adding E-terms */
|
---|
187 |
|
---|
188 | static void t_addet( int *status ) {
|
---|
189 | double r1,d1,r2,d2;
|
---|
190 | double rm = 2.;
|
---|
191 | double dm = -1.;
|
---|
192 | double eq = 1975.;
|
---|
193 |
|
---|
194 |
|
---|
195 | palAddet ( rm, dm, eq, &r1, &d1 );
|
---|
196 | vvd ( r1 - rm, 2.983864874295250e-6, 1e-12, "palAddet",
|
---|
197 | "R", status );
|
---|
198 | vvd ( d1 - dm, 2.379650804185118e-7, 1e-12, "palAddet",
|
---|
199 | "D", status );
|
---|
200 |
|
---|
201 | palSubet ( r1, d1, eq, &r2, &d2 );
|
---|
202 | vvd ( r2 - rm, 0, 1e-12, "palSubet", "R", status );
|
---|
203 | vvd ( d2 - dm, 0, 1e-12, "palSubet", "D", status );
|
---|
204 |
|
---|
205 | }
|
---|
206 |
|
---|
207 | static void t_afin( int * status ) {
|
---|
208 |
|
---|
209 | int j;
|
---|
210 | int i = 1;
|
---|
211 | double d = 0.0;
|
---|
212 | const char * s = "12 34 56.7 |";
|
---|
213 | const char * s2 = "45 00 00.000 ";
|
---|
214 |
|
---|
215 | palDafin (s, &i, &d, &j);
|
---|
216 | viv ( i, 12, "palDafin", "I", status );
|
---|
217 | vvd ( d, 0.2196045986911432, 1e-12, "palDafin", "A",
|
---|
218 | status );
|
---|
219 | viv ( j, 0, "palDafin", "J", status );
|
---|
220 |
|
---|
221 | i = 1;
|
---|
222 | palDafin (s2, &i, &d, &j);
|
---|
223 | viv ( i, 14, "palDafin", "I", status );
|
---|
224 | vvd ( d, PAL__DPI/4.0, 1e-12, "palDafin", "A",
|
---|
225 | status );
|
---|
226 | viv ( j, 0, "palDafin", "J", status );
|
---|
227 | }
|
---|
228 |
|
---|
229 | /* Altaz */
|
---|
230 |
|
---|
231 | static void t_altaz( int *status ) {
|
---|
232 | double az, azd, azdd, el, eld, eldd, pa, pad, padd;
|
---|
233 | palAltaz( 0.7, -0.7, -0.65,
|
---|
234 | &az, &azd, &azdd, &el, &eld, &eldd, &pa, &pad, &padd );
|
---|
235 |
|
---|
236 | vvd ( az, 4.400560746660174, 1e-12, "palAltaz",
|
---|
237 | "AZ", status );
|
---|
238 | vvd ( azd, -0.2015438937145421, 1e-13, "palAltaz",
|
---|
239 | "AZD", status );
|
---|
240 | vvd ( azdd, -0.4381266949668748, 1e-13, "palAltaz",
|
---|
241 | "AZDD", status );
|
---|
242 | vvd ( el, 1.026646506651396, 1e-12, "palAltaz",
|
---|
243 | "EL", status );
|
---|
244 | vvd ( eld, -0.7576920683826450, 1e-13, "palAltaz",
|
---|
245 | "ELD", status );
|
---|
246 | vvd ( eldd, 0.04922465406857453, 1e-14, "palAltaz",
|
---|
247 | "ELDD", status );
|
---|
248 | vvd ( pa, 1.707639969653937, 1e-12, "palAltaz",
|
---|
249 | "PA", status );
|
---|
250 | vvd ( pad, 0.4717832355365627, 1e-13, "palAltaz",
|
---|
251 | "PAD", status );
|
---|
252 | vvd ( padd, -0.2957914128185515, 1e-13, "palAltaz",
|
---|
253 | "PADD", status );
|
---|
254 | }
|
---|
255 |
|
---|
256 | /* Airmass */
|
---|
257 |
|
---|
258 | static void t_airmas( int *status ) {
|
---|
259 | vvd ( palAirmas ( 1.2354 ), 3.015698990074724,
|
---|
260 | 1e-12, "palAirmas", " ", status );
|
---|
261 | }
|
---|
262 |
|
---|
263 | /* Apparent to mean place */
|
---|
264 |
|
---|
265 | static void t_amp ( int *status ) {
|
---|
266 | double rm, dm;
|
---|
267 |
|
---|
268 | /* Original SLA test is not accurate since palMapqk
|
---|
269 | differs from slaMapqk */
|
---|
270 | palAmp ( 2.345, -1.234, 50100, 1990, &rm, &dm );
|
---|
271 | vvd ( rm, 2.344472180027961, 1e-6, "palAmp", "R",
|
---|
272 | status );
|
---|
273 | vvd ( dm, -1.233573099847705, 1e-7, "palAmp", "D",
|
---|
274 | status );
|
---|
275 |
|
---|
276 | /* This is the palMapqk test */
|
---|
277 | palAmp( 1.234, -0.567, 55927.0, 2010.0, &rm, &dm );
|
---|
278 | vvd( rm, 1.2335120411026936349, 1.0E-12, "palAmp", "rm", status );
|
---|
279 | vvd( dm, -0.56702908706930343907, 1.0E-12, "palAmp", "dm", status );
|
---|
280 | }
|
---|
281 |
|
---|
282 | /* Apparent to Observed place */
|
---|
283 |
|
---|
284 | static void t_aop ( int *status ) {
|
---|
285 |
|
---|
286 | int i;
|
---|
287 |
|
---|
288 | double rap, dap, date, dut, elongm, phim, hm, xp, yp,
|
---|
289 | tdk, pmb, rh, wl, tlr, aob, zob, hob, dob, rob, aoprms[14];
|
---|
290 |
|
---|
291 | dap = -0.1234;
|
---|
292 | date = 51000.1;
|
---|
293 | dut = 25.0;
|
---|
294 | elongm = 2.1;
|
---|
295 | phim = 0.5;
|
---|
296 | hm = 3000.0;
|
---|
297 | xp = -0.5e-6;
|
---|
298 | yp = 1.0e-6;
|
---|
299 | tdk = 280.0;
|
---|
300 | pmb = 550.0;
|
---|
301 | rh = 0.6;
|
---|
302 | tlr = 0.006;
|
---|
303 |
|
---|
304 | for (i=1; i<=3; i++) {
|
---|
305 |
|
---|
306 | if ( i == 1 ) {
|
---|
307 | rap = 2.7;
|
---|
308 | wl = 0.45;
|
---|
309 | } else if ( i == 2 ) {
|
---|
310 | rap = 2.345;
|
---|
311 | } else {
|
---|
312 | wl = 1.0e6;
|
---|
313 | }
|
---|
314 |
|
---|
315 | palAop ( rap, dap, date, dut, elongm, phim, hm, xp, yp,
|
---|
316 | tdk, pmb, rh, wl, tlr, &aob, &zob, &hob, &dob, &rob );
|
---|
317 |
|
---|
318 | if ( i == 1 ) {
|
---|
319 | vvd( aob, 1.812817787123283034, 1e-10, "palAop",
|
---|
320 | "lo aob", status );
|
---|
321 | vvd( zob, 1.393860816635714034, 1e-8, "palAop",
|
---|
322 | "lo zob", status );
|
---|
323 | vvd( hob, -1.297808009092456683, 1e-8, "palAop",
|
---|
324 | "lo hob", status );
|
---|
325 | vvd( dob, -0.122967060534561, 1e-8, "palAop",
|
---|
326 | "lo dob", status );
|
---|
327 | vvd( rob, 2.699270287872084, 1e-8, "palAop",
|
---|
328 | "lo rob", status );
|
---|
329 | } else if ( i == 2 ) {
|
---|
330 | vvd( aob, 2.019928026670621442, 1e-10, "palAop",
|
---|
331 | "aob/o", status );
|
---|
332 | vvd( zob, 1.101316172427482466, 1e-10, "palAop",
|
---|
333 | "zob/o", status );
|
---|
334 | vvd( hob, -0.9432923558497740862, 1e-10, "palAop",
|
---|
335 | "hob/o", status );
|
---|
336 | vvd( dob, -0.1232144708194224, 1e-10, "palAop",
|
---|
337 | "dob/o", status );
|
---|
338 | vvd( rob, 2.344754634629428, 1e-10, "palAop",
|
---|
339 | "rob/o", status );
|
---|
340 | } else {
|
---|
341 | vvd( aob, 2.019928026670621442, 1e-10, "palAop",
|
---|
342 | "aob/r", status );
|
---|
343 | vvd( zob, 1.101267532198003760, 1e-10, "palAop",
|
---|
344 | "zob/r", status );
|
---|
345 | vvd( hob, -0.9432533138143315937, 1e-10, "palAop",
|
---|
346 | "hob/r", status );
|
---|
347 | vvd( dob, -0.1231850665614878, 1e-10, "palAop",
|
---|
348 | "dob/r", status );
|
---|
349 | vvd( rob, 2.344715592593984, 1e-10, "palAop",
|
---|
350 | "rob/r", status );
|
---|
351 | }
|
---|
352 | }
|
---|
353 |
|
---|
354 | date = 48000.3;
|
---|
355 | wl = 0.45;
|
---|
356 |
|
---|
357 | palAoppa ( date, dut, elongm, phim, hm, xp, yp, tdk,
|
---|
358 | pmb, rh, wl, tlr, aoprms );
|
---|
359 | vvd( aoprms[0], 0.4999993892136306, 1e-13, "palAoppa",
|
---|
360 | "0", status );
|
---|
361 | vvd( aoprms[1], 0.4794250025886467, 1e-13, "palAoppa",
|
---|
362 | "1", status );
|
---|
363 | vvd( aoprms[2], 0.8775828547167932, 1e-13, "palAoppa",
|
---|
364 | "2", status );
|
---|
365 | vvd( aoprms[3], 1.363180872136126e-6, 1e-13, "palAoppa",
|
---|
366 | "3", status );
|
---|
367 | vvd( aoprms[4], 3000.0, 1e-10, "palAoppa", "4",
|
---|
368 | status );
|
---|
369 | vvd( aoprms[5], 280.0, 1e-11, "palAoppa", "5",
|
---|
370 | status );
|
---|
371 | vvd( aoprms[6], 550.0, 1e-11, "palAoppa", "6",
|
---|
372 | status );
|
---|
373 | vvd( aoprms[7], 0.6, 1e-13, "palAoppa", "7",
|
---|
374 | status );
|
---|
375 | vvd( aoprms[8], 0.45, 1e-13, "palAoppa", "8",
|
---|
376 | status );
|
---|
377 | vvd( aoprms[9], 0.006, 1e-15, "palAoppa", "9",
|
---|
378 | status );
|
---|
379 | vvd( aoprms[10], 0.0001562803328459898, 1e-13,
|
---|
380 | "palAoppa", "10", status );
|
---|
381 | vvd( aoprms[11], -1.792293660141e-7, 1e-13,
|
---|
382 | "palAoppa", "11", status );
|
---|
383 | vvd( aoprms[12], 2.101874231495843, 1e-13,
|
---|
384 | "palAoppa", "12", status );
|
---|
385 | vvd( aoprms[13], 7.601916802079765, 1e-8,
|
---|
386 | "palAoppa", "13", status );
|
---|
387 |
|
---|
388 | palOap ( "r", 1.6, -1.01, date, dut, elongm, phim,
|
---|
389 | hm, xp, yp, tdk, pmb, rh, wl, tlr, &rap, &dap );
|
---|
390 | vvd( rap, 1.601197569844787, 1e-10, "palOap",
|
---|
391 | "rr", status );
|
---|
392 | vvd( dap, -1.012528566544262, 1e-10, "palOap",
|
---|
393 | "rd", status );
|
---|
394 | palOap ( "h", -1.234, 2.34, date, dut, elongm, phim,
|
---|
395 | hm, xp, yp, tdk, pmb, rh, wl, tlr, &rap, &dap );
|
---|
396 | vvd( rap, 5.693087688154886463, 1e-10, "palOap",
|
---|
397 | "hr", status );
|
---|
398 | vvd( dap, 0.8010281167405444, 1e-10, "palOap",
|
---|
399 | "hd", status );
|
---|
400 | palOap ( "a", 6.1, 1.1, date, dut, elongm, phim,
|
---|
401 | hm, xp, yp, tdk, pmb, rh, wl, tlr, &rap, &dap );
|
---|
402 | vvd( rap, 5.894305175192448940, 1e-10, "palOap",
|
---|
403 | "ar", status );
|
---|
404 | vvd( dap, 1.406150707974922, 1e-10, "palOap",
|
---|
405 | "ad", status );
|
---|
406 |
|
---|
407 | palOapqk ( "r", 2.1, -0.345, aoprms, &rap, &dap );
|
---|
408 | vvd( rap, 2.10023962776202, 1e-10, "palOapqk",
|
---|
409 | "rr", status );
|
---|
410 | vvd( dap, -0.3452428692888919, 1e-10, "palOapqk",
|
---|
411 | "rd", status );
|
---|
412 | palOapqk ( "h", -0.01, 1.03, aoprms, &rap, &dap );
|
---|
413 | vvd( rap, 1.328731933634564995, 1e-10, "palOapqk",
|
---|
414 | "hr", status );
|
---|
415 | vvd( dap, 1.030091538647746, 1e-10, "palOapqk",
|
---|
416 | "hd", status );
|
---|
417 | palOapqk ( "a", 4.321, 0.987, aoprms, &rap, &dap );
|
---|
418 | vvd( rap, 0.4375507112075065923, 1e-10, "palOapqk",
|
---|
419 | "ar", status );
|
---|
420 | vvd( dap, -0.01520898480744436, 1e-10, "palOapqk",
|
---|
421 | "ad", status );
|
---|
422 |
|
---|
423 | palAoppat ( date + PAL__DS2R, aoprms );
|
---|
424 | vvd( aoprms[13], 7.602374979243502, 1e-8, "palAoppat",
|
---|
425 | " ", status );
|
---|
426 | }
|
---|
427 |
|
---|
428 | /* Bearings */
|
---|
429 |
|
---|
430 | static void t_bear( int *status ) {
|
---|
431 | double a1 = 1.234;
|
---|
432 | double b1 = -0.123;
|
---|
433 | double a2 = 2.345;
|
---|
434 | double b2 = 0.789;
|
---|
435 |
|
---|
436 | double d1[3];
|
---|
437 | double d2[3];
|
---|
438 |
|
---|
439 | vvd ( palDbear ( a1, b1, a2, b2 ), 0.7045970341781791,
|
---|
440 | 1e-12, "palDbear", " ", status );
|
---|
441 | palDcs2c ( a1, b1, d1 );
|
---|
442 | palDcs2c ( a2, b2, d2 );
|
---|
443 |
|
---|
444 | vvd ( palDpav ( d1, d2 ), 0.7045970341781791,
|
---|
445 | 1e-12, "palDpav", " ", status );
|
---|
446 |
|
---|
447 | }
|
---|
448 |
|
---|
449 | /* Calendar to MJD */
|
---|
450 |
|
---|
451 | static void t_caldj( int *status ) {
|
---|
452 | int j;
|
---|
453 | double djm;
|
---|
454 |
|
---|
455 | palCaldj ( 1999, 12, 31, &djm, &j );
|
---|
456 | vvd ( djm, 51543, 0, "palCaldj", " ", status );
|
---|
457 | viv ( j, 0, "palCaldj", "J", status );
|
---|
458 | }
|
---|
459 |
|
---|
460 | /* palDaf2r */
|
---|
461 |
|
---|
462 | static void t_caf2r( int * status ) {
|
---|
463 | int j;
|
---|
464 | double dr;
|
---|
465 |
|
---|
466 | palDaf2r ( 76, 54, 32.1, &dr, &j );
|
---|
467 | vvd ( dr, 1.342313819975276, 1e-12, "palDaf2r",
|
---|
468 | "r", status );
|
---|
469 | viv ( j, 0, "palDaf2r", "j", status );
|
---|
470 | }
|
---|
471 |
|
---|
472 | /* Test palDcc2s routines */
|
---|
473 |
|
---|
474 | static void t_cc2s( int * status ) {
|
---|
475 | double dv[3] = { 100., -50., 25. };
|
---|
476 | double da, db;
|
---|
477 |
|
---|
478 | palDcc2s ( dv, &da, &db );
|
---|
479 | vvd ( da, -0.4636476090008061, 1e-12, "palDcc2s",
|
---|
480 | "A", status );
|
---|
481 | vvd ( db, 0.2199879773954594, 1e-12, "palDcc2s",
|
---|
482 | "B", status );
|
---|
483 | }
|
---|
484 |
|
---|
485 | /* palDd2tf */
|
---|
486 |
|
---|
487 | static void t_cd2tf( int *status ) {
|
---|
488 | int ihmsf[4];
|
---|
489 | char s;
|
---|
490 |
|
---|
491 | palDd2tf ( 4, -0.987654321, &s, ihmsf );
|
---|
492 | viv ( s, '-', "palDd2tf", "S", status );
|
---|
493 | viv ( ihmsf[0], 23, "palDd2tf", "(1)", status );
|
---|
494 | viv ( ihmsf[1], 42, "palDd2tf", "(2)", status );
|
---|
495 | viv ( ihmsf[2], 13, "palDd2tf", "(3)", status );
|
---|
496 | viv ( ihmsf[3], 3333, "palDd2tf", "(4)", status );
|
---|
497 | }
|
---|
498 |
|
---|
499 | /* Calendar to MJD */
|
---|
500 |
|
---|
501 | static void t_cldj( int *status ) {
|
---|
502 | double d;
|
---|
503 | int j;
|
---|
504 |
|
---|
505 | palCldj ( 1899, 12, 31, &d, &j );
|
---|
506 | vvd ( d, 15019, 0, "palCldj", "D", status );
|
---|
507 | viv ( j, 0, "palCldj", "J", status );
|
---|
508 | }
|
---|
509 |
|
---|
510 | /* palDr2af */
|
---|
511 |
|
---|
512 | static void t_cr2af( int *status ) {
|
---|
513 | char s;
|
---|
514 | int idmsf[4];
|
---|
515 | palDr2af ( 4, 2.345, &s, idmsf );
|
---|
516 | viv ( s, '+', "palDr2af", "S", status );
|
---|
517 | viv ( idmsf[0], 134, "palDr2af", "(1)", status );
|
---|
518 | viv ( idmsf[1], 21, "palDr2af", "(2)", status );
|
---|
519 | viv ( idmsf[2], 30, "palDr2af", "(3)", status );
|
---|
520 | viv ( idmsf[3], 9706, "palDr2af", "(4)", status );
|
---|
521 | }
|
---|
522 |
|
---|
523 | /* palDr2tf */
|
---|
524 |
|
---|
525 | static void t_cr2tf( int *status ) {
|
---|
526 | char s;
|
---|
527 | int ihmsf[4];
|
---|
528 | palDr2tf ( 4, -3.01234, &s, ihmsf );
|
---|
529 | viv ( s, '-', "palDr2tf", "S", status );
|
---|
530 | viv ( ihmsf[0], 11, "palDr2tf", "(1)", status );
|
---|
531 | viv ( ihmsf[1], 30, "palDr2tf", "(2)", status );
|
---|
532 | viv ( ihmsf[2], 22, "palDr2tf", "(3)", status );
|
---|
533 | viv ( ihmsf[3], 6484, "palDr2tf", "(4)", status );
|
---|
534 | }
|
---|
535 |
|
---|
536 | /* palDtf2d */
|
---|
537 |
|
---|
538 | static void t_ctf2d( int *status ) {
|
---|
539 | double dd;
|
---|
540 | int j;
|
---|
541 |
|
---|
542 | palDtf2d (23, 56, 59.1, &dd, &j);
|
---|
543 | vvd ( dd, 0.99790625, 1e-12, "palDtf2d", "D", status );
|
---|
544 | viv ( j, 0, "palDtf2d", "J", status );
|
---|
545 | }
|
---|
546 |
|
---|
547 | /* palDtf2r */
|
---|
548 |
|
---|
549 | static void t_ctf2r( int *status ) {
|
---|
550 | double dr;
|
---|
551 | int j;
|
---|
552 |
|
---|
553 | palDtf2r (23, 56, 59.1, &dr, &j);
|
---|
554 | vvd ( dr, 6.270029887942679, 1e-12, "palDtf2r",
|
---|
555 | "R", status );
|
---|
556 | viv ( j, 0, "palDtf2r", "J", status );
|
---|
557 | }
|
---|
558 |
|
---|
559 | static void t_dat ( int *status ) {
|
---|
560 | vvd ( palDat ( 43900 ), 18, 0, "palDat",
|
---|
561 | " ", status );
|
---|
562 | vvd ( palDtt ( 40404 ), 39.709746, 1e-12, "palDtt",
|
---|
563 | " ", status );
|
---|
564 | vvd ( palDt ( 500 ), 4686.7, 1e-10, "palDt",
|
---|
565 | "500", status );
|
---|
566 | vvd ( palDt ( 1400 ), 408, 1e-11, "palDt",
|
---|
567 | "1400", status );
|
---|
568 | vvd ( palDt ( 1950 ), 27.99145626, 1e-12, "palDt",
|
---|
569 | "1950", status );
|
---|
570 | }
|
---|
571 |
|
---|
572 | /* Dates */
|
---|
573 |
|
---|
574 | static void t_djcal( int *status ) {
|
---|
575 | const double djm = 50123.9999;
|
---|
576 | int iy, im, id;
|
---|
577 | int iydmf[4];
|
---|
578 | int j;
|
---|
579 | double f;
|
---|
580 |
|
---|
581 | palDjcal ( 4, djm, iydmf, &j );
|
---|
582 | viv ( iydmf[0], 1996, "palDjcal", "Y", status );
|
---|
583 | viv ( iydmf[1], 2, "palDjcal", "M", status );
|
---|
584 | viv ( iydmf[2], 10, "palDjcal", "D", status );
|
---|
585 | viv ( iydmf[3], 9999, "palDjcal", "F", status );
|
---|
586 | viv ( j, 0, "palDjcal", "J", status );
|
---|
587 |
|
---|
588 | palDjcl ( djm, &iy, &im, &id, &f, &j );
|
---|
589 | viv ( iy, 1996, "palDjcl", "Y", status );
|
---|
590 | viv ( im, 2, "palDjcl", "M", status );
|
---|
591 | viv ( id, 10, "palDjcl", "D", status );
|
---|
592 | vvd ( f, 0.9999, 1e-7, "palDjcl", "F", status );
|
---|
593 | viv ( j, 0, "palDjcl", "J", status );
|
---|
594 |
|
---|
595 | }
|
---|
596 |
|
---|
597 | /* Matrix inversion */
|
---|
598 |
|
---|
599 | static void t_dmat( int *status ) {
|
---|
600 | int j;
|
---|
601 | int iw[3];
|
---|
602 | double dd;
|
---|
603 | double da[9] = {
|
---|
604 | 2.22, 1.6578, 1.380522,
|
---|
605 | 1.6578, 1.380522, 1.22548578,
|
---|
606 | 1.380522, 1.22548578, 1.1356276122
|
---|
607 | };
|
---|
608 | double dv[3] = {
|
---|
609 | 2.28625, 1.7128825, 1.429432225
|
---|
610 | };
|
---|
611 |
|
---|
612 | palDmat( 3, da, dv, &dd, &j, iw );
|
---|
613 | vvd ( da[0], 18.02550629769198,
|
---|
614 | 1e-10, "palDmat", "a[0]", status );
|
---|
615 | vvd ( da[1], -52.16386644917280607,
|
---|
616 | 1e-10, "palDmat", "a[1]", status );
|
---|
617 | vvd ( da[2], 34.37875949717850495,
|
---|
618 | 1e-10, "palDmat", "a[2]", status );
|
---|
619 | vvd ( da[3], -52.16386644917280607,
|
---|
620 | 1e-10, "palDmat", "a[3]", status );
|
---|
621 | vvd ( da[4], 168.1778099099805627,
|
---|
622 | 1e-10, "palDmat", "a[4]", status );
|
---|
623 | vvd ( da[5], -118.0722869694232670,
|
---|
624 | 1e-10, "palDmat", "a[5]", status );
|
---|
625 | vvd ( da[6], 34.37875949717850495,
|
---|
626 | 1e-10, "palDmat", "a[6]", status );
|
---|
627 | vvd ( da[7], -118.0722869694232670,
|
---|
628 | 1e-10, "palDmat", "a[7]", status );
|
---|
629 | vvd ( da[8], 86.50307003740151262,
|
---|
630 | 1e-10, "palDmat", "a[8]", status );
|
---|
631 | vvd ( dv[0], 1.002346480763383,
|
---|
632 | 1e-12, "palDmat", "v[0]", status );
|
---|
633 | vvd ( dv[1], 0.03285594016974583489,
|
---|
634 | 1e-12, "palDmat", "v[1]", status );
|
---|
635 | vvd ( dv[2], 0.004760688414885247309,
|
---|
636 | 1e-12, "palDmat", "v[2]", status );
|
---|
637 | vvd ( dd, 0.003658344147359863,
|
---|
638 | 1e-12, "palDmat", "D", status );
|
---|
639 | viv ( j, 0, "palDmat", "J", status );
|
---|
640 |
|
---|
641 | }
|
---|
642 |
|
---|
643 | /* Test palDe2h and palDh2e routines */
|
---|
644 |
|
---|
645 | static void t_e2h( int *status ) {
|
---|
646 | double dh, dd, dp, da, de;
|
---|
647 |
|
---|
648 | dh = -0.3;
|
---|
649 | dd = -1.1;
|
---|
650 | dp = -0.7;
|
---|
651 |
|
---|
652 | palDe2h( dh, dd, dp, &da, &de );
|
---|
653 | vvd( da, 2.820087515852369, 1e-12, "palDe2h",
|
---|
654 | "AZ", status);
|
---|
655 | vvd( de, 1.132711866443304, 1e-12, "palDe2h",
|
---|
656 | "EL", status );
|
---|
657 |
|
---|
658 | palDh2e( da, de, dp, &dh, &dd );
|
---|
659 | vvd( dh, -0.3, 1e-12, "palDh2e", "HA", status);
|
---|
660 | vvd( dd, -1.1, 1e-12, "palDh2e", "DEC", status );
|
---|
661 |
|
---|
662 | }
|
---|
663 |
|
---|
664 | /* Epochs */
|
---|
665 |
|
---|
666 | static void t_epb( int *status ) {
|
---|
667 | vvd ( palEpb( 45123 ), 1982.419793168669, 1e-8,
|
---|
668 | "palEpb", " ", status );
|
---|
669 | }
|
---|
670 |
|
---|
671 | static void t_epb2d( int *status ) {
|
---|
672 | vvd ( palEpb2d( 1975.5 ), 42595.5995279655, 1e-7,
|
---|
673 | "palEpb2d", " ", status );
|
---|
674 | }
|
---|
675 |
|
---|
676 | static void t_epco( int *status ) {
|
---|
677 | vvd ( palEpco ( 'B', 'J', 2000 ), 2000.001277513665,
|
---|
678 | 1e-7, "palEpco", "BJ", status );
|
---|
679 | vvd ( palEpco ( 'J', 'B', 1950 ), 1949.999790442300,
|
---|
680 | 1e-7, "palEpco", "JB", status );
|
---|
681 | vvd ( palEpco ( 'J', 'j', 2000 ), 2000,
|
---|
682 | 1e-7, "palEpco", "JJ", status );
|
---|
683 | }
|
---|
684 |
|
---|
685 | static void t_epj( int *status ) {
|
---|
686 | vvd ( palEpj( 42999 ), 1976.603696098563,
|
---|
687 | 1e-7, "palEpj", " ", status );
|
---|
688 | }
|
---|
689 |
|
---|
690 | static void t_epj2d( int *status ) {
|
---|
691 | vvd ( palEpj2d( 2010.077 ), 55225.124250,
|
---|
692 | 1e-6, "palEpj2d", " ", status );
|
---|
693 | }
|
---|
694 |
|
---|
695 | /* Equation of the equinoxes */
|
---|
696 |
|
---|
697 | /* Use SOFA/ERFA test because of change in precession model */
|
---|
698 | static void t_eqeqx (int *status ) {
|
---|
699 | vvd ( palEqeqx( 53736. ), -0.8834195072043790156e-5,
|
---|
700 | 1e-15, "palEqeqx", " ", status );
|
---|
701 | }
|
---|
702 |
|
---|
703 | /* E-terms */
|
---|
704 |
|
---|
705 | static void t_etrms( int * status ) {
|
---|
706 | double ev[3];
|
---|
707 |
|
---|
708 | palEtrms ( 1976.9, ev );
|
---|
709 |
|
---|
710 | vvd ( ev[0], -1.621617102537041e-6, 1e-18, "palEtrms",
|
---|
711 | "X", status );
|
---|
712 | vvd ( ev[1], -3.310070088507914e-7, 1e-18, "palEtrms",
|
---|
713 | "Y", status );
|
---|
714 | vvd ( ev[2], -1.435296627515719e-7, 1e-18, "palEtrms",
|
---|
715 | "Z", status );
|
---|
716 | }
|
---|
717 |
|
---|
718 | /* J2000 to Galactic */
|
---|
719 |
|
---|
720 | static void t_eqgal( int *status ) {
|
---|
721 | double dl, db;
|
---|
722 |
|
---|
723 | palEqgal ( 5.67, -1.23, &dl, &db );
|
---|
724 |
|
---|
725 | vvd ( dl, 5.612270780904526, 1e-12, "palEqgal",
|
---|
726 | "DL", status );
|
---|
727 | vvd ( db, -0.6800521449061520, 1e-12, "palEqgal",
|
---|
728 | "DB", status );
|
---|
729 | }
|
---|
730 |
|
---|
731 | /* Galactic to J2000 equatorial */
|
---|
732 |
|
---|
733 | static void t_galeq( int *status ) {
|
---|
734 | double dr, dd;
|
---|
735 |
|
---|
736 | palGaleq ( 5.67, -1.23, &dr, &dd );
|
---|
737 |
|
---|
738 | vvd ( dr, 0.04729270418071426, 1e-12, "palGaleq",
|
---|
739 | "DR", status );
|
---|
740 | vvd ( dd, -0.7834003666745548, 1e-12, "palGaleq",
|
---|
741 | "DD", status );
|
---|
742 | }
|
---|
743 |
|
---|
744 | /* Galactic to supergalactic */
|
---|
745 | static void t_galsup(int *status ) {
|
---|
746 | double dsl, dsb;
|
---|
747 |
|
---|
748 | palGalsup ( 6.1, -1.4, &dsl, &dsb );
|
---|
749 |
|
---|
750 | vvd ( dsl, 4.567933268859171, 1e-12, "palGalsup",
|
---|
751 | "DSL", status );
|
---|
752 | vvd ( dsb, -0.01862369899731829, 1e-12, "palGalsup",
|
---|
753 | "DSB", status );
|
---|
754 | }
|
---|
755 |
|
---|
756 | /* Geocentric coordinates */
|
---|
757 |
|
---|
758 | /* This is not from sla_test.f */
|
---|
759 |
|
---|
760 | static void t_geoc( int *status ) {
|
---|
761 | double r;
|
---|
762 | double z;
|
---|
763 | /* JCMT */
|
---|
764 | const double lat = 19.822838905884 * PAL__DD2R;
|
---|
765 | const double alt = 4120.0;
|
---|
766 | palGeoc( lat, alt, &r, &z );
|
---|
767 |
|
---|
768 | /* Note the lower tolerance than normal since the models in SLA
|
---|
769 | differ from the more up to date model in SOFA/ERFA */
|
---|
770 | vvd( r, 4.01502667039618e-05, 1e-10, "palGeoc", "R", status );
|
---|
771 | vvd( z, 1.43762411970295e-05, 1e-10, "palGeoc", "Z", status );
|
---|
772 |
|
---|
773 | }
|
---|
774 |
|
---|
775 | /* Galactic to Fk4 */
|
---|
776 |
|
---|
777 | static void t_ge50 ( int *status ) {
|
---|
778 | double dr, dd;
|
---|
779 | palGe50( 6.1, -1.55, &dr, &dd );
|
---|
780 | vvd ( dr, 0.1966825219934508, 1e-12, "palGe50",
|
---|
781 | "DR", status );
|
---|
782 | vvd ( dd, -0.4924752701678960, 1e-12, "palGe50",
|
---|
783 | "DD", status );
|
---|
784 |
|
---|
785 |
|
---|
786 | }
|
---|
787 |
|
---|
788 | /* GMST */
|
---|
789 |
|
---|
790 | /* We use the SOFA/ERFA test values rather than the values from SLA
|
---|
791 | because the precession models have changed */
|
---|
792 |
|
---|
793 | static void t_gmst( int *status ) {
|
---|
794 | vvd ( palGmst( 53736. ), 1.754174971870091203,
|
---|
795 | 1e-12, "palGmst", " ", status );
|
---|
796 |
|
---|
797 | vvd ( palGmsta( 53736., 0.0 ), 1.754174971870091203,
|
---|
798 | 1e-12, "palGmsta", " ", status );
|
---|
799 | }
|
---|
800 |
|
---|
801 | /* FK5 */
|
---|
802 |
|
---|
803 | static void t_fk52h ( int *status ) {
|
---|
804 | double r5, d5, dr5, dd5, rh, dh;
|
---|
805 |
|
---|
806 | palFk5hz ( 1.234, -0.987, 1980, &rh, &dh );
|
---|
807 | vvd ( rh, 1.234000136713611301, 1e-13, "palFk5hz",
|
---|
808 | "R", status );
|
---|
809 | vvd ( dh, -0.9869999702020807601, 1e-13, "palFk5hz",
|
---|
810 | "D", status );
|
---|
811 | palHfk5z ( rh, dh, 1980, &r5, &d5, &dr5, &dd5 );
|
---|
812 | vvd ( r5, 1.234, 1e-13, "palHfk5z", "R", status );
|
---|
813 | vvd ( d5, -0.987, 1e-13, "palHfk5z", "D", status );
|
---|
814 | vvd ( dr5, 0.000000006822074, 1e-13, "palHfk5z",
|
---|
815 | "DR", status );
|
---|
816 | vvd ( dd5, -0.000000002334012, 1e-13, "palHfk5z",
|
---|
817 | "DD", status );
|
---|
818 |
|
---|
819 | }
|
---|
820 |
|
---|
821 | static void t_intin( int *status ) {
|
---|
822 | const char s[] = " -12345, , -0 2000 + ";
|
---|
823 | /* 1234567890123456789012345678 */
|
---|
824 | int i = 1;
|
---|
825 | long n = 0;
|
---|
826 | int j;
|
---|
827 |
|
---|
828 | palIntin ( s, &i, &n, &j );
|
---|
829 | viv ( i, 10, "palIntin", "I1", status );
|
---|
830 | viv ( n, -12345, "palIntin", "V1", status );
|
---|
831 | viv ( j, -1, "palIntin", "J1", status );
|
---|
832 |
|
---|
833 | palIntin ( s, &i, &n, &j );
|
---|
834 | viv ( i, 12, "palIntin", "I2", status );
|
---|
835 | viv ( n, -12345, "palIntin", "V2", status );
|
---|
836 | viv ( j, 1, "palIntin", "J2", status );
|
---|
837 |
|
---|
838 | palIntin ( s, &i, &n, &j );
|
---|
839 | viv ( i, 17, "palIntin", "I3", status );
|
---|
840 | viv ( n, 0, "palIntin", "V3", status );
|
---|
841 | viv ( j, -1, "palIntin", "J3", status );
|
---|
842 |
|
---|
843 | palIntin ( s, &i, &n, &j );
|
---|
844 | viv ( i, 23, "palIntin", "I4", status );
|
---|
845 | viv ( n, 2000, "palIntin", "V4", status );
|
---|
846 | viv ( j, 0, "palIntin", "J4", status );
|
---|
847 |
|
---|
848 | palIntin ( s, &i, &n, &j );
|
---|
849 | viv ( i, 29, "palIntin", "I5", status );
|
---|
850 | viv ( n, 2000, "palIntin", "V5", status );
|
---|
851 | viv ( j, 1, "palIntin", "J5", status ); /* Note that strtol does not care about a + */
|
---|
852 |
|
---|
853 | }
|
---|
854 |
|
---|
855 |
|
---|
856 | /* Moon */
|
---|
857 |
|
---|
858 | static void t_moon ( int *status ) {
|
---|
859 | double pv[6];
|
---|
860 |
|
---|
861 | double expected1[] = {
|
---|
862 | 0.00229161514616454,
|
---|
863 | 0.000973912029208393,
|
---|
864 | 0.000669931538978146,
|
---|
865 | -3.44709700068209e-09,
|
---|
866 | 5.44477533462392e-09,
|
---|
867 | 2.11785724844417e-09
|
---|
868 | };
|
---|
869 |
|
---|
870 | /* SLA test only include slaMoon so we use the
|
---|
871 | example from SUN/67 */
|
---|
872 | palDmoon( 48634.4687174074, pv );
|
---|
873 | vvec( 6, pv, expected1, "palDmoon", status );
|
---|
874 | }
|
---|
875 |
|
---|
876 | /* Nutation */
|
---|
877 |
|
---|
878 | static void t_nut( int *status ) {
|
---|
879 | double dpsi, deps, eps0;
|
---|
880 |
|
---|
881 | double expected[3][3] = {
|
---|
882 | { 9.999999969492166e-1, 7.166577986249302e-5, 3.107382973077677e-5 },
|
---|
883 | { -7.166503970900504e-5, 9.999999971483732e-1, -2.381965032461830e-5 },
|
---|
884 | { -3.107553669598237e-5, 2.381742334472628e-5, 9.999999992335206818e-1 }
|
---|
885 | };
|
---|
886 |
|
---|
887 | double rmatn[3][3];
|
---|
888 |
|
---|
889 | /* SLA tests with low precision */
|
---|
890 | palNut( 46012.32, rmatn );
|
---|
891 | vrmat( rmatn, expected, "palNut", 1.0e-3, status );
|
---|
892 |
|
---|
893 | /* Use the SOFA/ERFA tests */
|
---|
894 | palNutc( 54388.0, &dpsi, &deps, &eps0 );
|
---|
895 | vvd( eps0, 0.4090749229387258204, 1e-14,
|
---|
896 | "palNutc", "eps0", status);
|
---|
897 |
|
---|
898 | palNutc( 53736.0, &dpsi, &deps, &eps0 );
|
---|
899 | vvd(dpsi, -0.9630912025820308797e-5, 1e-13,
|
---|
900 | "palNutc", "dpsi", status);
|
---|
901 | vvd(deps, 0.4063238496887249798e-4, 1e-13,
|
---|
902 | "palNutc", "deps", status);
|
---|
903 | }
|
---|
904 |
|
---|
905 | /* palPrebn */
|
---|
906 |
|
---|
907 | static void t_prebn( int *status ) {
|
---|
908 | double rmatp[3][3];
|
---|
909 | double prebn_expected[3][3] = {
|
---|
910 | { 9.999257613786738e-1, -1.117444640880939e-2, -4.858341150654265e-3 },
|
---|
911 | { 1.117444639746558e-2, 9.999375635561940e-1, -2.714797892626396e-5 },
|
---|
912 | { 4.858341176745641e-3, -2.714330927085065e-5, 9.999881978224798e-1 },
|
---|
913 | };
|
---|
914 |
|
---|
915 | palPrebn ( 1925., 1975., rmatp );
|
---|
916 | vrmat( rmatp, prebn_expected, "palPrebn", 1.0e-12, status );
|
---|
917 | }
|
---|
918 |
|
---|
919 | /* Range */
|
---|
920 |
|
---|
921 | static void t_range( int *status ) {
|
---|
922 | vvd ( palDrange ( -4 ), 2.283185307179586,
|
---|
923 | 1e-12, "palDrange", " ", status );
|
---|
924 | }
|
---|
925 |
|
---|
926 | static void t_ranorm( int *status ) {
|
---|
927 | vvd ( palDranrm ( -0.1 ), 6.183185307179587,
|
---|
928 | 1e-12, "palDranrm", "2", status );
|
---|
929 | }
|
---|
930 |
|
---|
931 | /* Separation routines */
|
---|
932 |
|
---|
933 | static void t_sep( int *status ) {
|
---|
934 | double d1[3] = { 1.0, 0.1, 0.2 };
|
---|
935 | double d2[3] = { -3.0, 1e-3, 0.2 };
|
---|
936 | double ad1, bd1, ad2, bd2;
|
---|
937 |
|
---|
938 | palDcc2s( d1, &ad1, &bd1 );
|
---|
939 | palDcc2s( d2, &ad2, &bd2 );
|
---|
940 |
|
---|
941 | vvd ( palDsep ( ad1, bd1, ad2, bd2 ),
|
---|
942 | 2.8603919190246608, 1e-7, "palDsep", " ", status );
|
---|
943 | vvd ( palDsepv ( d1, d2 ),
|
---|
944 | 2.8603919190246608, 1e-7, "palDsepv", " ", status );
|
---|
945 |
|
---|
946 | }
|
---|
947 |
|
---|
948 | /* Supergalactic */
|
---|
949 |
|
---|
950 | static void t_supgal( int *status ) {
|
---|
951 | double dl, db;
|
---|
952 |
|
---|
953 | palSupgal ( 6.1, -1.4, &dl, &db );
|
---|
954 |
|
---|
955 | vvd ( dl, 3.798775860769474, 1e-12, "palSupgal",
|
---|
956 | "DL", status );
|
---|
957 | vvd ( db, -0.1397070490669407, 1e-12, "palSupgal",
|
---|
958 | "DB", status );
|
---|
959 |
|
---|
960 | }
|
---|
961 |
|
---|
962 | /* Test spherical tangent-plane-projection routines */
|
---|
963 | static void t_tp( int *status ) {
|
---|
964 |
|
---|
965 | int j;
|
---|
966 | double dr0, dd0, dr1, dd1, dx, dy, dr2, dd2, dr01,
|
---|
967 | dd01, dr02, dd02;
|
---|
968 |
|
---|
969 | dr0 = 3.1;
|
---|
970 | dd0 = -0.9;
|
---|
971 | dr1 = dr0 + 0.2;
|
---|
972 | dd1 = dd0 - 0.1;
|
---|
973 | palDs2tp( dr1, dd1, dr0, dd0, &dx, &dy, &j );
|
---|
974 | vvd( dx, 0.1086112301590404, 1e-12, "palDs2tp",
|
---|
975 | "x", status );
|
---|
976 | vvd( dy, -0.1095506200711452, 1e-12, "palDs2tp",
|
---|
977 | "y", status );
|
---|
978 | viv( j, 0, "palDs2tp", "j", status );
|
---|
979 |
|
---|
980 | palDtp2s( dx, dy, dr0, dd0, &dr2, &dd2 );
|
---|
981 | vvd( dr2 - dr1, 0., 1e-12, "palDtp2s", "r", status );
|
---|
982 | vvd( dd2 - dd1, 0., 1e-12, "palDtp2s", "d", status );
|
---|
983 |
|
---|
984 | palDtps2c( dx, dy, dr2, dd2, &dr01, &dd01, &dr02, &dd02, &j );
|
---|
985 | vvd( dr01, 3.1, 1e-12, "palDtps2c", "r1", status);
|
---|
986 | vvd( dd01, -0.9, 1e-12, "palDtps2c", "d1", status);
|
---|
987 | vvd( dr02, 0.3584073464102072, 1e-12, "palDtps2c",
|
---|
988 | "r2", status);
|
---|
989 | vvd( dd02, -2.023361658234722, 1e-12, "palDtps2c",
|
---|
990 | "d2", status );
|
---|
991 | viv( j, 1, "palDtps2c", "n", status );
|
---|
992 |
|
---|
993 | }
|
---|
994 |
|
---|
995 | /* Test all the 3-vector and 3x3 matrix routines. */
|
---|
996 |
|
---|
997 | static void t_vecmat( int * status ) {
|
---|
998 | int i;
|
---|
999 |
|
---|
1000 | /* palDav2m */
|
---|
1001 | double drm1[3][3];
|
---|
1002 | double dav[3] = { -0.123, 0.0987, 0.0654 };
|
---|
1003 | double dav2m_expected[3][3] = {
|
---|
1004 | { 0.9930075842721269, 0.05902743090199868, -0.1022335560329612 },
|
---|
1005 | { -0.07113807138648245, 0.9903204657727545, -0.1191836812279541 },
|
---|
1006 | { 0.09420887631983825, 0.1256229973879967, 0.9875948309655174 },
|
---|
1007 | };
|
---|
1008 |
|
---|
1009 | /* palDeuler */
|
---|
1010 | double drm2[3][3];
|
---|
1011 | double deuler_expected[3][3] = {
|
---|
1012 | { -0.1681574770810878, 0.1981362273264315, 0.9656423242187410 },
|
---|
1013 | { -0.2285369373983370, 0.9450659587140423, -0.2337117924378156 },
|
---|
1014 | { -0.9589024617479674, -0.2599853247796050, -0.1136384607117296 } };
|
---|
1015 |
|
---|
1016 | /* palDmxm */
|
---|
1017 | double drm[3][3];
|
---|
1018 | double dmxm_expected[3][3] = {
|
---|
1019 | { -0.09010460088585805, 0.3075993402463796, 0.9472400998581048 },
|
---|
1020 | { -0.3161868071070688, 0.8930686362478707, -0.3200848543149236 },
|
---|
1021 | { -0.9444083141897035, -0.3283459407855694, 0.01678926022795169 },
|
---|
1022 | };
|
---|
1023 |
|
---|
1024 | /* palDcs2c et al */
|
---|
1025 | double dv1[3];
|
---|
1026 | double dv2[3];
|
---|
1027 | double dv3[3];
|
---|
1028 | double dv4[3];
|
---|
1029 | double dv5[3];
|
---|
1030 | double dv6[3];
|
---|
1031 | double dv7[3];
|
---|
1032 | double dvm;
|
---|
1033 |
|
---|
1034 | /* palDav2m */
|
---|
1035 | palDav2m( dav, drm1 );
|
---|
1036 | vrmat( drm1, dav2m_expected, "palDav2m", 1.0e-12, status );
|
---|
1037 |
|
---|
1038 | /* Test palDeuler */
|
---|
1039 | palDeuler( "YZY", 2.345, -0.333, 2.222, drm2 );
|
---|
1040 | vrmat( drm2, deuler_expected, "palDeuler", 1.0e-12, status );
|
---|
1041 |
|
---|
1042 | /* palDmxm */
|
---|
1043 | palDmxm( drm2, drm1, drm );
|
---|
1044 | vrmat( drm, dmxm_expected, "palDmxm", 1.0e-12, status );
|
---|
1045 |
|
---|
1046 | /* palDcs2c */
|
---|
1047 | palDcs2c( 3.0123, -0.999, dv1 );
|
---|
1048 | vvd ( dv1[0], -0.5366267667260525, 1e-12,
|
---|
1049 | "palDcs2c", "x", status );
|
---|
1050 | vvd ( dv1[1], 0.06977111097651444, 1e-12,
|
---|
1051 | "palDcs2c", "y", status );
|
---|
1052 | vvd ( dv1[2], -0.8409302618566215, 1e-12,
|
---|
1053 | "palDcs2c", "z", status );
|
---|
1054 |
|
---|
1055 | /* palDmxv */
|
---|
1056 | palDmxv( drm1, dv1, dv2 );
|
---|
1057 | palDmxv( drm2, dv2, dv3 );
|
---|
1058 | vvd ( dv3[0], -0.7267487768696160, 1e-12,
|
---|
1059 | "palDmxv", "x", status );
|
---|
1060 | vvd ( dv3[1], 0.5011537352639822, 1e-12,
|
---|
1061 | "palDmxv", "y", status );
|
---|
1062 | vvd ( dv3[2], 0.4697671220397141, 1e-12,
|
---|
1063 | "palDmxv", "z", status );
|
---|
1064 |
|
---|
1065 | /* palDimxv */
|
---|
1066 | palDimxv( drm, dv3, dv4 );
|
---|
1067 | vvd ( dv4[0], -0.5366267667260526, 1e-12,
|
---|
1068 | "palDimxv", "X", status );
|
---|
1069 | vvd ( dv4[1], 0.06977111097651445, 1e-12,
|
---|
1070 | "palDimxv", "Y", status );
|
---|
1071 | vvd ( dv4[2], -0.8409302618566215, 1e-12,
|
---|
1072 | "palDimxv", "Z", status );
|
---|
1073 |
|
---|
1074 | /* palDm2av */
|
---|
1075 | palDm2av( drm, dv5 );
|
---|
1076 | vvd ( dv5[0], 0.006889040510209034, 1e-12,
|
---|
1077 | "palDm2av", "X", status );
|
---|
1078 | vvd ( dv5[1], -1.577473205461961, 1e-12,
|
---|
1079 | "palDm2av", "Y", status );
|
---|
1080 | vvd ( dv5[2], 0.5201843672856759, 1e-12,
|
---|
1081 | "palDm2av", "Z", status );
|
---|
1082 |
|
---|
1083 | for (i=0; i<3; i++) {
|
---|
1084 | dv5[i] *= 1000.0;
|
---|
1085 | }
|
---|
1086 |
|
---|
1087 | /* palDvn */
|
---|
1088 | palDvn( dv5, dv6, &dvm );
|
---|
1089 | vvd ( dv6[0], 0.004147420704640065, 1e-12,
|
---|
1090 | "palDvn", "X", status );
|
---|
1091 | vvd ( dv6[1], -0.9496888606842218, 1e-12,
|
---|
1092 | "palDvn", "Y", status );
|
---|
1093 | vvd ( dv6[2], 0.3131674740355448, 1e-12,
|
---|
1094 | "palDvn", "Z", status );
|
---|
1095 | vvd ( dvm, 1661.042127339937, 1e-9, "palDvn",
|
---|
1096 | "M", status );
|
---|
1097 |
|
---|
1098 | vvd ( palDvdv ( dv6, dv1 ), -0.3318384698006295,
|
---|
1099 | 1e-12, "palDvn", " ", status );
|
---|
1100 |
|
---|
1101 | /* palDvxv */
|
---|
1102 | palDvxv( dv6, dv1, dv7 );
|
---|
1103 | vvd ( dv7[0], 0.7767720597123304, 1e-12,
|
---|
1104 | "palDvxv", "X", status );
|
---|
1105 | vvd ( dv7[1], -0.1645663574562769, 1e-12,
|
---|
1106 | "palDvxv", "Y", status );
|
---|
1107 | vvd ( dv7[2], -0.5093390925544726, 1e-12,
|
---|
1108 | "palDvxv", "Z", status );
|
---|
1109 |
|
---|
1110 | }
|
---|
1111 |
|
---|
1112 | static void t_ecleq( int *status ) {
|
---|
1113 | double dr;
|
---|
1114 | double dd;
|
---|
1115 | palEcleq( 1.234, -0.123, 43210.0, &dr, &dd );
|
---|
1116 | vvd( dr, 1.229910118208851, 1e-5, "palEcleq",
|
---|
1117 | "RA", status );
|
---|
1118 | vvd( dd, 0.2638461400411088, 1e-5, "palEcleq",
|
---|
1119 | "Dec", status );
|
---|
1120 | }
|
---|
1121 |
|
---|
1122 | static void t_ecmat( int *status ) {
|
---|
1123 | double rmat[3][3];
|
---|
1124 | double expected[3][3] = {
|
---|
1125 | { 1.0, 0.0, 0.0 },
|
---|
1126 | { 0.0, 0.91749307789883549624, 0.3977517467060596168 },
|
---|
1127 | { 0.0, -0.3977517467060596168, 0.91749307789883549624 } };
|
---|
1128 |
|
---|
1129 | palEcmat( 55966.46, rmat );
|
---|
1130 | vrmat( rmat, expected, "palEcmat", 1.0e-12, status );
|
---|
1131 | }
|
---|
1132 |
|
---|
1133 | static void t_eqecl ( int *status ) {
|
---|
1134 | double dl, db;
|
---|
1135 | palEqecl ( 0.789, -0.123, 46555, &dl, &db );
|
---|
1136 |
|
---|
1137 | /* Slight changes from SLA for 2006 precession/nutation */
|
---|
1138 | vvd ( dl, 0.7036566430349022, 1e-6, "palEqecl",
|
---|
1139 | "L", status );
|
---|
1140 | vvd ( db, -0.4036047164116848, 1e-6, "palEqecl",
|
---|
1141 | "B", status );
|
---|
1142 | }
|
---|
1143 |
|
---|
1144 | static void t_prec( int *status ) {
|
---|
1145 | double rmat[3][3];
|
---|
1146 | double expected[3][3] = {
|
---|
1147 | { 0.9999856154510, -0.0049192906204, -0.0021376320580 },
|
---|
1148 | { 0.0049192906805, 0.9999879002027, -5.2297405698747e-06 },
|
---|
1149 | { 0.0021376319197, -5.2859681191735e-06, 0.9999977152483 } };
|
---|
1150 |
|
---|
1151 | palPrec( 1990.0, 2012.0, rmat );
|
---|
1152 | vrmat( rmat, expected, "palPrec", 1.0e-12, status );
|
---|
1153 | }
|
---|
1154 |
|
---|
1155 | static void t_preces( int *status ) {
|
---|
1156 | double ra;
|
---|
1157 | double dc;
|
---|
1158 | ra = 6.28;
|
---|
1159 | dc = -1.123;
|
---|
1160 | palPreces ( "FK4", 1925, 1950, &ra, &dc );
|
---|
1161 | vvd ( ra, 0.002403604864728447, 1e-12, "palPreces",
|
---|
1162 | "R", status );
|
---|
1163 | vvd ( dc, -1.120570643322045, 1e-12, "palPreces",
|
---|
1164 | "D", status );
|
---|
1165 |
|
---|
1166 | /* This is the SLA test but PAL now uses the IAU 2006
|
---|
1167 | precession model so we need to loosen the comparison */
|
---|
1168 | ra = 0.0123;
|
---|
1169 | dc = 1.0987;
|
---|
1170 | palPreces ( "FK5", 2050, 1990, &ra, &dc );
|
---|
1171 | vvd ( ra, 6.282003602708382, 1e-6, "palPreces",
|
---|
1172 | "R", status );
|
---|
1173 | vvd ( dc, 1.092870326188383, 1e-6, "palPreces",
|
---|
1174 | "D", status );
|
---|
1175 |
|
---|
1176 | }
|
---|
1177 |
|
---|
1178 | static void t_evp( int *status ) {
|
---|
1179 | double dvb[3],dpb[3],dvh[3],dph[3];
|
---|
1180 | double vbex[3] = { 1.6957348127008098514e-07,
|
---|
1181 | -9.1093446116039685966e-08,
|
---|
1182 | -3.9528532243991863036e-08 };
|
---|
1183 | double pbex[3] = {-0.49771075259730546136,
|
---|
1184 | -0.80273812396332311359,
|
---|
1185 | -0.34851593942866060383 };
|
---|
1186 | double vhex[3] = { 1.6964379181455713805e-07,
|
---|
1187 | -9.1147224045727438391e-08,
|
---|
1188 | -3.9553158272334222497e-08 };
|
---|
1189 | double phex[3] = { -0.50169124421419830639,
|
---|
1190 | -0.80650980174901798492,
|
---|
1191 | -0.34997162028527262212 };
|
---|
1192 |
|
---|
1193 | double vbex2[3] = {
|
---|
1194 | -0.0109187426811683,
|
---|
1195 | -0.0124652546173285,
|
---|
1196 | -0.0054047731809662
|
---|
1197 | };
|
---|
1198 | double pbex2[3] = {
|
---|
1199 | -0.7714104440491060,
|
---|
1200 | +0.5598412061824225,
|
---|
1201 | +0.2425996277722475
|
---|
1202 | };
|
---|
1203 | double vhex2[3] = {
|
---|
1204 | -0.0109189182414732,
|
---|
1205 | -0.0124718726844084,
|
---|
1206 | -0.0054075694180650
|
---|
1207 | };
|
---|
1208 | double phex2[3] = {
|
---|
1209 | -0.7757238809297653,
|
---|
1210 | +0.5598052241363390,
|
---|
1211 | +0.2426998466481708
|
---|
1212 | };
|
---|
1213 |
|
---|
1214 | palEvp( 2010.0, 2012.0, dvb, dpb, dvh, dph );
|
---|
1215 |
|
---|
1216 | vvec( 3, dvb, vbex, "palEvp", status );
|
---|
1217 | vvec( 3, dpb, pbex, "palEvp", status );
|
---|
1218 | vvec( 3, dvh, vhex, "palEvp", status );
|
---|
1219 | vvec( 3, dph, phex, "palEvp", status );
|
---|
1220 |
|
---|
1221 | palEpv ( 53411.52501161, dph, dvh, dpb, dvb );
|
---|
1222 |
|
---|
1223 | vvec( 3, dvb, vbex2, "palEpv", status );
|
---|
1224 | vvec( 3, dpb, pbex2, "palEpv", status );
|
---|
1225 | vvec( 3, dvh, vhex2, "palEpv", status );
|
---|
1226 | vvec( 3, dph, phex2, "palEpv", status );
|
---|
1227 |
|
---|
1228 | }
|
---|
1229 |
|
---|
1230 | static void t_map( int *status ) {
|
---|
1231 | double ra, da;
|
---|
1232 | palMap ( 6.123, -0.999, 1.23e-5, -0.987e-5,
|
---|
1233 | 0.123, 32.1, 1999, 43210.9, &ra, &da );
|
---|
1234 |
|
---|
1235 | /* These are the SLA tests but and they agree to 0.1 arcsec
|
---|
1236 | with PAL/SOFA/ERFA. We expect a slight difference from the change
|
---|
1237 | to nutation models. */
|
---|
1238 | vvd ( ra, 6.117130429775647, 1e-6, "palMap",
|
---|
1239 | "RA", status );
|
---|
1240 | vvd ( da, -1.000880769038632, 1e-8, "palMap",
|
---|
1241 | "DA", status );
|
---|
1242 | }
|
---|
1243 |
|
---|
1244 | static void t_mappa( int *status ) {
|
---|
1245 | double amprms[21];
|
---|
1246 | double expected[21] = {1.9986310746064646082,
|
---|
1247 | -0.1728200754134739392,
|
---|
1248 | 0.88745394651412767839,
|
---|
1249 | 0.38472374350184274094,
|
---|
1250 | -0.17245634725219796679,
|
---|
1251 | 0.90374808622520386159,
|
---|
1252 | 0.3917884696321610738,
|
---|
1253 | 2.0075929387510784968e-08,
|
---|
1254 | -9.9464149073251757597e-05,
|
---|
1255 | -1.6125306981057062306e-05,
|
---|
1256 | -6.9897255793245634435e-06,
|
---|
1257 | 0.99999999489900059935,
|
---|
1258 | 0.99999983777998024959,
|
---|
1259 | -0.00052248206600935195865,
|
---|
1260 | -0.00022683144398381763045,
|
---|
1261 | 0.00052248547063364874764,
|
---|
1262 | 0.99999986339269864022,
|
---|
1263 | 1.4950491424992534218e-05,
|
---|
1264 | 0.00022682360163333854623,
|
---|
1265 | -1.5069005133483779417e-05,
|
---|
1266 | 0.99999997416198904698};
|
---|
1267 |
|
---|
1268 | palMappa( 2010.0, 55927.0, amprms );
|
---|
1269 | vvec( 21, amprms, expected, "palMappa", status );
|
---|
1270 | }
|
---|
1271 |
|
---|
1272 | static void t_mapqkz( int *status ) {
|
---|
1273 | double amprms[21], ra, da;
|
---|
1274 | palMappa( 2010.0, 55927.0, amprms );
|
---|
1275 | palMapqkz( 1.234, -0.567, amprms, &ra, &da );
|
---|
1276 | vvd( ra, 1.2344879748414849807, 1.0E-12, "palMapqkz", "ra", status );
|
---|
1277 | vvd( da, -0.56697099554368701746, 1.0E-12, "palMapqkz", "da", status );
|
---|
1278 |
|
---|
1279 | /* Try the same with palMapqk and zero parallax and proper motion */
|
---|
1280 | palMapqk( 1.234, -0.567, 0., 0., 0., 0., amprms, &ra, &da );
|
---|
1281 | vvd( ra, 1.2344879748414849807, 1.0E-7, "palMapqkz", "ra", status );
|
---|
1282 | vvd( da, -0.56697099554368701746, 1.0E-7, "palMapqkz", "da", status );
|
---|
1283 |
|
---|
1284 | }
|
---|
1285 |
|
---|
1286 | static void t_ampqk( int *status ) {
|
---|
1287 | double amprms[21], rm, dm;
|
---|
1288 | palMappa( 2010.0, 55927.0, amprms );
|
---|
1289 | palAmpqk( 1.234, -0.567, amprms, &rm, &dm );
|
---|
1290 | vvd( rm, 1.2335120411026936349, 1.0E-12, "palAmpqk", "rm", status );
|
---|
1291 | vvd( dm, -0.56702908706930343907, 1.0E-12, "palAmpqk", "dm", status );
|
---|
1292 | }
|
---|
1293 |
|
---|
1294 | static void t_fk45z( int *status ) {
|
---|
1295 | double r2000, d2000;
|
---|
1296 | palFk45z( 1.2, -0.3, 1960.0, &r2000, &d2000 );
|
---|
1297 | vvd( r2000, 1.2097812228966762227, 1.0E-12, "palFk45z", "r2000", status );
|
---|
1298 | vvd( d2000, -0.29826111711331398935, 1.0E-12, "palFk45z", "d2000", status );
|
---|
1299 | }
|
---|
1300 |
|
---|
1301 | static void t_fk54z( int *status ) {
|
---|
1302 | double r1950, d1950, dr1950, dd1950;
|
---|
1303 | palFk54z( 1.2, -0.3, 1960.0, &r1950, &d1950, &dr1950, &dd1950 );
|
---|
1304 | vvd( r1950, 1.1902221805755279771, 1.0E-12, "palFk54z", "r1950", status );
|
---|
1305 | vvd( d1950, -0.30178317645793828472, 1.0E-12, "palFk54z", "d1950", status );
|
---|
1306 | vvd( dr1950, -1.7830874775952945507e-08, 1.0E-12, "palFk54z", "dr1950", status );
|
---|
1307 | vvd( dd1950, 7.196059425334821089e-09, 1.0E-12, "palFk54z", "dd1950", status );
|
---|
1308 | }
|
---|
1309 |
|
---|
1310 | static void t_fk524( int *status ) {
|
---|
1311 | double r1950, d1950, dr1950, dd1950, p1950, v1950;
|
---|
1312 | palFk524(4.567, -1.23, -3e-5, 8e-6, 0.29,
|
---|
1313 | -35.0, &r1950, &d1950, &dr1950, &dd1950, &p1950, &v1950);
|
---|
1314 | vvd(r1950, 4.543778603272084, 1e-12, "palFk524", "r", status);
|
---|
1315 | vvd(d1950, -1.229642790187574, 1e-12, "palFk524", "d", status);
|
---|
1316 | vvd(dr1950, -2.957873121769244e-5, 1e-17, "palFk524", "dr", status);
|
---|
1317 | vvd(dd1950, 8.117725309659079e-6, 1e-17, "palFk524", "dd", status);
|
---|
1318 | vvd(p1950, 0.2898494999992917, 1e-12, "palFk524", "p", status);
|
---|
1319 | vvd(v1950, -35.026862824252680, 1e-11, "palFk524", "v", status);
|
---|
1320 | }
|
---|
1321 |
|
---|
1322 | static void t_flotin( int * status ) {
|
---|
1323 |
|
---|
1324 | int j;
|
---|
1325 | const char * s = " 12.345, , -0 1E3-4 2000 E ";
|
---|
1326 | /* 123456789012345678901234567890123 */
|
---|
1327 | int i = 1;
|
---|
1328 | double dv = 0.0;
|
---|
1329 |
|
---|
1330 | palDfltin ( s, &i, &dv, &j );
|
---|
1331 | viv ( i, 10, "palDfltin", "I1", status );
|
---|
1332 | vvd ( dv, 12.345, 1e-12, "palDfltin", "V1", status );
|
---|
1333 | viv ( j, 0, "palDfltin", "J1", status );
|
---|
1334 |
|
---|
1335 | palDfltin ( s, &i, &dv, &j );
|
---|
1336 | viv ( i, 12, "palDfltin", "I2", status );
|
---|
1337 | vvd ( dv, 12.345, 1e-12, "palDfltin", "V2", status );
|
---|
1338 | viv ( j, 1, "palDfltin", "J2", status );
|
---|
1339 |
|
---|
1340 | palDfltin ( s, &i, &dv, &j );
|
---|
1341 | viv ( i, 16, "palDfltin", "I3", status );
|
---|
1342 | vvd ( dv, 0, 0, "palDfltin", "V3", status );
|
---|
1343 | viv ( j, -1, "palDfltin", "J3", status );
|
---|
1344 |
|
---|
1345 | palDfltin ( s, &i, &dv, &j );
|
---|
1346 | viv ( i, 19, "palDfltin", "I4", status );
|
---|
1347 | vvd ( dv, 1000, 0, "palDfltin", "V4", status );
|
---|
1348 | viv ( j, 0, "palDfltin", "J4", status );
|
---|
1349 |
|
---|
1350 | palDfltin ( s, &i, &dv, &j );
|
---|
1351 | viv ( i, 22, "palDfltin", "I5", status );
|
---|
1352 | vvd ( dv, -4, 0, "palDfltin", "V5", status );
|
---|
1353 | viv ( j, -1, "palDfltin", "J5", status );
|
---|
1354 |
|
---|
1355 | palDfltin ( s, &i, &dv, &j );
|
---|
1356 | viv ( i, 28, "palDfltin", "I6", status );
|
---|
1357 | vvd ( dv, 2000, 0, "palDfltin", "V6", status );
|
---|
1358 | viv ( j, 0, "palDfltin", "J6", status );
|
---|
1359 |
|
---|
1360 | palDfltin ( s, &i, &dv, &j );
|
---|
1361 | viv ( i, 34, "palDfltin", "I7", status );
|
---|
1362 | vvd ( dv, 2000, 0, "palDfltin", "V7", status );
|
---|
1363 | viv ( j, 1, "palDfltin", "J7", status ); /* differs from slaDfltin */
|
---|
1364 |
|
---|
1365 | /* Now test overflow and underflow */
|
---|
1366 | i = 1;
|
---|
1367 | palDfltin( " 1D600 ", &i, &dv, &j );
|
---|
1368 | viv ( i, 8, "palDfltin", "I8", status );
|
---|
1369 | vvd ( dv, HUGE_VAL, 0, "palDfltin", "V8", status );
|
---|
1370 | viv ( j, 2, "palDfltin", "J8", status );
|
---|
1371 |
|
---|
1372 | }
|
---|
1373 |
|
---|
1374 | static void t_obs( int * status ) {
|
---|
1375 |
|
---|
1376 | char shortname[11];
|
---|
1377 | char longname[41];
|
---|
1378 | double w, p, h;
|
---|
1379 | int lstat;
|
---|
1380 |
|
---|
1381 | lstat = palObs( 0, "MMT", shortname, sizeof(shortname),
|
---|
1382 | longname, sizeof(longname), &w, &p, &h );
|
---|
1383 | vcs ( shortname, "MMT", "palObs", "1/C", status );
|
---|
1384 | vcs ( longname, "MMT 6.5m, Mt Hopkins", "palObs", "1/NAME",
|
---|
1385 | status );
|
---|
1386 | vvd ( w, 1.935300584055477, 1e-8, "palObs",
|
---|
1387 | "1/W", status );
|
---|
1388 | vvd ( p, 0.5530735081550342238, 1e-10, "palObs",
|
---|
1389 | "1/P", status );
|
---|
1390 | vvd ( h, 2608, 1e-10, "palObs",
|
---|
1391 | "1/H", status );
|
---|
1392 | viv( lstat, 0, "palObs", "retval", status );
|
---|
1393 |
|
---|
1394 | lstat = palObs ( 61, NULL, shortname, sizeof(shortname),
|
---|
1395 | longname, sizeof(longname), &w, &p, &h );
|
---|
1396 | vcs ( shortname, "KECK1", "palObs", "2/C", status );
|
---|
1397 | vcs ( longname, "Keck 10m Telescope #1", "palObs",
|
---|
1398 | "2/NAME", status );
|
---|
1399 | vvd ( w, 2.713545757918895, 1e-8, "palObs",
|
---|
1400 | "2/W", status );
|
---|
1401 | vvd ( p, 0.3460280563536619, 1e-8, "palObs",
|
---|
1402 | "2/P", status );
|
---|
1403 | vvd ( h, 4160, 1e-10, "palObs",
|
---|
1404 | "2/H", status );
|
---|
1405 | viv( lstat, 0, "palObs", "retval", status );
|
---|
1406 |
|
---|
1407 | lstat = palObs ( 83, NULL, shortname, sizeof(shortname),
|
---|
1408 | longname, sizeof(longname), &w, &p, &h );
|
---|
1409 | vcs ( shortname, "MAGELLAN2", "palObs", "3/C", status );
|
---|
1410 | vcs ( longname, "Magellan 2, 6.5m, Las Campanas",
|
---|
1411 | "palObs", "3/NAME", status );
|
---|
1412 | vvd ( w, 1.233819305534497, 1e-8, "palObs",
|
---|
1413 | "3/W", status );
|
---|
1414 | vvd ( p, -0.506389344359954, 1e-8, "palObs",
|
---|
1415 | "3/P", status );
|
---|
1416 | vvd ( h, 2408, 1e-10, "palObs",
|
---|
1417 | "3/H", status );
|
---|
1418 | viv( lstat, 0, "palObs", "retval", status );
|
---|
1419 |
|
---|
1420 | /* the first argument here should be 1 greater than the number of items
|
---|
1421 | * in const struct telData defined in palObs.c
|
---|
1422 | */
|
---|
1423 | lstat = palObs ( 86, NULL, shortname, sizeof(shortname),
|
---|
1424 | longname, sizeof(longname), &w, &p, &h );
|
---|
1425 | vcs ( longname, "?", "palObs", "4/NAME", status );
|
---|
1426 | viv( lstat, -1, "palObs", "retval", status );
|
---|
1427 |
|
---|
1428 | lstat = palObs ( 0, "MISSING", shortname, sizeof(shortname),
|
---|
1429 | longname, sizeof(longname), &w, &p, &h );
|
---|
1430 | vcs ( longname, "?", "palObs", "5/NAME", status );
|
---|
1431 | viv( lstat, -1, "palObs", "retval", status );
|
---|
1432 |
|
---|
1433 | lstat = palObs( 0, "mmt", shortname, sizeof(shortname),
|
---|
1434 | longname, sizeof(longname), &w, &p, &h );
|
---|
1435 | vcs ( shortname, "MMT", "palObs", "6/C", status );
|
---|
1436 | vcs ( longname, "MMT 6.5m, Mt Hopkins", "palObs", "6/NAME",
|
---|
1437 | status );
|
---|
1438 | vvd ( w, 1.935300584055477, 1e-8, "palObs",
|
---|
1439 | "6/W", status );
|
---|
1440 | vvd ( p, 0.5530735081550342238, 1e-10, "palObs",
|
---|
1441 | "6/P", status );
|
---|
1442 | vvd ( h, 2608, 1e-10, "palObs",
|
---|
1443 | "6/H", status );
|
---|
1444 | viv( lstat, 0, "palObs", "retval", status );
|
---|
1445 |
|
---|
1446 | }
|
---|
1447 |
|
---|
1448 | static void t_pa( int *status ) {
|
---|
1449 | vvd ( palPa ( -1.567, 1.5123, 0.987 ),
|
---|
1450 | -1.486288540423851, 1e-12, "palPa", " ", status );
|
---|
1451 | vvd ( palPa ( 0, 0.789, 0.789 ),
|
---|
1452 | 0, 0, "palPa", "zenith", status );
|
---|
1453 | }
|
---|
1454 |
|
---|
1455 | static void t_pcd( int *status ) {
|
---|
1456 | double disco, x, y;
|
---|
1457 | disco = 178.585;
|
---|
1458 | x = 0.0123;
|
---|
1459 | y = -0.00987;
|
---|
1460 |
|
---|
1461 | palPcd ( disco, &x, &y );
|
---|
1462 | vvd ( x, 0.01284630845735895, 1e-14, "palPcd", "x", status );
|
---|
1463 | vvd ( y, -0.01030837922553926, 1e-14, "palPcd", "y", status );
|
---|
1464 |
|
---|
1465 | palUnpcd ( disco, &x, &y );
|
---|
1466 | vvd ( x, 0.0123, 1e-14, "palUnpcd", "x", status );
|
---|
1467 | vvd ( y, -0.00987, 1e-14, "palUnpcd", "y,", status );
|
---|
1468 |
|
---|
1469 | /* Now negative disco round trip */
|
---|
1470 | disco = -0.3333333;
|
---|
1471 | x = 0.0123;
|
---|
1472 | y = -0.00987;
|
---|
1473 | palPcd ( disco, &x, &y );
|
---|
1474 | palUnpcd ( disco, &x, &y );
|
---|
1475 | vvd ( x, 0.0123, 1e-14, "palUnpcd", "x", status );
|
---|
1476 | vvd ( y, -0.00987, 1e-14, "palUnpcd", "y,", status );
|
---|
1477 | }
|
---|
1478 |
|
---|
1479 | static void t_planet( int * status ) {
|
---|
1480 | int j;
|
---|
1481 | double pv[6];
|
---|
1482 | double u[13];
|
---|
1483 | double expected1[6] = { 0., 0., 0., 0., 0., 0. };
|
---|
1484 | double expectedue1[13] = {
|
---|
1485 | 1.000878908362435284, -0.3336263027874777288, 50000.,
|
---|
1486 | 2.840425801310305210, 0.1264380368035014224, -0.2287711835229143197,
|
---|
1487 | -0.01301062595106185195, 0.5657102158104651697, 0.2189745287281794885,
|
---|
1488 | 2.852427310959998500, -0.01552349065435120900,
|
---|
1489 | 50000., 0.0
|
---|
1490 | };
|
---|
1491 | double expectedue2[13] = {
|
---|
1492 | 1.00006, -4.856142884511782, 50000., 0.3, -0.2,
|
---|
1493 | 0.1, -0.4520378601821727, 0.4018114312730424,
|
---|
1494 | -.3515850023639121, 0.3741657386773941,
|
---|
1495 | -0.2511321445456515, 50000., 0.
|
---|
1496 | };
|
---|
1497 | double expectedue3[13] = {
|
---|
1498 | 1.000000000000000,
|
---|
1499 | -0.3329769417028020949,
|
---|
1500 | 50100.,
|
---|
1501 | 2.638884303608524597,
|
---|
1502 | 1.070994304747824305,
|
---|
1503 | 0.1544112080167568589,
|
---|
1504 | -0.2188240619161439344,
|
---|
1505 | 0.5207557453451906385,
|
---|
1506 | 0.2217782439275216936,
|
---|
1507 | 2.852118859689216658,
|
---|
1508 | 0.01452010174371893229,
|
---|
1509 | 50100.,
|
---|
1510 | 0.
|
---|
1511 | };
|
---|
1512 | double expectedpv[6] = {
|
---|
1513 | 0.07944764084631667011, -0.04118141077419014775,
|
---|
1514 | 0.002915180702063625400, -0.6890132370721108608e-6,
|
---|
1515 | 0.4326690733487621457e-6, -0.1763249096254134306e-6,
|
---|
1516 | };
|
---|
1517 | double expectedpv2[6] = {
|
---|
1518 | 1.947628959288897677,
|
---|
1519 | -1.013736058752235271,
|
---|
1520 | -0.3536409947732733647,
|
---|
1521 | 2.742247411571786194e-8,
|
---|
1522 | 1.170467244079075911e-7,
|
---|
1523 | 3.709878268217564005e-8
|
---|
1524 | };
|
---|
1525 |
|
---|
1526 | double ra,dec,diam, r;
|
---|
1527 | int jform;
|
---|
1528 | double epoch, orbinc, anode, perih, aorq, e, aorl,
|
---|
1529 | dm;
|
---|
1530 |
|
---|
1531 | /* palEl2ue */
|
---|
1532 | palEl2ue ( 50000, 1, 49000, 0.1, 2, 0.2,
|
---|
1533 | 3, 0.05, 3, 0.003312, u, &j );
|
---|
1534 | vvec( 13, u, expectedue1, "palEl2ue", status );
|
---|
1535 | viv ( j, 0, "palEl2ue", "J", status );
|
---|
1536 |
|
---|
1537 | /* palPertel */
|
---|
1538 | palPertel ( 2, 43000., 43200., 43000.,
|
---|
1539 | 0.2, 3, 4, 5, 0.02, 6,
|
---|
1540 | &epoch, &orbinc, &anode, &perih, &aorq, &e, &aorl, &j );
|
---|
1541 | vvd ( epoch, 43200., 1e-10, "palPertel",
|
---|
1542 | "EPOCH", status );
|
---|
1543 | vvd ( orbinc, 0.1995661466545422381, 1e-7, "palPertel",
|
---|
1544 | "ORBINC", status );
|
---|
1545 | vvd ( anode, 2.998052737821591215, 1e-7, "palPertel",
|
---|
1546 | "ANODE", status );
|
---|
1547 | vvd ( perih, 4.009516448441143636, 1e-6, "palPertel",
|
---|
1548 | "PERIH", status );
|
---|
1549 | vvd ( aorq, 5.014216294790922323, 1e-7, "palPertel",
|
---|
1550 | "AORQ", status );
|
---|
1551 | vvd ( e, 0.02281386258309823607, 1e-7, "palPertel",
|
---|
1552 | "E", status );
|
---|
1553 | vvd ( aorl, 0.01735248648779583748, 1e-6, "palPertel",
|
---|
1554 | "AORL", status );
|
---|
1555 | viv ( j, 0, "palPertel", "J", status );
|
---|
1556 |
|
---|
1557 | /* palPertue */
|
---|
1558 | palPertue ( 50100, u, &j );
|
---|
1559 | vvec( 13, u, expectedue3, "palPertue", status );
|
---|
1560 | viv ( j, 0, "palPertue", "J", status );
|
---|
1561 |
|
---|
1562 | /* palPlanel */
|
---|
1563 | palPlanel ( 50600, 2, 50500, 0.1, 3, 5,
|
---|
1564 | 2, 0.3, 4, 0, pv, &j );
|
---|
1565 | vvec( 6, pv, expectedpv2, "palPlanel", status );
|
---|
1566 | viv ( j, 0, "palPlanel", "J", status );
|
---|
1567 |
|
---|
1568 | /* palPlanet */
|
---|
1569 |
|
---|
1570 | palPlanet( 1e6, 0, pv, &j );
|
---|
1571 | vvec( 6, pv, expected1, "palPlanet 1", status );
|
---|
1572 | viv ( j, -1, "palPlanet", "J 1", status );
|
---|
1573 |
|
---|
1574 | palPlanet( 1e6, 9, pv, &j);
|
---|
1575 | viv ( j, -1, "palPlanet", "J 2", status );
|
---|
1576 |
|
---|
1577 | palPlanet ( -320000, 3, pv, &j );
|
---|
1578 | vvd ( pv[0], 0.9308038666827242603, 1e-11, "palPlanet",
|
---|
1579 | "pv[0] 3", status );
|
---|
1580 | vvd ( pv[1], 0.3258319040252137618, 1e-11, "palPlanet",
|
---|
1581 | "pv[1] 3", status );
|
---|
1582 | vvd ( pv[2], 0.1422794544477122021, 1e-11, "palPlanet",
|
---|
1583 | "pv[2] 3", status );
|
---|
1584 | vvd ( pv[3], -7.441503423889371696e-8, 1e-17, "palPlanet",
|
---|
1585 | "pv[3] 3", status );
|
---|
1586 | vvd ( pv[4], 1.699734557528650689e-7, 1e-17, "palPlanet",
|
---|
1587 | "pv[4] 3", status );
|
---|
1588 | vvd ( pv[5], 7.415505123001430864e-8, 1e-17, "palPlanet",
|
---|
1589 | "pv[5] 3", status );
|
---|
1590 | viv ( j, 1, "palPlanet", "J 3", status );
|
---|
1591 |
|
---|
1592 | palPlanet ( 43999.9, 1, pv, &j );
|
---|
1593 | vvd ( pv[0], 0.2945293959257422246, 1e-11, "palPlanet",
|
---|
1594 | "pv[0] 4", status );
|
---|
1595 | vvd ( pv[1], -0.2452204176601052181, 1e-11, "palPlanet",
|
---|
1596 | "pv[1] 4", status );
|
---|
1597 | vvd ( pv[2], -0.1615427700571978643, 1e-11, "palPlanet",
|
---|
1598 | "pv[2] 4", status );
|
---|
1599 | vvd ( pv[3], 1.636421147459047057e-7, 1e-18, "palPlanet",
|
---|
1600 | "pv[3] 4", status );
|
---|
1601 | vvd ( pv[4], 2.252949422574889753e-7, 1e-18, "palPlanet",
|
---|
1602 | "pv[4] 4", status );
|
---|
1603 | vvd ( pv[5], 1.033542799062371839e-7, 1e-18, "palPlanet",
|
---|
1604 | "pv[5] 4", status );
|
---|
1605 | viv ( j, 0, "palPlanet", "J 4", status );
|
---|
1606 |
|
---|
1607 | /* palPlante test would go here */
|
---|
1608 |
|
---|
1609 | palPlante ( 50600., -1.23, 0.456, 2, 50500.,
|
---|
1610 | 0.1, 3., 5., 2., 0.3, 4.,
|
---|
1611 | 0., &ra, &dec, &r, &j );
|
---|
1612 | vvd ( ra, 6.222958101333794007, 1e-6, "palPlante",
|
---|
1613 | "RA", status );
|
---|
1614 | vvd ( dec, 0.01142220305739771601, 1e-6, "palPlante",
|
---|
1615 | "DEC", status );
|
---|
1616 | vvd ( r, 2.288902494080167624, 1e-8, "palPlante",
|
---|
1617 | "R", status );
|
---|
1618 | viv ( j, 0, "palPlante", "J", status );
|
---|
1619 |
|
---|
1620 | u[0] = 1.0005;
|
---|
1621 | u[1] = -0.3;
|
---|
1622 | u[2] = 55000.;
|
---|
1623 | u[3] = 2.8;
|
---|
1624 | u[4] = 0.1;
|
---|
1625 | u[5] = -0.2;
|
---|
1626 | u[6] = -0.01;
|
---|
1627 | u[7] = 0.5;
|
---|
1628 | u[8] = 0.22;
|
---|
1629 | u[9] = 2.8;
|
---|
1630 | u[10] = -0.015;
|
---|
1631 | u[11] = 55001.;
|
---|
1632 | u[12] = 0;
|
---|
1633 |
|
---|
1634 | /* palPlantu */
|
---|
1635 |
|
---|
1636 | palPlantu ( 55001., -1.23, 0.456, u, &ra, &dec, &r, &j );
|
---|
1637 | vvd ( ra, 0.3531814831241686647, 1e-6, "palPlantu",
|
---|
1638 | "RA", status );
|
---|
1639 | vvd ( dec, 0.06940344580567131328, 1e-6, "palPlantu",
|
---|
1640 | "DEC", status );
|
---|
1641 | vvd ( r, 3.031687170873274464, 1e-8, "palPlantu",
|
---|
1642 | "R", status );
|
---|
1643 | viv ( j, 0, "palPlantu", "J", status );
|
---|
1644 |
|
---|
1645 | /* palPv2el */
|
---|
1646 |
|
---|
1647 | pv[0] = 0.3;
|
---|
1648 | pv[1] = -0.2;
|
---|
1649 | pv[2] = 0.1;
|
---|
1650 | pv[3] = -0.9e-7;
|
---|
1651 | pv[4] = 0.8e-7;
|
---|
1652 | pv[5] = -0.7e-7;
|
---|
1653 |
|
---|
1654 | palPv2el ( pv, 50000, 0.00006, 1,
|
---|
1655 | &jform, &epoch, &orbinc, &anode, &perih,
|
---|
1656 | &aorq, &e, &aorl, &dm, &j );
|
---|
1657 | viv ( jform, 1, "palPv2el", "JFORM", status );
|
---|
1658 | vvd ( epoch, 50000, 1e-10, "palPv2el",
|
---|
1659 | "EPOCH", status );
|
---|
1660 | vvd ( orbinc, 1.52099895268912, 1e-12, "palPv2el",
|
---|
1661 | "ORBINC", status );
|
---|
1662 | vvd ( anode, 2.720503180538650, 1e-12, "palPv2el",
|
---|
1663 | "ANODE", status );
|
---|
1664 | vvd ( perih, 2.194081512031836, 1e-12, "palPv2el",
|
---|
1665 | "PERIH", status );
|
---|
1666 | vvd ( aorq, 0.2059371035373771, 1e-12, "palPv2el",
|
---|
1667 | "AORQ", status );
|
---|
1668 | vvd ( e, 0.9866822985810528, 1e-12, "palPv2el",
|
---|
1669 | "E", status );
|
---|
1670 | vvd ( aorl, 0.2012758344836794, 1e-12, "palPv2el",
|
---|
1671 | "AORL", status );
|
---|
1672 | vvd ( dm, 0.1840740507951820, 1e-12, "palPv2el",
|
---|
1673 | "DM", status );
|
---|
1674 | viv ( j, 0, "palPv2el", "J", status );
|
---|
1675 |
|
---|
1676 | /* palPv2ue */
|
---|
1677 | palPv2ue ( pv, 50000., 0.00006, u, &j );
|
---|
1678 | vvec( 13, u, expectedue2, "palPv2ue", status );
|
---|
1679 | viv ( j, 0, "palPv2ue", "J", status );
|
---|
1680 |
|
---|
1681 | /* Planets */
|
---|
1682 | palRdplan ( 40999.9, 0, 0.1, -0.9, &ra, &dec, &diam );
|
---|
1683 | vvd ( ra, 5.772270359389275837, 1e-6, "palRdplan",
|
---|
1684 | "ra 0", status );
|
---|
1685 | vvd ( dec, -0.2089207338795416192, 1e-7, "palRdplan",
|
---|
1686 | "dec 0", status );
|
---|
1687 | vvd ( diam, 9.415338935229717875e-3, 1e-10, "palRdplan",
|
---|
1688 | "diam 0", status );
|
---|
1689 | palRdplan ( 41999.9, 1, 1.1, -0.9, &ra, &dec, &diam );
|
---|
1690 | vvd ( ra, 3.866363420052936653, 1e-6, "palRdplan",
|
---|
1691 | "ra 1", status );
|
---|
1692 | vvd ( dec, -0.2594430577550113130, 1e-7, "palRdplan",
|
---|
1693 | "dec 1", status );
|
---|
1694 | vvd ( diam, 4.638468996795023071e-5, 1e-14, "palRdplan",
|
---|
1695 | "diam 1", status );
|
---|
1696 | palRdplan ( 42999.9, 2, 2.1, 0.9, &ra, &dec, &diam );
|
---|
1697 | vvd ( ra, 2.695383203184077378, 1e-6, "palRdplan",
|
---|
1698 | "ra 2", status );
|
---|
1699 | vvd ( dec, 0.2124044506294805126, 1e-7, "palRdplan",
|
---|
1700 | "dec 2", status );
|
---|
1701 | vvd ( diam, 4.892222838681000389e-5, 1e-14, "palRdplan",
|
---|
1702 | "diam 2", status );
|
---|
1703 | palRdplan ( 43999.9, 3, 3.1, 0.9, &ra, &dec, &diam );
|
---|
1704 | vvd ( ra, 2.908326678461540165, 1e-7, "palRdplan",
|
---|
1705 | "ra 3", status );
|
---|
1706 | vvd ( dec, 0.08729783126905579385, 1e-7, "palRdplan",
|
---|
1707 | "dec 3", status );
|
---|
1708 | vvd ( diam, 8.581305866034962476e-3, 1e-7, "palRdplan",
|
---|
1709 | "diam 3", status );
|
---|
1710 | palRdplan ( 44999.9, 4, -0.1, 1.1, &ra, &dec, &diam );
|
---|
1711 | vvd ( ra, 3.429840787472851721, 1e-6, "palRdplan",
|
---|
1712 | "ra 4", status );
|
---|
1713 | vvd ( dec, -0.06979851055261161013, 1e-7, "palRdplan",
|
---|
1714 | "dec 4", status );
|
---|
1715 | vvd ( diam, 4.540536678439300199e-5, 1e-14, "palRdplan",
|
---|
1716 | "diam 4", status );
|
---|
1717 | palRdplan ( 45999.9, 5, -1.1, 0.1, &ra, &dec, &diam );
|
---|
1718 | vvd ( ra, 4.864669466449422548, 1e-6, "palRdplan",
|
---|
1719 | "ra 5", status );
|
---|
1720 | vvd ( dec, -0.4077714497908953354, 1e-7, "palRdplan",
|
---|
1721 | "dec 5", status );
|
---|
1722 | vvd ( diam, 1.727945579027815576e-4, 1e-14, "palRdplan",
|
---|
1723 | "diam 5", status );
|
---|
1724 | palRdplan ( 46999.9, 6, -2.1, -0.1, &ra, &dec, &diam );
|
---|
1725 | vvd ( ra, 4.432929829176388766, 1e-6, "palRdplan",
|
---|
1726 | "ra 6", status );
|
---|
1727 | vvd ( dec, -0.3682820877854730530, 1e-7, "palRdplan",
|
---|
1728 | "dec 6", status );
|
---|
1729 | vvd ( diam, 8.670829016099083311e-5, 1e-14, "palRdplan",
|
---|
1730 | "diam 6", status );
|
---|
1731 | palRdplan ( 47999.9, 7, -3.1, -1.1, &ra, &dec, &diam );
|
---|
1732 | vvd ( ra, 4.894972492286818487, 1e-6, "palRdplan",
|
---|
1733 | "ra 7", status );
|
---|
1734 | vvd ( dec, -0.4084068901053653125, 1e-7, "palRdplan",
|
---|
1735 | "dec 7", status );
|
---|
1736 | vvd ( diam, 1.793916783975974163e-5, 1e-14, "palRdplan",
|
---|
1737 | "diam 7", status );
|
---|
1738 | palRdplan ( 48999.9, 8, 0, 0, &ra, &dec, &diam );
|
---|
1739 | vvd ( ra, 5.066050284760144000, 1e-6, "palRdplan",
|
---|
1740 | "ra 8", status );
|
---|
1741 | vvd ( dec, -0.3744690779683850609, 1e-7, "palRdplan",
|
---|
1742 | "dec 8", status );
|
---|
1743 | vvd ( diam, 1.062210086082700563e-5, 1e-14, "palRdplan",
|
---|
1744 | "diam 8", status );
|
---|
1745 |
|
---|
1746 | /* palUe2el */
|
---|
1747 | palUe2el ( u, 1, &jform, &epoch, &orbinc, &anode, &perih,
|
---|
1748 | &aorq, &e, &aorl, &dm, &j );
|
---|
1749 | viv ( jform, 1, "palUe2el", "JFORM", status );
|
---|
1750 | vvd ( epoch, 50000.00000000000, 1e-10, "palUe2el",
|
---|
1751 | "EPOCH", status );
|
---|
1752 | vvd ( orbinc, 1.520998952689120, 1e-12, "palUe2el",
|
---|
1753 | "ORBINC", status );
|
---|
1754 | vvd ( anode, 2.720503180538650, 1e-12, "palUe2el",
|
---|
1755 | "ANODE", status );
|
---|
1756 | vvd ( perih, 2.194081512031836, 1e-12, "palUe2el",
|
---|
1757 | "PERIH", status );
|
---|
1758 | vvd ( aorq, 0.2059371035373771, 1e-12, "palUe2el",
|
---|
1759 | "AORQ", status );
|
---|
1760 | vvd ( e, 0.9866822985810528, 1e-12, "palUe2el",
|
---|
1761 | "E", status );
|
---|
1762 | vvd ( aorl, 0.2012758344836794, 1e-12, "palUe2el",
|
---|
1763 | "AORL", status );
|
---|
1764 | viv ( j, 0, "palUe2el", "J", status );
|
---|
1765 |
|
---|
1766 | /* palUe2pv */
|
---|
1767 | palUe2pv( 50010., u, pv, &j );
|
---|
1768 |
|
---|
1769 | /* Update the final two elements of the expecte UE array */
|
---|
1770 | expectedue2[11] = 50010.;
|
---|
1771 | expectedue2[12] = 0.7194308220038886856;
|
---|
1772 |
|
---|
1773 | vvec( 13, u, expectedue2, "palUe2pv", status );
|
---|
1774 | vvec( 6, pv, expectedpv, "palUe2pv", status );
|
---|
1775 | viv ( j, 0, "palUe2pv", "J", status );
|
---|
1776 |
|
---|
1777 | }
|
---|
1778 |
|
---|
1779 | static void t_pm( int * status ) {
|
---|
1780 | double ra2, dec2;
|
---|
1781 | double ra1, dec1, pmr1, pmd1, px1, rv1;
|
---|
1782 |
|
---|
1783 | ra1 = 5.43;
|
---|
1784 | dec1 = -0.87;
|
---|
1785 | pmr1 = -0.33e-5;
|
---|
1786 | pmd1 = 0.77e-5;
|
---|
1787 | px1 = 0.7;
|
---|
1788 | rv1 = 50.3*365.2422/365.25;
|
---|
1789 |
|
---|
1790 | palPm ( ra1, dec1, pmr1, pmd1, px1, rv1,
|
---|
1791 | 1899, 1943,
|
---|
1792 | &ra2, &dec2 );
|
---|
1793 | vvd ( ra2, 5.429855087793875, 1e-10, "palPm",
|
---|
1794 | "R", status );
|
---|
1795 | vvd ( dec2, -0.8696617307805072, 1e-10, "palPm",
|
---|
1796 | "D", status );
|
---|
1797 |
|
---|
1798 | /* SOFA/ERFA test */
|
---|
1799 | ra1 = 0.01686756;
|
---|
1800 | dec1 = -1.093989828;
|
---|
1801 | pmr1 = -1.78323516e-5;
|
---|
1802 | pmd1 = 2.336024047e-6;
|
---|
1803 | px1 = 0.74723;
|
---|
1804 | rv1 = -21.6;
|
---|
1805 |
|
---|
1806 | palPm(ra1, dec1, pmr1, pmd1, px1, rv1,
|
---|
1807 | palEpj(50083.0), palEpj(53736.0),
|
---|
1808 | &ra2, &dec2);
|
---|
1809 | vvd(ra2, 0.01668919069414242368, 1e-13,
|
---|
1810 | "palPm", "ra", status);
|
---|
1811 | vvd(dec2, -1.093966454217127879, 1e-13,
|
---|
1812 | "palPm", "dec", status);
|
---|
1813 |
|
---|
1814 |
|
---|
1815 | }
|
---|
1816 |
|
---|
1817 | static void t_polmo( int *status ) {
|
---|
1818 | double elong, phi, daz;
|
---|
1819 |
|
---|
1820 | palPolmo( 0.7, -0.5, 1.0e-6, -2.0e-6, &elong, &phi, &daz );
|
---|
1821 | vvd(elong, 0.7000004837322044, 1.0e-12, "palPolmo", "elong", status );
|
---|
1822 | vvd(phi, -0.4999979467222241, 1.0e-12, "palPolmo", "phi", status );
|
---|
1823 | vvd(daz, 1.008982781275728e-6, 1.0e-12, "palPolmo", "daz", status );
|
---|
1824 | }
|
---|
1825 |
|
---|
1826 | static void t_pvobs( int *status ) {
|
---|
1827 | double pv[6];
|
---|
1828 | double expected[6] = { -4.7683600138836167813e-06,
|
---|
1829 | 1.0419056712717953176e-05,
|
---|
1830 | 4.099831053320363277e-05,
|
---|
1831 | -7.5976959740661272483e-10,
|
---|
1832 | -3.4771429582640930371e-10,
|
---|
1833 | 0.0};
|
---|
1834 | palPvobs( 1.3, 10000.0, 2.0, pv );
|
---|
1835 | vvec( 6, pv, expected, "palPvobs", status );
|
---|
1836 | }
|
---|
1837 |
|
---|
1838 | static void t_rv( int *status ) {
|
---|
1839 | vvd ( palRverot ( -0.777, 5.67, -0.3, 3.19 ),
|
---|
1840 | -0.1948098355075913, 1e-6,
|
---|
1841 | "palRverot", " ", status );
|
---|
1842 | vvd ( palRvgalc ( 1.11E0, -0.99E0 ),
|
---|
1843 | 158.9630759840254, 1e-3, "palRvgalc", " ", status );
|
---|
1844 | vvd ( palRvlg ( 3.97E0, 1.09E0 ),
|
---|
1845 | -197.818762175363, 1e-3, "palRvlg", " ", status );
|
---|
1846 | vvd ( palRvlsrd ( 6.01E0, 0.1E0 ),
|
---|
1847 | -4.082811335150567, 1e-4, "palRvlsrd", " ", status );
|
---|
1848 | vvd ( palRvlsrk ( 6.01E0, 0.1E0 ),
|
---|
1849 | -5.925180579830265, 1e-4, "palRvlsrk", " ", status );
|
---|
1850 | }
|
---|
1851 |
|
---|
1852 | static void t_rvgalc( int *status ) {
|
---|
1853 | double rv;
|
---|
1854 | rv = palRvgalc( 2.7, -1.0 );
|
---|
1855 | vvd( rv, 213.98084425751144977, 1.0E-12, "palRvgalc", "rv", status );
|
---|
1856 | }
|
---|
1857 |
|
---|
1858 | static void t_rvlg( int *status ) {
|
---|
1859 | double rv;
|
---|
1860 | rv = palRvlg( 2.7, -1.0 );
|
---|
1861 | vvd( rv, 291.79205281252404802, 1.0E-12, "palRvlg", "rv", status );
|
---|
1862 | }
|
---|
1863 |
|
---|
1864 | static void t_rvlsrd( int *status ) {
|
---|
1865 | double rv;
|
---|
1866 | rv = palRvlsrd( 2.7, -1.0 );
|
---|
1867 | vvd( rv, 9.620674692097630043, 1.0E-12, "palRvlsrd", "rv", status );
|
---|
1868 | }
|
---|
1869 |
|
---|
1870 | static void t_rvlsrk( int *status ) {
|
---|
1871 | double rv;
|
---|
1872 | rv = palRvlsrk( 2.7, -1.0 );
|
---|
1873 | vvd( rv, 12.556356851411955233, 1.0E-12, "palRvlsrk", "rv", status );
|
---|
1874 | }
|
---|
1875 |
|
---|
1876 | static void t_refco( int *status ) {
|
---|
1877 | double phpa, tc, rh, wl, refa, refb;
|
---|
1878 | phpa = 800.0;
|
---|
1879 | tc = 10.0 + 273.15; /* SLA uses kelvin */
|
---|
1880 | rh = 0.9;
|
---|
1881 | wl = 0.4;
|
---|
1882 | palRefcoq(tc, phpa, rh, wl, &refa, &refb);
|
---|
1883 | vvd(refa, 0.2264949956241415009e-3, 1e-15,
|
---|
1884 | "palRefcoq", "refa", status);
|
---|
1885 | vvd(refb, -0.2598658261729343970e-6, 1e-18,
|
---|
1886 | "palRefcoq", "refb", status);
|
---|
1887 | }
|
---|
1888 |
|
---|
1889 | static void t_ref( int *status ) {
|
---|
1890 | double ref, refa, refb, refa2, refb2, vu[3], vr[3], zr;
|
---|
1891 |
|
---|
1892 | palRefro( 1.4, 3456.7, 280, 678.9, 0.9, 0.55,
|
---|
1893 | -0.3, 0.006, 1e-9, &ref );
|
---|
1894 | vvd( ref, 0.00106715763018568, 1e-12, "palRefro",
|
---|
1895 | "o", status );
|
---|
1896 |
|
---|
1897 | palRefro( 1.4, 3456.7, 280, 678.9, 0.9, 1000,
|
---|
1898 | -0.3, 0.006, 1e-9, &ref );
|
---|
1899 | vvd( ref, 0.001296416185295403, 1e-12, "palRefro",
|
---|
1900 | "r", status );
|
---|
1901 |
|
---|
1902 | palRefcoq( 275.9, 709.3, 0.9, 101, &refa, &refb );
|
---|
1903 | vvd( refa, 2.324736903790639e-4, 1e-12, "palRefcoq",
|
---|
1904 | "a/r", status );
|
---|
1905 | vvd( refb, -2.442884551059e-7, 1e-15, "palRefcoq",
|
---|
1906 | "b/r", status );
|
---|
1907 |
|
---|
1908 | palRefco( 2111.1, 275.9, 709.3, 0.9, 101,
|
---|
1909 | -1.03, 0.0067, 1e-12, &refa, &refb );
|
---|
1910 | vvd( refa, 2.324673985217244e-4, 1e-12, "palRefco",
|
---|
1911 | "a/r", status );
|
---|
1912 | vvd( refb, -2.265040682496e-7, 1e-15, "palRefco",
|
---|
1913 | "b/r", status );
|
---|
1914 |
|
---|
1915 | palRefcoq( 275.9, 709.3, 0.9, 0.77, &refa, &refb );
|
---|
1916 | vvd( refa, 2.007406521596588e-4, 1e-12, "palRefcoq",
|
---|
1917 | "a", status );
|
---|
1918 | vvd( refb, -2.264210092590e-7, 1e-15, "palRefcoq",
|
---|
1919 | "b", status );
|
---|
1920 |
|
---|
1921 | palRefco( 2111.1, 275.9, 709.3, 0.9, 0.77,
|
---|
1922 | -1.03, 0.0067, 1e-12, &refa, &refb );
|
---|
1923 | vvd( refa, 2.007202720084551e-4, 1e-12, "palRefco",
|
---|
1924 | "a", status );
|
---|
1925 | vvd( refb, -2.223037748876e-7, 1e-15, "palRefco",
|
---|
1926 | "b", status );
|
---|
1927 |
|
---|
1928 | palAtmdsp ( 275.9, 709.3, 0.9, 0.77,
|
---|
1929 | refa, refb, 0.5, &refa2, &refb2 );
|
---|
1930 | vvd ( refa2, 2.034523658888048e-4, 1e-12, "palAtmdsp",
|
---|
1931 | "a", status );
|
---|
1932 | vvd ( refb2, -2.250855362179e-7, 1e-15, "palAtmdsp",
|
---|
1933 | "b", status );
|
---|
1934 |
|
---|
1935 | palDcs2c ( 0.345, 0.456, vu );
|
---|
1936 | palRefv ( vu, refa, refb, vr );
|
---|
1937 | vvd ( vr[0], 0.8447487047790478, 1e-12, "palRefv",
|
---|
1938 | "x1", status );
|
---|
1939 | vvd ( vr[1], 0.3035794890562339, 1e-12, "palRefv",
|
---|
1940 | "y1", status );
|
---|
1941 | vvd ( vr[2], 0.4407256738589851, 1e-12, "palRefv",
|
---|
1942 | "z1", status );
|
---|
1943 |
|
---|
1944 | palDcs2c ( 3.7, 0.03, vu );
|
---|
1945 | palRefv ( vu, refa, refb, vr );
|
---|
1946 | vvd ( vr[0], -0.8476187691681673, 1e-12, "palRefv",
|
---|
1947 | "x2", status );
|
---|
1948 | vvd ( vr[1], -0.5295354802804889, 1e-12, "palRefv",
|
---|
1949 | "y2", status );
|
---|
1950 | vvd ( vr[2], 0.0322914582168426, 1e-12, "palRefv",
|
---|
1951 | "z2", status );
|
---|
1952 |
|
---|
1953 | palRefz ( 0.567, refa, refb, &zr );
|
---|
1954 | vvd ( zr, 0.566872285910534, 1e-12, "palRefz",
|
---|
1955 | "hi el", status );
|
---|
1956 |
|
---|
1957 | palRefz ( 1.55, refa, refb, &zr );
|
---|
1958 | vvd ( zr, 1.545697350690958, 1e-12, "palRefz",
|
---|
1959 | "lo el", status );
|
---|
1960 |
|
---|
1961 |
|
---|
1962 |
|
---|
1963 | }
|
---|
1964 |
|
---|
1965 | static void t_vers( int *status ) {
|
---|
1966 | char verstring[32];
|
---|
1967 |
|
---|
1968 | int ver = palVers( verstring, sizeof(verstring));
|
---|
1969 | printf("PAL Version %s (%d)\n", verstring, ver);
|
---|
1970 | if ( ver < 6000 ) {
|
---|
1971 | *status = 1; /* palVers introduced at v0.6.0 */
|
---|
1972 | }
|
---|
1973 | }
|
---|
1974 |
|
---|
1975 | /**********************************************************************/
|
---|
1976 |
|
---|
1977 | int main (void) {
|
---|
1978 |
|
---|
1979 | /* Use the SLA and SOFA/ERFA conventions */
|
---|
1980 | int status = 0; /* Unix and SAE convention */
|
---|
1981 |
|
---|
1982 | t_addet(&status);
|
---|
1983 | t_afin(&status);
|
---|
1984 | t_altaz(&status);
|
---|
1985 | t_ampqk(&status);
|
---|
1986 | t_aop(&status);
|
---|
1987 | t_airmas(&status);
|
---|
1988 | t_amp(&status);
|
---|
1989 | t_bear(&status);
|
---|
1990 | t_caf2r(&status);
|
---|
1991 | t_caldj(&status);
|
---|
1992 | t_cc2s(&status);
|
---|
1993 | t_cd2tf(&status);
|
---|
1994 | t_cldj(&status);
|
---|
1995 | t_cr2af(&status);
|
---|
1996 | t_cr2tf(&status);
|
---|
1997 | t_ctf2d(&status);
|
---|
1998 | t_ctf2r(&status);
|
---|
1999 | t_dat(&status);
|
---|
2000 | t_djcal(&status);
|
---|
2001 | t_dmat(&status);
|
---|
2002 | t_epb(&status);
|
---|
2003 | t_epb2d(&status);
|
---|
2004 | t_epco(&status);
|
---|
2005 | t_epj(&status);
|
---|
2006 | t_epj2d(&status);
|
---|
2007 | t_eqecl(&status);
|
---|
2008 | t_eqeqx(&status);
|
---|
2009 | t_etrms(&status);
|
---|
2010 | t_eqgal(&status);
|
---|
2011 | t_evp(&status);
|
---|
2012 | t_fk45z(&status);
|
---|
2013 | t_fk54z(&status);
|
---|
2014 | t_fk524(&status);
|
---|
2015 | t_flotin(&status);
|
---|
2016 | t_galeq(&status);
|
---|
2017 | t_galsup(&status);
|
---|
2018 | t_ge50(&status);
|
---|
2019 | t_geoc(&status);
|
---|
2020 | t_gmst(&status);
|
---|
2021 | t_fk52h(&status);
|
---|
2022 | t_intin(&status);
|
---|
2023 | t_prec(&status);
|
---|
2024 | t_preces(&status);
|
---|
2025 | t_ecleq(&status);
|
---|
2026 | t_ecmat(&status);
|
---|
2027 | t_e2h(&status);
|
---|
2028 | t_map(&status);
|
---|
2029 | t_mappa(&status);
|
---|
2030 | t_mapqkz(&status);
|
---|
2031 | t_moon(&status);
|
---|
2032 | t_nut(&status);
|
---|
2033 | t_obs(&status);
|
---|
2034 | t_pa(&status);
|
---|
2035 | t_pcd(&status);
|
---|
2036 | t_planet(&status);
|
---|
2037 | t_pm(&status);
|
---|
2038 | t_polmo(&status);
|
---|
2039 | t_prebn(&status);
|
---|
2040 | t_pvobs(&status);
|
---|
2041 | t_range(&status);
|
---|
2042 | t_ranorm(&status);
|
---|
2043 | t_ref(&status);
|
---|
2044 | t_refco(&status);
|
---|
2045 | t_rv(&status);
|
---|
2046 | t_rvgalc(&status);
|
---|
2047 | t_rvlg(&status);
|
---|
2048 | t_rvlsrd(&status);
|
---|
2049 | t_rvlsrk(&status);
|
---|
2050 | t_sep(&status);
|
---|
2051 | t_supgal(&status);
|
---|
2052 | t_tp(&status);
|
---|
2053 | t_vecmat(&status);
|
---|
2054 | t_vers(&status);
|
---|
2055 | return status;
|
---|
2056 | }
|
---|
2057 |
|
---|