def mag2diam(ref_mag, ref_band, teff, nbr_pts=10):
"""
Returns the DIAMETER (not radius) of a black body of a given
magnitude (U,B,V,R,I,J,H,K)
"""
filt = ALL_FILTERS[ref_band]
if nbr_pts != 10:
lam = _gen_lam_for_filter(filt, nbr_pts)
else:
lam = filt['span_10pts']
# flux in watts from magnitude
res = filt['flux_wm2m']*10**(-0.39809*ref_mag)*filt['delta_wl']
# integrated flux
res /= np.trapz(blackbody_spectral_irr(teff, lam), lam)
return 2*RAD2MAS*np.sqrt(res)
评论列表
文章目录