Changeset 18712
- Timestamp:
- 01/06/17 11:51:27 (8 years ago)
- Location:
- trunk/FACT++/pal
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/pal/.gitignore
r18347 r18712 9 9 *.o 10 10 *.lo 11 *.lof 11 12 *.la 12 13 *.dSYM -
trunk/FACT++/pal/component.xml
r18347 r18712 4 4 5 5 <component id="pal" support="S"> 6 <version>0.9. 3</version>6 <version>0.9.7</version> 7 7 <path>libext/pal</path> 8 8 <description>Positional Astronomy Library</description> -
trunk/FACT++/pal/configure.ac
r18347 r18712 3 3 4 4 dnl Initialisation: package name and version number 5 AC_INIT([pal],[0.9. 3],[starlink@jiscmail.ac.uk])5 AC_INIT([pal],[0.9.7],[starlink@jiscmail.ac.uk]) 6 6 AC_CONFIG_AUX_DIR([build-aux]) 7 7 … … 55 55 AC_DEFINE( [HAVE_STAR_UTIL_H], [1], [Define to 1 if you have the <star/util.h> header file]) 56 56 else 57 AC_MSG_NOTICE([Building outside a Starlink environment]) 57 58 58 59 # Allow ERFA/SOFA location to be specified using --with-erfa=$ERFA_DIR … … 118 119 119 120 dnl Disable document building regardless of --without-stardocs 120 _star_build_docs= :121 _star_build_docs=false 121 122 fi 122 123 -
trunk/FACT++/pal/pal.news
r18347 r18712 4 4 SLALIB API. It is distributed under the GPL and uses the SOFA library wherever 5 5 possible. 6 7 V0.9.7 8 9 - Enable light deflection in palAmpqk. 10 11 V0.9.5 12 13 - Add light deflection to palAmpqk. SLALIB always had it but for some reason 14 the relevant piece of code never got ported to PAL. 15 16 V0.9.4 17 18 - Add light deflection to palMapqkz (thanks to Scott Daniel) 19 - Add test for palMapqk (thanks to Scott Daniel) 20 - Correctly disable documentation build when running outside of a Starlink 21 environment. 6 22 7 23 V0.9.3 -
trunk/FACT++/pal/palAmpqk.c
r18347 r18712 26 26 * (0) time interval for proper motion (Julian years) 27 27 * (1-3) barycentric position of the Earth (AU) 28 * (4-6) not used29 * (7) not used28 * (4-6) heliocentric direction of the Earth (unit vector) 29 * (7) (grav rad Sun)*2/(Sun-Earth distance) 30 30 * (8-10) abv: barycentric Earth velocity in units of c 31 31 * (11) sqrt(1-v*v) where v=modulus(abv) … … 44 44 * function. 45 45 46 * Note: 47 * Iterative techniques are used for the aberration and 48 * light deflection corrections so that the routines 49 * palAmp (or palAmpqk) and palMap (or palMapqk) are 50 * accurate inverses; even at the edge of the Sun's disc 51 * the discrepancy is only about 1 nanoarcsecond. 52 46 53 * Authors: 47 54 * PTW: Pat Wallace (STFC) 55 * TIMJ: Tim Jenness 48 56 * {enter_new_authors_here} 49 57 … … 52 60 * Initial version. 53 61 * Adapted with permission from the Fortran SLALIB library. 62 * 2016-12-19 (TIMJ): 63 * Add in light deflection (was missed in the initial port). 54 64 * {enter_further_changes_here} 55 65 … … 57 67 * Copyright (C) 2000 Rutherford Appleton Laboratory 58 68 * Copyright (C) 2012 Science and Technology Facilities Council. 69 * Copyright (C) 2016 Tim Jenness 59 70 * All Rights Reserved. 60 71 … … 91 102 double p1[3], p2[3], p3[3]; /* work vectors */ 92 103 double ab1p1, p1dv, p1dvp1, w; 104 double gr2e, pde, pdep1, ehn[3], p[3]; 93 105 int i, j; 94 106 95 107 /* Unpack some of the parameters */ 108 gr2e = amprms[7]; 96 109 ab1 = amprms[11]; 97 110 for( i = 0; i < 3; i++ ) { 111 ehn[i] = amprms[i + 4]; 98 112 abv[i] = amprms[i + 8]; 99 113 } … … 123 137 } 124 138 139 /* Light deflection */ 140 for( i = 0; i < 3; i++ ) { 141 p[i] = p1[i]; 142 } 143 for( j = 0; j < 5; j++ ) { 144 pde = eraPdp( p, ehn ); 145 pdep1 = 1.0 + pde; 146 w = pdep1 - gr2e*pde; 147 for( i = 0; i < 3; i++ ) { 148 p[i] = (pdep1*p1[i] - gr2e*ehn[i])/w; 149 } 150 eraPn( p, &w, p2 ); 151 for( i = 0; i < 3; i++ ) { 152 p[i] = p2[i]; 153 } 154 } 155 125 156 /* Mean RA,Dec */ 126 eraC2s( p 1, rm, dm );157 eraC2s( p, rm, dm ); 127 158 *rm = eraAnp( *rm ); 128 159 } -
trunk/FACT++/pal/palMappa.c
r18347 r18712 26 26 * - (1-3) barycentric position of the Earth (AU) 27 27 * - (4-6) heliocentric direction of the Earth (unit vector) 28 * - (7) ( grav rad Sun)*2/(Sun-Earth distance)28 * - (7) (Schwarzschild radius of Sun)/(Sun-Earth distance) 29 29 * - (8-10) abv: barycentric Earth velocity in units of c 30 * - (11) sqrt(1-v **2) where v=modulus(abv)30 * - (11) sqrt(1-v^2) where v=modulus(abv) 31 31 * - (12-20) precession/nutation (3,3) matrix 32 32 -
trunk/FACT++/pal/palMapqk.c
r18347 r18712 52 52 * routine can be used instead. 53 53 54 * Notes: 55 * - The reference frames and timescales used are post IAU 2006. 56 * - The mean place rm, dm and the vectors amprms[1-3] and amprms[4-6] 57 * are referred to the mean equinox and equator of the epoch 58 * specified when generating the precession/nutation matrix 59 * amprms[12-20]. In the call to palMappa (q.v.) normally used 60 * to populate amprms, this epoch is the first argument (eq). 61 * - Strictly speaking, the routine is not valid for solar-system 62 * sources, though the error will usually be extremely small. 63 * However, to prevent gross errors in the case where the 64 * position of the Sun is specified, the gravitational 65 * deflection term is restrained within about 920 arcsec of the 66 * centre of the Sun's disc. The term has a maximum value of 67 * about 1.85 arcsec at this radius, and decreases to zero as 68 * the centre of the disc is approached. 69 54 70 * Authors: 55 71 * PTW: Patrick T. Wallace 56 72 * TIMJ: Tim Jenness (JAC, Hawaii) 57 73 * {enter_new_authors_here} 58 59 * Notes:60 * - The reference frames and timescales used are post IAU 2006.61 74 62 75 * History: … … 101 114 102 115 /* local constants */ 103 const double VF = 0.21094502 ; /* Km/s to AU/year */116 const double VF = 0.210945028; /* Km/s to AU/year */ 104 117 105 118 /* Local Variables: */ -
trunk/FACT++/pal/palMapqkz.c
r18347 r18712 25 25 * Star-independent mean-to-apparent parameters (see palMappa): 26 26 * (0-3) not used 27 * (4-6) not used27 * (4-6) heliocentric direction of the Earth (unit vector) 28 28 * (7) not used 29 29 * (8-10) abv: barycentric Earth velocity in units of c 30 * (11) sqrt(1-v **2) where v=modulus(abv)30 * (11) sqrt(1-v^2) where v=modulus(abv) 31 31 * (12-20) precession/nutation (3,3) matrix 32 32 * ra = double * (Returned) … … 50 50 * The corresponding function for the case of non-zero parallax 51 51 * and proper motion is palMapqk. 52 * 53 * The reference systems and timescales used are IAU 2006. 54 * 55 * Strictly speaking, the function is not valid for solar-system 56 * sources, though the error will usually be extremely small. 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. 57 70 58 71 * Authors: … … 100 113 /* Local Variables: */ 101 114 int i; 102 double ab1, abv[3], p[3], w, p1dv, p1dvp1, p2[3], p3[3]; 115 double ab1, abv[3], p[3], w, p1dv, p2[3], p3[3]; 116 double gr2e, pde, pdep1, ehn[3], p1[3]; 103 117 104 118 /* Unpack scalar and vector parameters. */ 105 119 ab1 = amprms[11]; 120 gr2e = amprms[7]; 106 121 for( i = 0; i < 3; i++ ) { 107 122 abv[i] = amprms[i+8]; 123 ehn[i] = amprms[i+4]; 108 124 } 109 125 … … 111 127 eraS2c( rm, dm, p ); 112 128 129 /* Light deflection (restrained within the Sun's disc) */ 130 pde = eraPdp( p, ehn ); 131 pdep1 = pde + 1.0; 132 w = gr2e / ( pdep1 > 1.0e-5 ? pdep1 : 1.0e-5 ); 133 for( i = 0; i < 3; i++) { 134 p1[i] = p[i] + w * ( ehn[i] - pde * p[i] ); 135 } 136 113 137 /* Aberration. */ 114 p1dv = eraPdp( p, abv ); 115 p1dvp1 = p1dv + 1.0; 138 p1dv = eraPdp( p1, abv ); 116 139 w = 1.0 + p1dv / ( ab1 + 1.0 ); 117 140 for( i = 0; i < 3; i++ ) { 118 p2[i] = ( ( ab1 * p [i] ) + ( w * abv[i] ) ) / p1dvp1;141 p2[i] = ( ( ab1 * p1[i] ) + ( w * abv[i] ) ); 119 142 } 120 143 -
trunk/FACT++/pal/palTest.c
r18347 r18712 276 276 /* This is the palMapqk test */ 277 277 palAmp( 1.234, -0.567, 55927.0, 2010.0, &rm, &dm ); 278 vvd( rm, 1.2335120 411026936349, 1.0E-12, "palAmp", "rm", status );279 vvd( dm, -0.5670290 8706930343907, 1.0E-12, "palAmp", "dm", status );278 vvd( rm, 1.233512033578303857, 1.0E-12, "palAmp", "rm", status ); 279 vvd( dm, -0.56702909748530827549, 1.0E-12, "palAmp", "dm", status ); 280 280 } 281 281 … … 1270 1270 } 1271 1271 1272 static void t_mapqk( int *status ) { 1273 /* Test mapqk by taking the geocentric apparent positions of Arcturus 1274 as downloaded from aa.usno.mil/data/docs/geocentric.php and trying 1275 to calculate it from Arcturus' mean position, proper motion, parallax, 1276 and radial velocity */ 1277 1278 double amprms[21]; 1279 double ra_0, dec_0; /* mean position */ 1280 double ra_app, dec_app; /* geocentric apparent position */ 1281 double ra_test, dec_test; 1282 double px, pm_ra, pm_dec, v_rad; 1283 int j; 1284 int iposn; 1285 1286 /* 1287 The data below represents the position of Arcturus on 1288 JD (UT) 2457000.375 as reported by 1289 http://aa.usno.navy.mil/data/docs/geocentric.php 1290 */ 1291 1292 const char radec_0[] = "14 15 39.67207 19 10 56.673"; 1293 const char radec_app[] = "14 16 19.59 19 6 19.56"; 1294 1295 iposn = 1; 1296 palDafin(radec_0, &iposn, &ra_0, &j); 1297 palDafin(radec_0, &iposn, &dec_0, &j); 1298 ra_0 *= 15.0; 1299 1300 pm_ra = -1.0939*PAL__DAS2R; 1301 pm_ra /= cos(dec_0); 1302 pm_dec = -2.00006*PAL__DAS2R; 1303 v_rad = -5.19; 1304 px = 0.08883*PAL__DAS2R; 1305 1306 palMappa(2000.0, 56999.87537249177, amprms); /* time is the TDB MJD calculated from 1307 a JD of 2457000.375 with astropy.time */ 1308 1309 palMapqk(ra_0, dec_0, pm_ra, pm_dec, px, v_rad, amprms, &ra_test, &dec_test); 1310 1311 iposn = 1; 1312 palDafin(radec_app, &iposn, &ra_app, &j); 1313 palDafin(radec_app, &iposn, &dec_app, &j); 1314 ra_app *= 15.0; 1315 1316 /* find the angular distance from the known mean position 1317 to the calculated mean postion */ 1318 double dd; 1319 dd = palDsep(ra_test, dec_test, ra_app, dec_app); 1320 dd *= PAL__DR2AS; 1321 vvd( dd, 0.0, 0.1, "palMapqk", "distance", status); 1322 } 1323 1272 1324 static void t_mapqkz( int *status ) { 1273 double amprms[21], ra, da; 1325 double amprms[21], ra, da, ra_c, da_c; 1326 1327 /* Run inputs through mapqk with zero proper motion, parallax 1328 and radial velocity. Then run the same inputs through mapqkz. 1329 Verify that the results are the same */ 1274 1330 palMappa( 2010.0, 55927.0, amprms ); 1331 palMapqk(1.234, -0.567, 0.0, 0.0, 0.0, 0.0, amprms, &ra_c, &da_c); 1275 1332 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 1333 vvd( ra, ra_c, 1.0E-12, "palMapqkz", "ra", status ); 1334 vvd( da, da_c, 1.0E-12, "palMapqkz", "da", status ); 1284 1335 } 1285 1336 … … 1288 1339 palMappa( 2010.0, 55927.0, amprms ); 1289 1340 palAmpqk( 1.234, -0.567, amprms, &rm, &dm ); 1290 vvd( rm, 1.2335120 411026936349, 1.0E-12, "palAmpqk", "rm", status );1291 vvd( dm, -0.5670290 8706930343907, 1.0E-12, "palAmpqk", "dm", status );1341 vvd( rm, 1.233512033578303857, 1.0E-12, "palAmpqk", "rm", status ); 1342 vvd( dm, -0.56702909748530827549, 1.0E-12, "palAmpqk", "dm", status ); 1292 1343 } 1293 1344 … … 2028 2079 t_map(&status); 2029 2080 t_mappa(&status); 2081 t_mapqk(&status); 2030 2082 t_mapqkz(&status); 2031 2083 t_moon(&status); … … 2055 2107 return status; 2056 2108 } 2057
Note:
See TracChangeset
for help on using the changeset viewer.