| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | /* | 
| 2 |  |  |  |  |  |  | *+ | 
| 3 |  |  |  |  |  |  | *  Name: | 
| 4 |  |  |  |  |  |  | *     palFk45z | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | *  Purpose: | 
| 7 |  |  |  |  |  |  | *     Convert B1950.0 FK4 star data to J2000.0 FK5 assuming zero | 
| 8 |  |  |  |  |  |  | *     proper motion in the FK5 frame | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | *  Language: | 
| 11 |  |  |  |  |  |  | *     Starlink ANSI C | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | *  Type of Module: | 
| 14 |  |  |  |  |  |  | *     Library routine | 
| 15 |  |  |  |  |  |  |  | 
| 16 |  |  |  |  |  |  | *  Invocation: | 
| 17 |  |  |  |  |  |  | *     palFk45z( double r1950, double d1950, double bepoch, double *r2000, | 
| 18 |  |  |  |  |  |  | *               double *d2000 ) | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | *  Arguments: | 
| 21 |  |  |  |  |  |  | *     r1950 = double (Given) | 
| 22 |  |  |  |  |  |  | *        B1950.0 FK4 RA at epoch (radians). | 
| 23 |  |  |  |  |  |  | *     d1950 = double (Given) | 
| 24 |  |  |  |  |  |  | *        B1950.0 FK4 Dec at epoch (radians). | 
| 25 |  |  |  |  |  |  | *     bepoch = double (Given) | 
| 26 |  |  |  |  |  |  | *        Besselian epoch (e.g. 1979.3) | 
| 27 |  |  |  |  |  |  | *     r2000 = double (Returned) | 
| 28 |  |  |  |  |  |  | *        J2000.0 FK5 RA (Radians). | 
| 29 |  |  |  |  |  |  | *     d2000 = double (Returned) | 
| 30 |  |  |  |  |  |  | *        J2000.0 FK5 Dec(Radians). | 
| 31 |  |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  | *  Description: | 
| 33 |  |  |  |  |  |  | *     Convert B1950.0 FK4 star data to J2000.0 FK5 assuming zero | 
| 34 |  |  |  |  |  |  | *     proper motion in the FK5 frame (double precision) | 
| 35 |  |  |  |  |  |  | * | 
| 36 |  |  |  |  |  |  | *     This function converts stars from the Bessel-Newcomb, FK4 | 
| 37 |  |  |  |  |  |  | *     system to the IAU 1976, FK5, Fricke system, in such a | 
| 38 |  |  |  |  |  |  | *     way that the FK5 proper motion is zero.  Because such a star | 
| 39 |  |  |  |  |  |  | *     has, in general, a non-zero proper motion in the FK4 system, | 
| 40 |  |  |  |  |  |  | *     the routine requires the epoch at which the position in the | 
| 41 |  |  |  |  |  |  | *     FK4 system was determined. | 
| 42 |  |  |  |  |  |  | * | 
| 43 |  |  |  |  |  |  | *     The method is from Appendix 2 of Ref 1, but using the constants | 
| 44 |  |  |  |  |  |  | *     of Ref 4. | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | *  Notes: | 
| 47 |  |  |  |  |  |  | *     - The epoch BEPOCH is strictly speaking Besselian, but if a | 
| 48 |  |  |  |  |  |  | *     Julian epoch is supplied the result will be affected only to | 
| 49 |  |  |  |  |  |  | *     a negligible extent. | 
| 50 |  |  |  |  |  |  | * | 
| 51 |  |  |  |  |  |  | *     - Conversion from Besselian epoch 1950.0 to Julian epoch 2000.0 | 
| 52 |  |  |  |  |  |  | *     only is provided for.  Conversions involving other epochs will | 
| 53 |  |  |  |  |  |  | *     require use of the appropriate precession, proper motion, and | 
| 54 |  |  |  |  |  |  | *     E-terms routines before and/or after palFk45z is called. | 
| 55 |  |  |  |  |  |  | * | 
| 56 |  |  |  |  |  |  | *     - In the FK4 catalogue the proper motions of stars within 10 | 
| 57 |  |  |  |  |  |  | *     degrees of the poles do not embody the differential E-term effect | 
| 58 |  |  |  |  |  |  | *     and should, strictly speaking, be handled in a different manner | 
| 59 |  |  |  |  |  |  | *     from stars outside these regions. However, given the general lack | 
| 60 |  |  |  |  |  |  | *     of homogeneity of the star data available for routine astrometry, | 
| 61 |  |  |  |  |  |  | *     the difficulties of handling positions that may have been | 
| 62 |  |  |  |  |  |  | *     determined from astrometric fields spanning the polar and non-polar | 
| 63 |  |  |  |  |  |  | *     regions, the likelihood that the differential E-terms effect was not | 
| 64 |  |  |  |  |  |  | *     taken into account when allowing for proper motion in past | 
| 65 |  |  |  |  |  |  | *     astrometry, and the undesirability of a discontinuity in the | 
| 66 |  |  |  |  |  |  | *     algorithm, the decision has been made in this routine to include the | 
| 67 |  |  |  |  |  |  | *     effect of differential E-terms on the proper motions for all stars, | 
| 68 |  |  |  |  |  |  | *     whether polar or not.  At epoch 2000, and measuring on the sky rather | 
| 69 |  |  |  |  |  |  | *     than in terms of dRA, the errors resulting from this simplification | 
| 70 |  |  |  |  |  |  | *     are less than 1 milliarcsecond in position and 1 milliarcsecond per | 
| 71 |  |  |  |  |  |  | *     century in proper motion. | 
| 72 |  |  |  |  |  |  | * | 
| 73 |  |  |  |  |  |  | *  References: | 
| 74 |  |  |  |  |  |  | *     - Aoki,S., et al, 1983.  Astron.Astrophys., 128, 263. | 
| 75 |  |  |  |  |  |  | *     - Smith, C.A. et al, 1989.  "The transformation of astrometric | 
| 76 |  |  |  |  |  |  | *       catalog systems to the equinox J2000.0".  Astron.J. 97, 265. | 
| 77 |  |  |  |  |  |  | *     - Yallop, B.D. et al, 1989.  "Transformation of mean star places | 
| 78 |  |  |  |  |  |  | *       from FK4 B1950.0 to FK5 J2000.0 using matrices in 6-space". | 
| 79 |  |  |  |  |  |  | *       Astron.J. 97, 274. | 
| 80 |  |  |  |  |  |  | *     - Seidelmann, P.K. (ed), 1992.  "Explanatory Supplement to | 
| 81 |  |  |  |  |  |  | *       the Astronomical Almanac", ISBN 0-935702-68-7. | 
| 82 |  |  |  |  |  |  |  | 
| 83 |  |  |  |  |  |  | *  Authors: | 
| 84 |  |  |  |  |  |  | *     PTW: Pat Wallace (STFC) | 
| 85 |  |  |  |  |  |  | *     DSB: David Berry (JAC, Hawaii) | 
| 86 |  |  |  |  |  |  | *     {enter_new_authors_here} | 
| 87 |  |  |  |  |  |  |  | 
| 88 |  |  |  |  |  |  | *  History: | 
| 89 |  |  |  |  |  |  | *     2012-02-10 (DSB): | 
| 90 |  |  |  |  |  |  | *        Initial version with documentation taken from Fortran SLA | 
| 91 |  |  |  |  |  |  | *        Adapted with permission from the Fortran SLALIB library. | 
| 92 |  |  |  |  |  |  | *     {enter_further_changes_here} | 
| 93 |  |  |  |  |  |  |  | 
| 94 |  |  |  |  |  |  | *  Copyright: | 
| 95 |  |  |  |  |  |  | *     Copyright (C) 1998 Rutherford Appleton Laboratory | 
| 96 |  |  |  |  |  |  | *     Copyright (C) 2012 Science and Technology Facilities Council. | 
| 97 |  |  |  |  |  |  | *     All Rights Reserved. | 
| 98 |  |  |  |  |  |  |  | 
| 99 |  |  |  |  |  |  | *  Licence: | 
| 100 |  |  |  |  |  |  | *     This program is free software: you can redistribute it and/or | 
| 101 |  |  |  |  |  |  | *     modify it under the terms of the GNU Lesser General Public | 
| 102 |  |  |  |  |  |  | *     License as published by the Free Software Foundation, either | 
| 103 |  |  |  |  |  |  | *     version 3 of the License, or (at your option) any later | 
| 104 |  |  |  |  |  |  | *     version. | 
| 105 |  |  |  |  |  |  | * | 
| 106 |  |  |  |  |  |  | *     This program is distributed in the hope that it will be useful, | 
| 107 |  |  |  |  |  |  | *     but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| 108 |  |  |  |  |  |  | *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
| 109 |  |  |  |  |  |  | *     GNU Lesser General Public License for more details. | 
| 110 |  |  |  |  |  |  | * | 
| 111 |  |  |  |  |  |  | *     You should have received a copy of the GNU Lesser General | 
| 112 |  |  |  |  |  |  | *     License along with this program.  If not, see | 
| 113 |  |  |  |  |  |  | *     . | 
| 114 |  |  |  |  |  |  |  | 
| 115 |  |  |  |  |  |  | *  Bugs: | 
| 116 |  |  |  |  |  |  | *     {note_any_bugs_here} | 
| 117 |  |  |  |  |  |  | *- | 
| 118 |  |  |  |  |  |  | */ | 
| 119 |  |  |  |  |  |  |  | 
| 120 |  |  |  |  |  |  | #include "pal.h" | 
| 121 |  |  |  |  |  |  | #include "palmac.h" | 
| 122 |  |  |  |  |  |  | #include "pal1sofa.h" | 
| 123 |  |  |  |  |  |  |  | 
| 124 | 4 |  |  |  |  |  | void palFk45z( double r1950, double d1950, double bepoch, double *r2000, | 
| 125 |  |  |  |  |  |  | double *d2000 ){ | 
| 126 |  |  |  |  |  |  |  | 
| 127 |  |  |  |  |  |  | /* Local Variables: */ | 
| 128 |  |  |  |  |  |  | double w; | 
| 129 |  |  |  |  |  |  | int i; | 
| 130 |  |  |  |  |  |  | int j; | 
| 131 |  |  |  |  |  |  | double r0[3], a1[3], v1[3], v2[6]; /* Position and position+velocity vectors */ | 
| 132 |  |  |  |  |  |  |  | 
| 133 |  |  |  |  |  |  |  | 
| 134 |  |  |  |  |  |  | /* CANONICAL CONSTANTS  (see references) */ | 
| 135 |  |  |  |  |  |  |  | 
| 136 |  |  |  |  |  |  | /* Vector A. */ | 
| 137 | 4 |  |  |  |  |  | double a[3] = { -1.62557E-6, -0.31919E-6, -0.13843E-6 }; | 
| 138 |  |  |  |  |  |  |  | 
| 139 |  |  |  |  |  |  | /* Vectors Adot. */ | 
| 140 | 4 |  |  |  |  |  | double ad[3] = { 1.245E-3, -1.580E-3, -0.659E-3 }; | 
| 141 |  |  |  |  |  |  |  | 
| 142 |  |  |  |  |  |  | /* Matrix M (only half of which is needed here). */ | 
| 143 | 4 |  |  |  |  |  | double em[6][3] = { {0.9999256782, -0.0111820611, -0.0048579477}, | 
| 144 |  |  |  |  |  |  | {0.0111820610, 0.9999374784, -0.0000271765}, | 
| 145 |  |  |  |  |  |  | {0.0048579479, -0.0000271474, 0.9999881997}, | 
| 146 |  |  |  |  |  |  | {-0.000551, -0.238565, 0.435739}, | 
| 147 |  |  |  |  |  |  | {0.238514, -0.002667, -0.008541}, | 
| 148 |  |  |  |  |  |  | {-0.435623, 0.012254, 0.002117} }; | 
| 149 |  |  |  |  |  |  |  | 
| 150 |  |  |  |  |  |  |  | 
| 151 |  |  |  |  |  |  | /* Spherical to Cartesian. */ | 
| 152 | 4 |  |  |  |  |  | eraS2c( r1950, d1950, r0 ); | 
| 153 |  |  |  |  |  |  |  | 
| 154 |  |  |  |  |  |  | /* Adjust vector A to give zero proper motion in FK5. */ | 
| 155 | 4 |  |  |  |  |  | w = ( bepoch - 1950.0 )/PAL__PMF; | 
| 156 | 16 | 100 |  |  |  |  | for( i = 0; i < 3; i++ ) { | 
| 157 | 12 |  |  |  |  |  | a1[ i ] = a[ i ] + w*ad[ i ]; | 
| 158 |  |  |  |  |  |  | } | 
| 159 |  |  |  |  |  |  |  | 
| 160 |  |  |  |  |  |  | /* Remove e-terms. */ | 
| 161 | 4 |  |  |  |  |  | w = r0[ 0 ]*a1[ 0 ] + r0[ 1 ]*a1[ 1 ] + r0[ 2 ]*a1[ 2 ]; | 
| 162 | 16 | 100 |  |  |  |  | for( i = 0; i < 3; i++ ) { | 
| 163 | 12 |  |  |  |  |  | v1[ i ] = r0[ i ] - a1[ i ] + w*r0[ i ]; | 
| 164 |  |  |  |  |  |  | } | 
| 165 |  |  |  |  |  |  |  | 
| 166 |  |  |  |  |  |  | /* Convert position vector to Fricke system. */ | 
| 167 | 28 | 100 |  |  |  |  | for( i = 0; i < 6; i++ ) { | 
| 168 | 24 |  |  |  |  |  | w = 0.0; | 
| 169 | 96 | 100 |  |  |  |  | for( j = 0; j < 3; j++ ) { | 
| 170 | 72 |  |  |  |  |  | w += em[ i ][ j ]*v1[ j ]; | 
| 171 |  |  |  |  |  |  | } | 
| 172 | 24 |  |  |  |  |  | v2[ i ] = w; | 
| 173 |  |  |  |  |  |  | } | 
| 174 |  |  |  |  |  |  |  | 
| 175 |  |  |  |  |  |  | /* Allow for fictitious proper motion in FK4. */ | 
| 176 | 4 |  |  |  |  |  | w = ( palEpj( palEpb2d( bepoch ) ) - 2000.0 )/PAL__PMF; | 
| 177 | 16 | 100 |  |  |  |  | for( i = 0; i < 3; i++ ) { | 
| 178 | 12 |  |  |  |  |  | v2[ i ] += w*v2[ i + 3 ]; | 
| 179 |  |  |  |  |  |  | } | 
| 180 |  |  |  |  |  |  |  | 
| 181 |  |  |  |  |  |  | /* Revert to spherical coordinates. */ | 
| 182 | 4 |  |  |  |  |  | eraC2s( v2, &w, d2000 ); | 
| 183 | 4 |  |  |  |  |  | *r2000 = eraAnp( w ); | 
| 184 | 4 |  |  |  |  |  | } | 
| 185 |  |  |  |  |  |  |  | 
| 186 |  |  |  |  |  |  |  |