bayspeline的python实现
baysplinep的Python项目详细描述
用于alkenone UK‘37校准的开源python包。
baysplinepy是基于原始的用于Matlab的bayspline软件(https://github.com/jesstierney/BAYSPLINE)。bayspeline是发表在Tierney & Tingley (2018)中的一种用于烷酮古温度计的贝叶斯校正方法。
请注意,此软件包正在积极开发中。代码和文档可能不完整,并可能在不久的将来更改。
示例
首先,加载包和示例数据集:
import numpy as np import bayspline as bsl example_file = bsl.get_example_data('tierney2016-p178-15p.csv') d = np.genfromtxt(example_file, delimiter=',', names=True)
此数据集(来自Tierney et al. 2015) 有三列给出了岩芯深度(cm)、沉积年龄(日历年bp)和英国37年。
我们可以用bsl.predict_sst():
prediction = bsl.predict_sst(d['uk37'], prior_std=10)
要查看预测中的实际数字,请直接解析prediction.ensemble或使用prediction.percentile()获取5%、50%和95%的百分位数。
您还可以使用bsl.predictplot()或bsl.densityplot()绘制预测。
或者,我们可以用bsl.predict_uk():
sst = np.arange(1, 25) prediction = bsl.predict_uk(sst)
安装
在conda中安装bayslinepy,使用:
$ conda install baysplinepy -c sbmalev
要使用pip安装,请运行:
$ pip install baysplinepy
不幸的是,baysplinepy与python 2不兼容。
支持和发展
- 请随时报告错误和问题,或查看github(https://github.com/brews/baysplinepy)上的源代码。
许可证
bayslinepy在开源gplv3(https://www.gnu.org/licenses)下可用。