def distance(self, new_distance):
if new_distance is None:
self._distance = new_distance
else:
if not isinstance(new_distance, u.Quantity):
self._distance = new_distance * 1000. * u.pc
else:
if (new_distance.unit == "pc") or (new_distance.unit == "kpc"):
self._distance = new_distance
else:
raise u.UnitsError(
'Allowed units for Source distance are "pc" or "kpc"')
评论列表
文章目录