dsp.py 文件源码

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

项目:nmmn 作者: rsnemmen 项目源码 文件源码
def error_resampler(errors):
    """
For use with ``pandas``.

Method for performing the proper ``mean`` resampling of the *uncertainties* (error bars) 
in the time series with ``pandas``. Note that doing a simple resampling 
will fail to propagate uncertainties, since error in the mean goes as 

.. math:: \sigma=\sqrt{\Sigma_n \sigma_n^2}

Example: Resamples the errors with 30 day averages:
::

    # df['errflux'] has the 1sigma uncertainties
    err=df['errflux'].resample('30d').apply(nmmn.dsp.error_resampler) 

    # plot y-values (df['flux']) with errors (err)
    df['flux'].resample('30d').mean().plot(yerr=err)
    """
    err=errors**2

    return numpy.sqrt(err.sum())/err.size
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号