uncertainty.py 文件源码

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

项目:wurst 作者: IndEcol 项目源码 文件源码
def rescale_exchange(exc, value, remove_uncertainty=True):
    """Dummy function to rescale exchange amount and uncertainty.

    This depends on some code being separated from Ocelot, which will take a bit of time.

    * ``exc`` is an exchange dataset.
    * ``value`` is a number, to be multiplied by the existing amount.
    * ``remove_uncertainty``: Remove (unscaled) uncertainty data, default is ``True``.

    Returns the modified exchange."""
    assert isinstance(exc, dict), "Must pass exchange dictionary"
    assert isinstance(value, Number), "Constant factor ``value`` must be a number"

    exc['amount'] *= value

    FIELDS = ('shape', 'size', 'minimum', 'maximum')

    if remove_uncertainty:
        exc['uncertainty type'] = 0
        exc['loc'] = exc['amount']
        for field in FIELDS:
            if field in exc:
                del exc[field]

    return exc
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号