Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lunar magnitude fix. #270

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions libastro/circum.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,8 @@ moon_cir (Now *np, Obj *op)
double el; /* elongation, rads east */
double ms; /* sun's mean anomaly */
double md; /* moon's mean anomaly */
double i;
double pang; /* moon's geocentric phase angle */
double i, p;

moon (mjed, &lam, &bet, &edistau, &ms, &md); /* mean ecliptic & EOD*/
sunpos (mjed, &lsn, &rsn, NULL); /* mean ecliptic & EOD*/
Expand All @@ -586,15 +587,33 @@ moon_cir (Now *np, Obj *op)
op->s_sdist = (float) sqrt (edistau*edistau + rsn*rsn
- 2.0*edistau*rsn*cos(el));

/* TODO: improve mag; this is based on a flat moon model. */
i = -12.7 + 2.5*(log10(PI) - log10(PI/2*(1+1.e-6-cos(el))))
+ 5*log10(edistau/.0025) /* dist */;
set_smag (op, i);

/* find phase -- allow for projection effects */
i = 0.1468*sin(el)*(1 - 0.0549*sin(md))/(1 - 0.0167*sin(ms));
op->s_phase = (float)((1+cos(PI-el-degrad(i)))/2*100);

/* moon's geocentric magnitude based on methodology described in Lane,
* Adair P.; Irvine, William M. 1973. Monochromatic phase curves and
* albedos for the lunar disk. Astronomical Journal, Vol. 78, pp. 267-277.
* Using V band data from their Table V.
*/
pang = raddeg(acos(op->s_phase / 50.0 - 1.0)); /* need range 0-180 degrees */
if (pang <= 40.0) {
p = pang - 20.0;
i = -12.72 + 0.0267 * p + 0.534;
} else {
p = pang - 80.0;
i = -12.72 + p * (0.03188 + p * (1.9621e-4 + p * 1.7256e-6)) + 2.14;
}

#define mean_em_dist (60.2665 * ERAD / MAU) /* mean earth-moon distance in AU
(factor from above reference). */
/* correct for earth-moon distance. */
i += 5.0 * log10(edistau / mean_em_dist);
/* correct for moon-sun distance */
i += 5.0 * log10(op->s_sdist);

set_smag (op, i);

/* fill moon's ra/dec, alt/az in op and update for topo dist */
cir_pos (np, bet, lam, &edistau, op);

Expand Down
Loading