scipy - 在具有测量误差的样条数据上使用 scipy quad 时如何传播误差?
问题描述
我有一个包含 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 个积分值。计算这些值的均值和标准差。
推荐阅读
- pandas - 具有自定义聚合函数和 dtype 条件的 pandas agg:列静默消失
- php - html表单不显示值
- python - pandas plot with twiny top xticks 锚调整
- python - 在 matplotlib 中的图形 2D 线上绘制 2D 线
- javascript - 在 Web iframe 窗口中访问 TS 命名空间
- c# - 使愤怒的小鸟在统一上看起来很像。发现了一个错误,仍然无法修复它
- spring - 无法从配置服务器获取属性值
- python - 特定字头 qtableWidget 中的富文本
- python - Python 3 - 从字典对绘制 mapplotlib 图
- maven - Maven surefire 插件即使在 IntelliJ 中未使用也会引发错误