在具有测量误差的数据样条上使用 scipy 四边形时如何传播误差?

How to propagate error when using scipy quad on a spline of data with measurement error?

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

我最初尝试使用不确定性包,但 x+/-stddev 对象不适用于 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 个积分值。计算这些值的平均值和标准偏差。