def absolute_magnitude(parallax, m):
"""Calculate the absolute magnitude based on distance and apparent mag.
Inputs
------
parallax : float
The parallax in mas
m : float
The apparent magnitude
Output
------
M : float
The absolute magnitude
"""
d = 1. / (parallax*1e-3) # Conversion to arcsecond before deriving distance
mu = 5 * np.log10(d) - 5
M = m - mu
return M
评论列表
文章目录