def GetFluxRatio(sptlist, Tsec, xgrid):
"""
Returns the flux ratio between the secondary star of temperature Tsec
and the (possibly multiple) primary star(s) given in the
'sptlist' list (given as spectral types)
xgrid is a np.ndarray containing the x-coordinates to find the
flux ratio at (in nm)
"""
prim_flux = np.zeros(xgrid.size)
# Determine the flux from the primary star(s)
for spt in sptlist:
end = search("[0-9]", spt).end()
T = MS.Interpolate(MS.Temperature, spt[:end])
R = MS.Interpolate(MS.Radius, spt[:end])
prim_flux += Planck(xgrid * units.nm.to(units.cm), T) * R ** 2
# Determine the secondary star flux
s_spt = MS.GetSpectralType(MS.Temperature, Tsec)
R = MS.Interpolate(MS.Radius, s_spt)
sec_flux = Planck(xgrid * units.nm.to(units.cm), Tsec) * R ** 2
return sec_flux / prim_flux
评论列表
文章目录