Changeset 41711
- Timestamp:
- Jul 12, 2021, 1:12:49 PM (5 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/tools/src/mpcorb_predict.c (modified) (22 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/tools/src/mpcorb_predict.c
r41710 r41711 33 33 } Planets; 34 34 35 typedef struct { 36 char ID[8]; 37 double Robs; 38 double Dobs; 39 double Rvel; 40 double Dvel; 41 double dist; 42 } PlanetDatum; 43 35 44 int Shutdown (char *format, ...); 36 45 int mpcorb_parseline (char *line, Planets *planet, int Nmax); … … 38 47 Planets *mpcorb_read_fits (char *filename, int *nplanets); 39 48 void mpcorb_save_fits (char *filename, Planets *planets, int Nplanets); 40 void mpcorb_refs_fits (char *filename, Planet s*planets, int Nplanets);41 42 void mpcorb_predict (Planets *planet, double mjdObs, double *Robs, double *Dobs, int FullCalc);49 void mpcorb_refs_fits (char *filename, PlanetDatum *planets, int Nplanets); 50 51 PlanetDatum mpcorb_predict (Planets *planet, double mjdObs, int FullCalc); 43 52 44 53 void mpcorb_trange (int argc, char **argv); … … 54 63 # define PS1_ALTITUDE 3067.7 /* meters */ 55 64 65 // some options (for testing) 66 int USE_AMP = FALSE; // otherwise use precess and/or nutation 67 int USE_PLANETARY_ABERRATION = FALSE; 68 int USE_MANUAL_PRECESS = FALSE; // otherwise use slaPreces 69 int USE_PRENUT = FALSE; // otherwise slaPrec 70 56 71 int main (int argc, char **argv) { 57 72 73 int N; 74 58 75 if (TESTING) mpcorb_testing (argc, argv); 76 77 // -none option so I can always supply an option in dvo script 78 if ((N = get_argument (argc, argv, "-none"))) { 79 remove_argument (N, &argc, argv); 80 } 81 82 // turn on / off some options 83 if ((N = get_argument (argc, argv, "-use-amp"))) { 84 USE_AMP = TRUE; 85 remove_argument (N, &argc, argv); 86 } 87 if ((N = get_argument (argc, argv, "-apply-planet-ab"))) { 88 USE_PLANETARY_ABERRATION = TRUE; 89 remove_argument (N, &argc, argv); 90 } 91 if ((N = get_argument (argc, argv, "-use-manual-precess"))) { 92 if (USE_AMP) Shutdown ("-use-amp and -use-manual-precess are incompatible"); 93 USE_MANUAL_PRECESS = TRUE; 94 remove_argument (N, &argc, argv); 95 } 96 if ((N = get_argument (argc, argv, "-use-prenut"))) { 97 if (USE_AMP) Shutdown ("-use-amp and -use-prenut are incompatible"); 98 if (!USE_MANUAL_PRECESS) Shutdown ("-use-prenut requires -use-manual-precess"); 99 USE_PRENUT = TRUE; 100 remove_argument (N, &argc, argv); 101 } 59 102 60 103 if ((argc != 9) && (argc != 10)) goto usage; … … 100 143 101 144 // is the object in the region for the start of the period? 102 double RatMin, DatMin; 103 mpcorb_predict (&planets[i], mjdMin, &RatMin, &DatMin, FALSE); 145 PlanetDatum plMin = mpcorb_predict (&planets[i], mjdMin, FALSE); 104 146 int inRangeMin = TRUE; 105 inRangeMin = inRangeMin && ( RatMin> Rmin);106 inRangeMin = inRangeMin && ( RatMin< Rmax);107 inRangeMin = inRangeMin && ( DatMin> Dmin);108 inRangeMin = inRangeMin && ( DatMin< Dmax);147 inRangeMin = inRangeMin && (plMin.Robs > Rmin); 148 inRangeMin = inRangeMin && (plMin.Robs < Rmax); 149 inRangeMin = inRangeMin && (plMin.Dobs > Dmin); 150 inRangeMin = inRangeMin && (plMin.Dobs < Dmax); 109 151 110 152 // is the object in the region for the end of the period? 111 double RatMax, DatMax; 112 mpcorb_predict (&planets[i], mjdMax, &RatMax, &DatMax, FALSE); 153 PlanetDatum plMax = mpcorb_predict (&planets[i], mjdMax, FALSE); 113 154 int inRangeMax = TRUE; 114 inRangeMax = inRangeMax && ( RatMax> Rmin);115 inRangeMax = inRangeMax && ( RatMax< Rmax);116 inRangeMax = inRangeMax && ( DatMax> Dmin);117 inRangeMax = inRangeMax && ( DatMax< Dmax);155 inRangeMax = inRangeMax && (plMax.Robs > Rmin); 156 inRangeMax = inRangeMax && (plMax.Robs < Rmax); 157 inRangeMax = inRangeMax && (plMax.Dobs > Dmin); 158 inRangeMax = inRangeMax && (plMax.Dobs < Dmax); 118 159 119 160 // NOTE: if an object is moving so fast that it traverses the entire region, we will … … 123 164 planetsSave[NplanetsSave] = planets[i]; 124 165 planetsSave[NplanetsSave].mjdMin = mjdMin; 125 planetsSave[NplanetsSave].RatMin = RatMin;126 planetsSave[NplanetsSave].DatMin = DatMin;166 planetsSave[NplanetsSave].RatMin = plMin.Robs; 167 planetsSave[NplanetsSave].DatMin = plMin.Dobs; 127 168 planetsSave[NplanetsSave].mjdMax = mjdMax; 128 planetsSave[NplanetsSave].RatMax = RatMax;129 planetsSave[NplanetsSave].DatMax = DatMax;169 planetsSave[NplanetsSave].RatMax = plMax.Robs; 170 planetsSave[NplanetsSave].DatMax = plMax.Dobs; 130 171 131 172 NplanetsSave++; … … 134 175 fprintf (stderr, "\n"); 135 176 177 // NOTE : here we are saving the full orbital elements 136 178 mpcorb_save_fits (output, planetsSave, NplanetsSave); 137 179 138 180 exit (0); 139 181 } 182 183 # define VERBOSE_TEST FALSE 140 184 141 185 // generate a table of asteroid positions which fall within the region at Tobs (in MJD) … … 152 196 char *output = argv[8]; 153 197 154 // FILE *fout = fopen (output, "w");155 // if (!fout) Shutdown ("ERROR: unable to open file for output %s\n", output);156 157 198 int Nplanets = 0; 158 199 Planets *planets = mpcorb_read_fits (filename, &Nplanets); … … 161 202 int NplanetsSave = 0; 162 203 int NPLANETSSAVE = 1000; 163 ALLOCATE_PTR (planetsSave, Planets, NPLANETSSAVE); 204 ALLOCATE_PTR (planetsSave, PlanetDatum, NPLANETSSAVE); 205 206 if (VERBOSE_TEST) { 207 // XXX for a test, I print out coords at steps in myAmpqk 208 for (int i = 0; i < 10; i++) { 209 mpcorb_predict (&planets[i], mjdObs, TRUE); 210 } 211 exit (0); 212 } 164 213 165 214 // transform all objects and identify those in the target region: … … 169 218 // is the object in the region for the start of the period? 170 219 // first, use the fast, but inaccurate, calculation 171 double Robs, Dobs; 172 mpcorb_predict (&planets[i], mjdObs, &Robs, &Dobs, FALSE); 173 if (Robs < Rmin) continue; 174 if (Robs > Rmax) continue; 175 if (Dobs < Dmin) continue; 176 if (Dobs > Dmax) continue; 220 PlanetDatum planetFast = mpcorb_predict (&planets[i], mjdObs, FALSE); 221 if (planetFast.Robs < Rmin) continue; 222 if (planetFast.Robs > Rmax) continue; 223 if (planetFast.Dobs < Dmin) continue; 224 if (planetFast.Dobs > Dmax) continue; 177 225 178 226 // if it is in the region, use the more accurate calculation 179 mpcorb_predict (&planets[i], mjdObs, &Robs, &Dobs, TRUE);227 PlanetDatum planetSlow = mpcorb_predict (&planets[i], mjdObs, TRUE); 180 228 181 229 // fprintf (fout, "%8s %12.6f %12.6f\n", planets[i].ID, Robs, Dobs); 182 230 183 231 // save this prediction, with R,D in both @min & @max 184 planetsSave[NplanetsSave] = planets[i]; 185 planetsSave[NplanetsSave].mjdMin = mjdObs; 186 planetsSave[NplanetsSave].RatMin = Robs; 187 planetsSave[NplanetsSave].DatMin = Dobs; 188 planetsSave[NplanetsSave].mjdMax = mjdObs; 189 planetsSave[NplanetsSave].RatMax = Robs; 190 planetsSave[NplanetsSave].DatMax = Dobs; 232 planetsSave[NplanetsSave] = planetSlow; 233 strcpy (planetsSave[NplanetsSave].ID, planets[i].ID); // ID is not passed to mpcorb_predict 191 234 192 235 NplanetsSave++; 193 CHECK_REALLOCATE (planetsSave, Planet s, NPLANETSSAVE, NplanetsSave, 1000);236 CHECK_REALLOCATE (planetsSave, PlanetDatum, NPLANETSSAVE, NplanetsSave, 1000); 194 237 } 195 238 fprintf (stderr, "\n"); … … 204 247 205 248 // write minor planet positions (Rref,Dref,Mref) to a FITS table 206 void mpcorb_refs_fits (char *filename, Planet s*planets, int Nplanets) {249 void mpcorb_refs_fits (char *filename, PlanetDatum *planets, int Nplanets) { 207 250 208 251 Header header; … … 218 261 gfits_create_table_header (&theader, "BINTABLE", "DATA"); 219 262 220 gfits_define_bintable_column (&theader, "8A", "ID", "name", "none", 1.0, 0.0); 221 gfits_define_bintable_column (&theader, "D", "Rref", "RA", "degrees", 1.0, 0.0); 222 gfits_define_bintable_column (&theader, "D", "Dref", "DEC", "degrees", 1.0, 0.0); 223 gfits_define_bintable_column (&theader, "D", "Mref", "Mag", "magnitudes", 1.0, 0.0); 263 gfits_define_bintable_column (&theader, "8A", "ID", "name", "none", 1.0, 0.0); 264 gfits_define_bintable_column (&theader, "D", "Rref", "RA", "degrees", 1.0, 0.0); 265 gfits_define_bintable_column (&theader, "D", "Dref", "DEC", "degrees", 1.0, 0.0); 266 gfits_define_bintable_column (&theader, "D", "Rvel", "RA_VEL", "arcsec/min", 1.0, 0.0); 267 gfits_define_bintable_column (&theader, "D", "Dvel", "DEC_VEL", "arcsec/min", 1.0, 0.0); 268 gfits_define_bintable_column (&theader, "D", "dist", "DIST", "AU", 1.0, 0.0); 269 gfits_define_bintable_column (&theader, "D", "Mref", "Mag", "magnitudes", 1.0, 0.0); 224 270 225 271 // generate the output array that carries the data … … 230 276 ALLOCATE_PTR (Rref, double, Nplanets); 231 277 ALLOCATE_PTR (Dref, double, Nplanets); 278 ALLOCATE_PTR (Rvel, double, Nplanets); 279 ALLOCATE_PTR (Dvel, double, Nplanets); 280 ALLOCATE_PTR (dist, double, Nplanets); 232 281 ALLOCATE_PTR (Mref, double, Nplanets); 233 282 234 283 // set intermediate storage arrays 235 284 for (int i = 0; i < Nplanets; i++) { 236 Rref[i] = planets[i].RatMin; 237 Dref[i] = planets[i].DatMin; 285 Rref[i] = planets[i].Robs; 286 Dref[i] = planets[i].Dobs; 287 Rvel[i] = planets[i].Rvel; 288 Dvel[i] = planets[i].Dvel; 289 dist[i] = planets[i].dist; 238 290 Mref[i] = 16.0; // need to add this to prediction 239 291 memcpy(&ID[i*8], planets[i].ID, 8); … … 244 296 gfits_set_bintable_column (&theader, &ftable, "Rref", Rref, Nplanets); 245 297 gfits_set_bintable_column (&theader, &ftable, "Dref", Dref, Nplanets); 298 gfits_set_bintable_column (&theader, &ftable, "Rvel", Rvel, Nplanets); 299 gfits_set_bintable_column (&theader, &ftable, "Dvel", Dvel, Nplanets); 300 gfits_set_bintable_column (&theader, &ftable, "dist", dist, Nplanets); 246 301 gfits_set_bintable_column (&theader, &ftable, "Mref", Mref, Nplanets); 247 302 … … 250 305 free (Rref); 251 306 free (Dref); 307 free (Rvel); 308 free (Dvel); 309 free (dist); 252 310 free (Mref); 253 311 … … 530 588 531 589 if (TESTING == 2) { 532 double Robs, Dobs;533 590 for (int i = 0; i < 10; i++) { 534 mpcorb_predict (&planets[i], mjdObs, &Robs, &Dobs, TRUE);591 PlanetDatum myPlanet = mpcorb_predict (&planets[i], mjdObs, TRUE); 535 592 char ra_string[64], de_string[64]; 536 hms_format (ra_string, 64, Robs/15.0);537 hms_format (de_string, 64, Dobs);538 fprintf (stderr, "result: %12.6f %12.6f : %s %s\n", Robs,Dobs, ra_string, de_string);593 hms_format (ra_string, 64, myPlanet.Robs/15.0); 594 hms_format (de_string, 64, myPlanet.Dobs); 595 fprintf (stderr, "result: %12.6f %12.6f : %s %s\n", myPlanet.Robs, myPlanet.Dobs, ra_string, de_string); 539 596 } 540 597 exit (0); … … 674 731 } 675 732 733 void myAmp ( double ra, double da, double date, double eq, double *rm, double *dm ); 734 676 735 // mjdObs is NOT in TT 677 void mpcorb_predict (Planets *planet, double mjdObs, double *Robs, double *Dobs, int FullCalc) {736 PlanetDatum mpcorb_predict (Planets *planet, double mjdObs, int FullCalc) { 678 737 679 738 int jstat; … … 683 742 684 743 Planets tmpPlanet; 744 PlanetDatum myPlanet; 745 myPlanet.Robs = NAN; 746 myPlanet.Dobs = NAN; 747 myPlanet.Rvel = NAN; 748 myPlanet.Dvel = NAN; 749 myPlanet.dist = NAN; 685 750 686 751 // correct the orbital elements to the perturbed version 752 tmpPlanet = *planet; 687 753 if (FullCalc) { slaPertel (2, 688 754 planet->epoch, … … 704 770 &jstat); 705 771 } else { 706 tmpPlanet = *planet; 772 // the function calls below require elements in radians 773 tmpPlanet.epoch = planet->epoch; 774 tmpPlanet.inclination = planet->inclination *RAD_DEG; 775 tmpPlanet.ascend_node = planet->ascend_node *RAD_DEG; 776 tmpPlanet.perihelion = planet->perihelion *RAD_DEG; 777 tmpPlanet.semimajor_a = planet->semimajor_a ; 778 tmpPlanet.eccentricity = planet->eccentricity; 779 tmpPlanet.mean_anomaly = planet->mean_anomaly*RAD_DEG; 707 780 } 708 781 … … 715 788 PS1_LATITUDE*RAD_DEG, 716 789 2, 717 planet->epoch,718 planet->inclination*RAD_DEG,719 planet->ascend_node*RAD_DEG,720 planet->perihelion*RAD_DEG,721 planet->semimajor_a,722 planet->eccentricity,723 planet->mean_anomaly*RAD_DEG,790 tmpPlanet.epoch, 791 tmpPlanet.inclination, 792 tmpPlanet.ascend_node, 793 tmpPlanet.perihelion, 794 tmpPlanet.semimajor_a, 795 tmpPlanet.eccentricity, 796 tmpPlanet.mean_anomaly, 724 797 0.0, &Rtopo, &Dtopo, &dist, &jstat); 798 myPlanet.dist = dist; 799 800 double dRobs = 0.0; // planetary aberration, if FullCalc 801 double dDobs = 0.0; // planetary aberration, if FullCalc 802 if (FullCalc) { 803 // calculate the velocity components 804 805 // find position one minute later 806 double Rtop2, Dtop2, dist2; 807 slaPlante (mjdObsTT + 60/86400.0, 808 PS1_LONGITUDE*RAD_DEG, 809 PS1_LATITUDE*RAD_DEG, 810 2, 811 tmpPlanet.epoch, 812 tmpPlanet.inclination, 813 tmpPlanet.ascend_node, 814 tmpPlanet.perihelion, 815 tmpPlanet.semimajor_a, 816 tmpPlanet.eccentricity, 817 tmpPlanet.mean_anomaly, 818 0.0, &Rtop2, &Dtop2, &dist2, &jstat); 819 820 myPlanet.Rvel = 3600.0*(Rtop2 - Rtopo)*DEG_RAD*cos(Dtopo); // this vector is wrong by the precession rotation 821 myPlanet.Dvel = 3600.0*(Dtop2 - Dtopo)*DEG_RAD; // this vector is wrong by the precession rotation 822 823 // include the correction for planetary aberration 824 // XXX make these constants more accurate 825 double dist_km = dist * 1.5e8; 826 double time_min = dist_km / 299792.459/ 60.0; 827 double Rlag = myPlanet.Rvel * time_min; // velocity is in arcsec / min 828 double Dlag = myPlanet.Dvel * time_min; // velocity is in arcsec / min 829 830 dRobs = Rlag / 3600.0 / cos(Dtopo); // RA degrees 831 dDobs = Dlag / 3600.0; // DEC degrees 832 } 725 833 726 834 // NOTE: the atm effects seem to be large and incompatible with MPC outputs. … … 749 857 double Rmean, Dmean; 750 858 if (FullCalc) { 751 slaAmp (Rap, Dap, mjdObsTT, 2000.0, &Rmean, &Dmean); 859 if (USE_AMP) { 860 // slaAmp (Rap, Dap, mjdObsTT, 2000.0, &Rmean, &Dmean); 861 myAmp (Rap, Dap, mjdObsTT, 2000.0, &Rmean, &Dmean); 862 } else { 863 // use slaPreces and do not correct for stellar aberration 864 // convert mjdObsTT to year 865 double epochYear = 2000.0 + (mjdObsTT - 51544.5) / 365.25; // J2000 = 51544.5 866 Rmean = Rap; 867 Dmean = Dap; 868 869 // use slalib precession and nutation: 870 if (USE_MANUAL_PRECESS) { 871 double pm[3][3], v1[3], v2[3]; 872 873 /* Convert RA,Dec to x,y,z */ 874 slaDcs2c ( Rmean, Dmean, v1 ); 875 876 // calculate the precession & nutation combined matrix: 877 if (USE_PRENUT) { 878 // slaPrenut ( epochYear, 51544.5, pm ); 879 slaPrenut ( 2000.0, mjdObsTT, pm ); // prenut is always mean-to-apparent 880 slaDimxv ( pm, v1, v2 ); // apply the inverse transformation 881 } else { 882 slaPrec ( epochYear, 2000.0, pm ); // precess from apparent-to-mean 883 slaDmxv ( pm, v1, v2 ); // apply the forward transformatio 884 } 885 886 /* Back to RA,Dec */ 887 slaDcc2s ( v2, &Rmean, &Dmean ); 888 889 // renorm to 0-360 890 Rmean = slaDranrm ( Rmean ); 891 } else { 892 slaPreces ("FK5", epochYear, 2000.000000, &Rmean, &Dmean); 893 } 894 // fprintf (stderr, "year: %f\n", epochYear); 895 } 752 896 } else {Rmean = Rap; Dmean = Dap; } 753 897 754 *Robs = Rmean * DEG_RAD; 755 *Dobs = Dmean * DEG_RAD; 898 if (USE_PLANETARY_ABERRATION) { 899 myPlanet.Robs = Rmean * DEG_RAD + dRobs; 900 myPlanet.Dobs = Dmean * DEG_RAD + dDobs; 901 } else { 902 myPlanet.Robs = Rmean * DEG_RAD; 903 myPlanet.Dobs = Dmean * DEG_RAD; 904 } 905 return myPlanet; 906 } 907 908 # define DISABLE_ABERRATION FALSE 909 # define DISABLE_DEFLECTION FALSE 910 911 void myAmpqk ( double ra, double da, double amprms[21], double *rm, double *dm ) { 912 double gr2e; /* (grav rad Sun)*2/(Sun-Earth distance) */ 913 double ab1; /* sqrt(1-v*v) where v=modulus of Earth vel */ 914 double ehn[3]; /* Earth position wrt Sun (unit vector, FK5) */ 915 double abv[3]; /* Earth velocity wrt SSB (c, FK5) */ 916 double p[3], p1[3], p2[3], p3[3]; /* work vectors */ 917 double ab1p1, p1dv, p1dvp1, w, pde, pdep1; 918 int i, j; 919 920 /* Unpack some of the parameters */ 921 gr2e = amprms[7]; 922 ab1 = amprms[11]; 923 for ( i = 0; i < 3; i++ ) { 924 ehn[i] = amprms[i + 4]; 925 abv[i] = amprms[i + 8]; 926 } 927 928 // invert and print out: 929 if (VERBOSE_TEST) { 930 double Rmean, Dmean; 931 Rmean = ra * DEG_RAD; 932 Dmean = da * DEG_RAD; 933 fprintf (stderr, "%12.6f %12.6f ", Rmean, Dmean); 934 } 935 936 /* Apparent RA,Dec to Cartesian */ 937 slaDcs2c ( ra, da, p3 ); 938 939 // invert and print out: 940 if (VERBOSE_TEST) { 941 double Rtmp, Dtmp, Rmean, Dmean; 942 slaDcc2s ( p3, &Rtmp, &Dtmp ); 943 Rtmp = slaDranrm ( Rtmp ); 944 Rmean = Rtmp * DEG_RAD; 945 Dmean = Dtmp * DEG_RAD; 946 fprintf (stderr, "C: %12.6f %12.6f ", Rmean, Dmean); 947 } 948 949 /* Precession and nutation */ 950 slaDimxv ( (double(*)[3]) &rms[12], p3, p2 ); 951 952 // invert and print out: 953 if (VERBOSE_TEST) { 954 double Rtmp, Dtmp, Rmean, Dmean; 955 slaDcc2s ( p2, &Rtmp, &Dtmp ); 956 Rtmp = slaDranrm ( Rtmp ); 957 Rmean = Rtmp * DEG_RAD; 958 Dmean = Dtmp * DEG_RAD; 959 fprintf (stderr, "P: %12.6f %12.6f ", Rmean, Dmean); 960 } 961 962 if (DISABLE_ABERRATION) { 963 // XXX : save result from p2 in p1 964 for ( i = 0; i < 3; i++ ) { 965 p1[i] = p2[i]; 966 } 967 } else { 968 /* Aberration */ 969 ab1p1 = ab1 + 1.0; 970 for ( i = 0; i < 3; i++ ) { 971 p1[i] = p2[i]; 972 } 973 for ( j = 0; j < 2; j++ ) { 974 p1dv = slaDvdv ( p1, abv ); 975 p1dvp1 = 1.0 + p1dv; 976 w = 1.0 + p1dv / ab1p1; 977 for ( i = 0; i < 3; i++ ) { 978 p1[i] = ( p1dvp1 * p2[i] - w * abv[i] ) / ab1; 979 } 980 slaDvn ( p1, p3, &w ); 981 for ( i = 0; i < 3; i++ ) { 982 p1[i] = p3[i]; 983 } 984 } 985 } 986 987 // invert and print out: 988 if (VERBOSE_TEST) { 989 double Rtmp, Dtmp, Rmean, Dmean; 990 slaDcc2s ( p1, &Rtmp, &Dtmp ); 991 Rtmp = slaDranrm ( Rtmp ); 992 Rmean = Rtmp * DEG_RAD; 993 Dmean = Dtmp * DEG_RAD; 994 fprintf (stderr, "A: %12.6f %12.6f ", Rmean, Dmean); 995 } 996 997 /* Light deflection */ 998 for ( i = 0; i < 3; i++ ) { 999 p[i] = p1[i]; 1000 } 1001 1002 // disable deflection: 1003 if (DISABLE_DEFLECTION) { 1004 1005 } else { 1006 for ( j = 0; j < 5; j++ ) { 1007 pde = slaDvdv ( p, ehn ); 1008 pdep1 = 1.0 + pde; 1009 w = pdep1 - gr2e * pde; 1010 for ( i = 0; i < 3; i++ ) { 1011 p[i] = ( pdep1 * p1[i] - gr2e * ehn[i] ) / w; 1012 } 1013 slaDvn ( p, p2, &w ); 1014 for ( i = 0; i < 3; i++ ) { 1015 p[i] = p2[i]; 1016 } 1017 } 1018 } 1019 1020 // invert and print out: 1021 if (VERBOSE_TEST) { 1022 double Rtmp, Dtmp, Rmean, Dmean; 1023 slaDcc2s ( p, &Rtmp, &Dtmp ); 1024 Rtmp = slaDranrm ( Rtmp ); 1025 Rmean = Rtmp * DEG_RAD; 1026 Dmean = Dtmp * DEG_RAD; 1027 fprintf (stderr, "D: %12.6f %12.6f\n", Rmean, Dmean); 1028 } 1029 1030 /* Mean RA,Dec */ 1031 slaDcc2s ( p, rm, dm ); 1032 *rm = slaDranrm ( *rm ); 1033 } 1034 1035 void myAmp ( double ra, double da, double date, double eq, double *rm, double *dm ) { 1036 1037 double amprms[21]; /* Mean-to-apparent parameters */ 1038 1039 slaMappa ( eq, date, amprms ); 1040 myAmpqk ( ra, da, amprms, rm, dm ); 756 1041 } 757 1042 … … 762 1047 763 1048 // fields I need: 764 1049 765 1050 // epoch : 21 - 25 766 1051 // inclination : 60 - 68 … … 912 1197 testPlanet.semimajor_a = 2.782049599999998; 913 1198 914 double Robs, Dobs; 915 mpcorb_predict (&testPlanet, epochUT, &Robs, &Dobs, TRUE); 916 917 fprintf (stderr, "%f vs %f : %f\n", 3.92105439135726600*DEG_RAD, Robs, 3600*(3.92105439135726600*DEG_RAD - Robs)); 918 fprintf (stderr, "%f vs %f : %f\n", -0.33499850519808244*DEG_RAD, Dobs, 3600*(-0.33499850519808244*DEG_RAD - Dobs)); 1199 PlanetDatum myPlanet = mpcorb_predict (&testPlanet, epochUT, TRUE); 1200 1201 fprintf (stderr, "%f vs %f : %f\n", 3.92105439135726600*DEG_RAD, myPlanet.Robs, 3600*(3.92105439135726600*DEG_RAD - myPlanet.Robs)); 1202 fprintf (stderr, "%f vs %f : %f\n", -0.33499850519808244*DEG_RAD, myPlanet.Dobs, 3600*(-0.33499850519808244*DEG_RAD - myPlanet.Dobs)); 919 1203 exit (0); 920 1204 }
Note:
See TracChangeset
for help on using the changeset viewer.
