Changeset 32854
- Timestamp:
- Dec 2, 2011, 11:47:26 AM (15 years ago)
- Location:
- branches/eam_branches/ipp-20111122/Ohana/src/relastro
- Files:
-
- 1 added
- 4 edited
-
Makefile (modified) (2 diffs)
-
doc/plx_factor.pro (added)
-
src/ParFactor.c (modified) (5 diffs)
-
src/UpdateObjects.c (modified) (1 diff)
-
src/testparallax.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20111122/Ohana/src/relastro/Makefile
r32346 r32854 18 18 19 19 relastro: $(BIN)/relastro.$(ARCH) 20 install: $(DESTBIN)/relastro 20 install: $(DESTBIN)/relastro $(DESTBIN)/testparallax 21 21 22 22 RELASTRO = \ … … 68 68 $(RELASTRO): $(INC)/relastro.h $(KAPA_INCS) 69 69 $(BIN)/relastro.$(ARCH): $(RELASTRO) $(KAPA_LIBS) 70 71 testparallax: $(BIN)/testparallax.$(ARCH) 72 73 TESTPAR = \ 74 $(SRC)/FitPMandPar.$(ARCH).o \ 75 $(SRC)/ParFactor.$(ARCH).o \ 76 $(SRC)/fitpoly.$(ARCH).o \ 77 $(SRC)/mkpolyterm.$(ARCH).o \ 78 $(SRC)/testparallax.$(ARCH).o 79 80 $(TESTPAR): $(INC)/relastro.h $(KAPA_INCS) 81 $(BIN)/testparallax.$(ARCH): $(TESTPAR) $(KAPA_LIBS) -
branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/ParFactor.c
r32740 r32854 1 1 # include "relastro.h" 2 # define J2000 2451545. /* Julian date at standard epoch */ 2 3 3 4 # if (0) … … 31 32 double n, L, g; 32 33 33 # define J2000 2451545. /* Julian date at standard epoch */34 34 35 35 n = jd - J2000; … … 46 46 int sun_ecliptic (double jd, double *lambda, double *beta, double *epsilon, double *Radius) { 47 47 48 # define J2000 2451545. /* Julian date at standard epoch */49 50 48 double n = jd - J2000; // day number 51 49 double L = 280.460 + 0.9856474 * n; // mean solar longitute (corr. for aberration) … … 60 58 61 59 /* given RA, DEC, Time, calculate the parallax factor */ 60 // Time is relative to Tmean, Tmean is years relative to J2000 62 61 int ParFactor (double *pR, double *pD, double RA, double DEC, double Time, double Tmean) { 63 62 … … 66 65 /* given a time T in UNIX seconds, determine the solar longitude S */ 67 66 68 jd = ohana_sec_to_jd (365.25*86400.0*(Time + Tmean)); 67 // jd = ohana_sec_to_jd (365.25*86400.0*(Time + Tmean)); 68 jd = 365.25*(Time + Tmean) + J2000; 69 // fprintf (stderr, "Time: %f, jd: %f\n", Time, jd); 70 69 71 sun_ecliptic (jd, &lambda, &beta, &epsilon, &Radius); 70 72 -
branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/UpdateObjects.c
r32695 r32854 133 133 R[N] = getMeanR (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*Nsecfilt]); 134 134 D[N] = getMeanD (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*Nsecfilt]); 135 136 // XXX I think this is a problem: T[] is time in years relative to J2000, but ParFactor expects 137 // to get Time in years relative to UNIX Tzero (1970/01/01) 135 138 T[N] = (catalog[i].measure[m].t - T2000) / (86400*365.25) ; // time relative to J2000 in years 136 139 -
branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/testparallax.c
r32741 r32854 1 1 # include "relastro.h" 2 # define NPTS 64 3 # define J2000 2451545. /* Julian date at standard epoch */ 4 # define T1970 2440587.500000 /* JD at UNIX ref time */ 2 5 3 6 int main (int argc, char **argv) { 7 8 int i, Npts; 9 char line[1024]; 10 double R[NPTS], D[NPTS], Time[NPTS], JD[NPTS]; 11 double X[NPTS], Y[NPTS], dX[NPTS], dY[NPTS], pX[NPTS], pY[NPTS]; 12 double Tref[NPTS], Tjyrs[NPTS], TrefS, TjyrsS, TrefMean, TjyrsMean, Ro, Do; 13 Coords coords; 14 PMFit fitPAR; 4 15 5 if (argc != N) { 6 fprintf (stderr, "USAGE: testparallax (file.dat)\n"); 7 exit (1); 16 if (argc != 2) { 17 fprintf (stderr, "USAGE: testparallax (file.dat)\n"); 18 exit (1); 19 } 20 21 // test parallax program 22 FILE *f = fopen (argv[1], "r"); 23 if (!f) { fprintf (stderr, "failed to open %s\n", argv[1]); exit (2); } 24 25 // XXX uncomment to skip first line scan_line(f, line); 26 27 Npts = 0; 28 for (i = 0; scan_line(f, line) != EOF; i++) { 29 if (Npts == NPTS) { 30 fprintf (stderr, "too many point: use dynamic alloc\n"); 31 exit (2); 8 32 } 33 if (line[0] == '#') continue; 34 dparse (&R[Npts], 1, line); 35 dparse (&D[Npts], 2, line); 36 dparse (&JD[Npts], 3, line); 37 dparse (&Time[Npts], 3, line); 9 38 10 // test parallax program 11 FILE *f = fopen (argv[1], "r"); 12 if (!f) { fprintf (stderr, "failed to open %s\n", argv[1]); exit (2); } 39 dparse (&dX[Npts], 4, line); 40 dparse (&dY[Npts], 4, line); 13 41 14 char buffer[1024]; 15 scan_line(f, line); 16 17 while (scan_line(f, line) != EOF) { 18 dparse (&jd, 1, line); 19 dparse (&time, 2, line); 20 dparse (&ra, 3, line); 21 dparse (&dec, 4, line); 42 // trent's file 43 // dparse (&JD[Npts], 1, line); 44 // dparse (&Time[Npts], 2, line); 45 // dparse (&R[Npts], 3, line); 46 // dparse (&D[Npts], 4, line); 47 Npts ++; 48 } 22 49 23 } 50 /* project coordinates to a plane centered on the object with units of arcsec */ 51 coords.crval1 = 0; 52 coords.crval2 = 0; 53 coords.crpix1 = 0; 54 coords.crpix2 = 0; 55 coords.cdelt1 = coords.cdelt2 = 1.0 / 3600.0; 56 coords.pc1_1 = coords.pc2_2 = 1.0; 57 coords.pc1_2 = coords.pc2_1 = 0.0; 58 coords.Npolyterms = 1; 59 strcpy (coords.ctype, "RA---SIN"); 24 60 25 // project to local coords 61 // use one point as a local reference 62 coords.crval1 = R[0]; 63 coords.crval2 = D[0]; 26 64 27 // run fitter 28 FitPMandPar 65 TrefS = TjyrsS = 0.0; 29 66 67 // project to local coords 68 for (i = 0; i < Npts; i++) { 69 RD_to_XY (&X[i], &Y[i], R[i], D[i], &coords); 30 70 71 Tjyrs[i] = Time[i] / 365.25; 72 Tref[i] = Time[i] / 365.25; 73 // Tunix[i] = (JD[i] - T1970) / 365.25; // time relative to T1970 in years 74 // Tjyrs[i] = (JD[i] - J2000) / 365.25; // time relative to J2000 in years 75 76 TrefS += Tref[i]; 77 TjyrsS += Tjyrs[i]; 78 79 // nominal for PS1 80 // dX[i] = 0.020; 81 // dY[i] = 0.020; 82 } 83 TrefMean = TrefS / Npts; 84 TjyrsMean = TjyrsS / Npts; 85 86 for (i = 0; i < Npts; i++) { 87 Tref[i] -= TrefMean; 88 ParFactor (&pX[i], &pY[i], R[i], D[i], Tjyrs[i], 0.0); 89 fprintf (stderr, "%f %f : %f %f : %f %f : %f %f\n", R[i], D[i], X[i], Y[i], Tref[i], Tjyrs[i], pX[i], pY[i]); 90 } 91 92 // run fitter 93 // FitPMandPar (&fitPAR, X, dX, Y, dY, Tref, pX, pY, Npts, TRUE); 94 FitPMandPar (&fitPAR, X, dX, Y, dY, Tjyrs, pX, pY, Npts, TRUE); 95 XY_to_RD (&Ro, &Do, fitPAR.Ro, fitPAR.Do, &coords); 96 97 fprintf (stderr, "Rx : %f\n", fitPAR.Ro); 98 fprintf (stderr, "Dx : %f\n", fitPAR.Do); 99 fprintf (stderr, "Ro : %f\n", Ro); 100 fprintf (stderr, "Do : %f\n", Do); 101 fprintf (stderr, "dRo : %f\n", fitPAR.dRo); 102 fprintf (stderr, "dDo : %f\n", fitPAR.dDo); 103 fprintf (stderr, "uR : %f\n", fitPAR.uR); 104 fprintf (stderr, "uD : %f\n", fitPAR.uD); 105 fprintf (stderr, "duR : %f\n", fitPAR.duR); 106 fprintf (stderr, "duD : %f\n", fitPAR.duD); 107 fprintf (stderr, "p : %f\n", fitPAR.p); 108 fprintf (stderr, "dp : %f\n", fitPAR.dp); 109 fprintf (stderr, "uTot : %f\n", hypot(fitPAR.uR,fitPAR.uD)); 110 fprintf (stderr, "PA : %f\n", DEG_RAD*atan2(fitPAR.uR,fitPAR.uD) + 360.0); 111 112 exit (0); 31 113 } 114
Note:
See TracChangeset
for help on using the changeset viewer.
