def test_limbdark(tol = 1e-4):
'''
Test the limb darkening normalization by comparing the total flux of
the star to what you get with the Stefan-Boltzmann law.
'''
# Instantiate the star
r = 0.1
teff = 3200
star = Star('A', m = 0.1, r = r, nz = 31, color = 'k',
limbdark = [u1], teff = teff)
# True luminosity
truth = 4 * np.pi * (r * RSUN) ** 2 * SBOLTZ * teff ** 4
# System
system = System(star, quiet = True)
system.distance = 12.2
# Compute the light curve
time = np.arange(0., 1., 10)
system.compute(time, lambda1 = 0.01, lambda2 = 1000, R = 3000)
# Luminosity
bol = np.trapz(system.flux[0], system.A.wavelength * 1e6)
lum = 4 * np.pi * bol * (12.2 * PARSEC) ** 2
# Check!
assert np.abs(lum - truth) / truth < tol, \
"Incorrect bolometric flux: %.10e != %.10e." % (lum, truth)
评论列表
文章目录