在带有测量误差的数据样条上使用scipy quad时,如何传播误差? [英] How to propagate error when using scipy quad on a spline of data with measurement error?

查看:110
本文介绍了在带有测量误差的数据样条上使用scipy quad时,如何传播误差?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含N个点的数据集,这些数据适合样条曲线并使用scipy.integrate.quad进行积分.我想使用N个相关的测量误差对最终的积分值进行误差估计.

I have a data set with N points which I fit a spline to and integrate using scipy.integrate.quad. I would like to use the N associated measurement errors to put an error estimate on the final integral value.

我最初尝试使用不确定性包,但x +/- stddev对象不适用于scipy.

I originally tried to use the uncertainties package but the x+/-stddev objects did not work with scipy.

def integrand(w_point, x, y):
    #call spline function to get data arbitrary points
    f_i = spline_flux_full(x, y, w_point)

    #use spline for normalizing data at arbitrary points
    f_i_continuum = coef_continuum(w_point)

    #this is the integrand evaluated at w_point
    W_i = 1.-(f_i/f_i_continuum)

    return(W_i)

有什么想法吗?

推荐答案

综合数据集.您的数据点有错误.现在生成1000个数据集,每个点均以正态分布为中心,以正态分布为中心,并以该点处的错误给出的标准偏差为中心.拟合每个数据集.整合.重复.现在,您有1000个积分值.计算这些值的均值和标准差.

Synthetic datasets. You have your data points with errors. Now generate 1000 datasets with each point drawn from a normal distribution centered around the measured point and standard deviation given by an errror at this point. Fit each dataset. Integrate. Repeat. Now you have 1000 values of the integral. Compute the mean and std dev of these values.

这篇关于在带有测量误差的数据样条上使用scipy quad时,如何传播误差?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆