Changeset 32740
- Timestamp:
- Nov 22, 2011, 8:24:35 AM (14 years ago)
- Location:
- trunk/Ohana/src/relastro
- Files:
-
- 2 edited
-
include/relastro.h (modified) (1 diff)
-
src/ParFactor.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/relastro/include/relastro.h
r32695 r32740 315 315 int MeasFilterTest(Measure *measure, int applySigmaLim); 316 316 317 int sun_ecliptic (double jd, double *lambda, double *beta, double *epsilon );318 int ParFactor (double *pR, double *pD, double R , double D, double T, double Tmean);317 int sun_ecliptic (double jd, double *lambda, double *beta, double *epsilon, double *Radius); 318 int ParFactor (double *pR, double *pD, double RA, double Dec, double Time, double Tmean); 319 319 int FitPM (PMFit *fit, double *X, double *dX, double *Y, double *dY, double *T, int Npts, int XVERB); 320 320 int FitPar (PMFit *fit, double *X, double *dX, double *Y, double *dY, double *pR, double *pD, int Npts); -
trunk/Ohana/src/relastro/src/ParFactor.c
r27581 r32740 24 24 # endif 25 25 26 # if (0) 26 27 /* code borrowed from Skycalc : fix this stuff XXX */ 27 28 /* Low precision formulae for the sun, from Almanac p. C24 (1990) */ … … 40 41 return TRUE; 41 42 } 43 # endif 44 45 /* Low precision formulae for the sun, from Astro. Almanac p. C5 (2012) */ 46 int sun_ecliptic (double jd, double *lambda, double *beta, double *epsilon, double *Radius) { 47 48 # define J2000 2451545. /* Julian date at standard epoch */ 49 50 double n = jd - J2000; // day number 51 double L = 280.460 + 0.9856474 * n; // mean solar longitute (corr. for aberration) 52 double g = (357.528 + 0.9856003 * n)*RAD_DEG; // Mean anomaly 53 54 *lambda = L + 1.915 * sin(g) + 0.020 * sin(2*g); // solar longitude in degrees 55 *beta = 0.0; // approx latitude 56 *epsilon = (23.439 - 0.0000004 * n); // obliquity of ecliptic in degrees 57 *Radius = 1.00014 - 0.01671*cos(g) - 0.00014*cos(2*g); // earth-to-sun dist in AU 58 return TRUE; 59 } 42 60 43 61 /* given RA, DEC, Time, calculate the parallax factor */ 44 int ParFactor (double *pR, double *pD, double R , double D, double T, double Tmean) {62 int ParFactor (double *pR, double *pD, double RA, double DEC, double Time, double Tmean) { 45 63 46 double jd; 47 double L, B, E, e, s, r, d; 64 double jd, lambda, beta, epsilon, Radius; 48 65 49 66 /* given a time T in UNIX seconds, determine the solar longitude S */ 50 67 51 jd = ohana_sec_to_jd (365.25*86400.0*(T + Tmean));52 sun_ecliptic (jd, & L, &B, &E);68 jd = ohana_sec_to_jd (365.25*86400.0*(Time + Tmean)); 69 sun_ecliptic (jd, &lambda, &beta, &epsilon, &Radius); 53 70 54 e = E * RAD_DEG; 55 s = L * RAD_DEG; 56 r = R * RAD_DEG; 57 d = D * RAD_DEG; 58 59 *pR = +(cos(e)*sin(s)*cos(r) - cos(s)*sin(r)); 60 *pD = -(cos(e)*sin(s)*sin(r) + cos(s)*cos(r))*sin(d) + sin(e)*sin(s)*cos(d); 71 double lambda_rad = lambda*RAD_DEG; 72 double epsilon_rad = epsilon*RAD_DEG; 73 double RA_rad = RA*RAD_DEG; 74 double DEC_rad = DEC*RAD_DEG; 75 76 double x = Radius*cos(lambda_rad); 77 double y = Radius*cos(epsilon_rad)*sin(lambda_rad); 78 double z = Radius*sin(epsilon_rad)*sin(lambda_rad); 79 80 // original terms: 81 // *pR = +(cos(e)*sin(s)*cos(r) - cos(s)*sin(r)); 82 // *pD = -(cos(e)*sin(s)*sin(r) + cos(s)*cos(r))*sin(d) + sin(e)*sin(s)*cos(d); 83 84 // convert e->eps, s->lam, etc 85 // *pR = +(cos(eps)*sin(lam)*cos(ra) - cos(lam)*sin(ra)); 86 // *pD = -(cos(eps)*sin(lam)*sin(ra) + cos(lam)*cos(ra))*sin(dec) + sin(eps)*sin(lam)*cos(dec); 87 88 // convert to x,y,z 89 // *pR = +(y*cos(ra) - x*sin(ra)); 90 // *pD = -(y*sin(ra) + x*cos(ra))*sin(dec) + z*cos(dec); 91 92 // NOTE: seems to be identical to the old values, except I now include the varying solar distance 93 *pR = +(y*cos(RA_rad) - x*sin(RA_rad)); 94 *pD = -(y*sin(RA_rad) + x*cos(RA_rad))*sin(DEC_rad) + z*cos(DEC_rad); 95 61 96 return TRUE; 62 97 }
Note:
See TracChangeset
for help on using the changeset viewer.
