Changeset 18712 for trunk/FACT++


Ignore:
Timestamp:
01/06/17 11:51:27 (8 years ago)
Author:
tbretz
Message:
Updated to PAL 0.9.7 (adds mainly light deflection to abberation which was previously missing)
Location:
trunk/FACT++/pal
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/pal/.gitignore

    r18347 r18712  
    99*.o
    1010*.lo
     11*.lof
    1112*.la
    1213*.dSYM
  • trunk/FACT++/pal/component.xml

    r18347 r18712  
    44
    55<component id="pal" support="S">
    6   <version>0.9.3</version>
     6  <version>0.9.7</version>
    77  <path>libext/pal</path>
    88  <description>Positional Astronomy Library</description>
  • trunk/FACT++/pal/configure.ac

    r18347 r18712  
    33
    44dnl    Initialisation: package name and version number
    5 AC_INIT([pal],[0.9.3],[starlink@jiscmail.ac.uk])
     5AC_INIT([pal],[0.9.7],[starlink@jiscmail.ac.uk])
    66AC_CONFIG_AUX_DIR([build-aux])
    77
     
    5555  AC_DEFINE( [HAVE_STAR_UTIL_H], [1], [Define to 1 if you have the <star/util.h> header file])
    5656else
     57  AC_MSG_NOTICE([Building outside a Starlink environment])
    5758
    5859  #   Allow ERFA/SOFA location to be specified using --with-erfa=$ERFA_DIR
     
    118119
    119120  dnl  Disable document building regardless of --without-stardocs
    120   _star_build_docs=:
     121  _star_build_docs=false
    121122fi
    122123
  • trunk/FACT++/pal/pal.news

    r18347 r18712  
    44SLALIB API. It is distributed under the GPL and uses the SOFA library wherever
    55possible.
     6
     7V0.9.7
     8
     9- Enable light deflection in palAmpqk.
     10
     11V0.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
     16V0.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.
    622
    723V0.9.3
  • trunk/FACT++/pal/palAmpqk.c

    r18347 r18712  
    2626*        (0)      time interval for proper motion (Julian years)
    2727*        (1-3)    barycentric position of the Earth (AU)
    28 *        (4-6)    not used
    29 *        (7)      not used
     28*        (4-6)    heliocentric direction of the Earth (unit vector)
     29*        (7)      (grav rad Sun)*2/(Sun-Earth distance)
    3030*        (8-10)   abv: barycentric Earth velocity in units of c
    3131*        (11)     sqrt(1-v*v) where v=modulus(abv)
     
    4444*     function.
    4545
     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
    4653*  Authors:
    4754*     PTW: Pat Wallace (STFC)
     55*     TIMJ: Tim Jenness
    4856*     {enter_new_authors_here}
    4957
     
    5260*        Initial version.
    5361*        Adapted with permission from the Fortran SLALIB library.
     62*     2016-12-19 (TIMJ):
     63*        Add in light deflection (was missed in the initial port).
    5464*     {enter_further_changes_here}
    5565
     
    5767*     Copyright (C) 2000 Rutherford Appleton Laboratory
    5868*     Copyright (C) 2012 Science and Technology Facilities Council.
     69*     Copyright (C) 2016 Tim Jenness
    5970*     All Rights Reserved.
    6071
     
    91102   double p1[3], p2[3], p3[3]; /* work vectors */
    92103   double ab1p1, p1dv, p1dvp1, w;
     104   double gr2e, pde, pdep1, ehn[3], p[3];
    93105   int i, j;
    94106
    95107/* Unpack some of the parameters */
     108   gr2e = amprms[7];
    96109   ab1  = amprms[11];
    97110   for( i = 0; i < 3; i++ ) {
     111      ehn[i] = amprms[i + 4];
    98112      abv[i] = amprms[i + 8];
    99113   }
     
    123137   }
    124138
     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
    125156/* Mean RA,Dec */
    126    eraC2s( p1, rm, dm );
     157   eraC2s( p, rm, dm );
    127158   *rm = eraAnp( *rm );
    128159}
  • trunk/FACT++/pal/palMappa.c

    r18347 r18712  
    2626*        - (1-3)    barycentric position of the Earth (AU)
    2727*        - (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)
    2929*        - (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)
    3131*        - (12-20)  precession/nutation (3,3) matrix
    3232
  • trunk/FACT++/pal/palMapqk.c

    r18347 r18712  
    5252*     routine can be used instead.
    5353
     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
    5470*  Authors:
    5571*     PTW: Patrick T. Wallace
    5672*     TIMJ: Tim Jenness (JAC, Hawaii)
    5773*     {enter_new_authors_here}
    58 
    59 *  Notes:
    60 *     - The reference frames and timescales used are post IAU 2006.
    6174
    6275*  History:
     
    101114
    102115/* local constants */
    103    const double VF = 0.21094502; /* Km/s to AU/year */
     116   const double VF = 0.210945028; /* Km/s to AU/year */
    104117
    105118/* Local Variables: */
  • trunk/FACT++/pal/palMapqkz.c

    r18347 r18712  
    2525*        Star-independent mean-to-apparent parameters (see palMappa):
    2626*        (0-3)    not used
    27 *        (4-6)    not used
     27*        (4-6)    heliocentric direction of the Earth (unit vector)
    2828*        (7)      not used
    2929*        (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)
    3131*        (12-20)  precession/nutation (3,3) matrix
    3232*     ra = double * (Returned)
     
    5050*     The corresponding function for the case of non-zero parallax
    5151*     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.
    5770
    5871*  Authors:
     
    100113/* Local Variables: */
    101114   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];
    103117
    104118/* Unpack scalar and vector parameters. */
    105119   ab1 = amprms[11];
     120   gr2e = amprms[7];
    106121   for( i = 0; i < 3; i++ ) {
    107122      abv[i] = amprms[i+8];
     123      ehn[i] = amprms[i+4];
    108124   }
    109125
     
    111127   eraS2c( rm, dm, p );
    112128
     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
    113137/* Aberration. */
    114    p1dv = eraPdp( p, abv );
    115    p1dvp1 = p1dv + 1.0;
     138   p1dv = eraPdp( p1, abv );
    116139   w = 1.0 + p1dv / ( ab1 + 1.0 );
    117140   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] ) );
    119142   }
    120143
  • trunk/FACT++/pal/palTest.c

    r18347 r18712  
    276276  /* This is the palMapqk test */
    277277  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 );
     278  vvd( rm, 1.233512033578303857, 1.0E-12, "palAmp", "rm", status );
     279  vvd( dm, -0.56702909748530827549, 1.0E-12, "palAmp", "dm", status );
    280280}
    281281
     
    12701270}
    12711271
     1272static 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
    12721324static 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 */
    12741330   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);
    12751332   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 );
    12841335}
    12851336
     
    12881339   palMappa( 2010.0, 55927.0, amprms );
    12891340   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 );
     1341   vvd( rm, 1.233512033578303857, 1.0E-12, "palAmpqk", "rm", status );
     1342   vvd( dm, -0.56702909748530827549, 1.0E-12, "palAmpqk", "dm", status );
    12921343}
    12931344
     
    20282079  t_map(&status);
    20292080  t_mappa(&status);
     2081  t_mapqk(&status);
    20302082  t_mapqkz(&status);
    20312083  t_moon(&status);
     
    20552107  return status;
    20562108}
    2057 
Note: See TracChangeset for help on using the changeset viewer.