lens.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:MulensModel 作者: rpoleski 项目源码 文件源码
def _add_mass(self, new_mass, index):
        """
        Private function: Updates the total_mass and adds a component
        to the epsilon array if masses are added
        sequentially. e.g. the lens is defined by defining mass_1 and
        mass_2.
        """
        if not isinstance(new_mass, u.Quantity):
            new_mass *= u.solMass
        elif new_mass.unit.physical_type == 'dimensionless':
            new_mass *= u.solMass
        elif new_mass.unit.physical_type != 'mass':
            msg = 'wrong physical_type of new total_mass: {:}'
            raise ValueError(msg.format(new_mass.unit.physical_type))

        new_total_mass = self._total_mass + new_mass
        self._epsilon = self._total_mass * self._epsilon / new_total_mass
        self._epsilon = np.insert(
            self._epsilon, index, new_mass / new_total_mass)
        self._total_mass = new_total_mass
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号