fragility_curve.py 文件源码

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

项目:WNTR 作者: USEPA 项目源码 文件源码
def sample_damage_state(self, Pr):
        """
        Sample the damage state using a uniform random variable

         Parameters
        -----------
        Pr : pd.Dataframe
            Probability of exceeding a damage state

        Returns
        -------
        damage_state : pd.Series
            The damage state of each element
        """
        p = pd.Series(data = np.random.uniform(size=Pr.shape[0]), index=Pr.index)

        damage_state = pd.Series(data=[None]* Pr.shape[0], index=Pr.index)

        for DS_names in Pr.columns:
            damage_state[p < Pr[DS_names]] = DS_names

        return damage_state
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号