とりあえず補間ならなんでもいいけど、スプライン補間とかではなくてできるだけシンプルなのでOK
なので線形補間
■ 参考 : Scipy.interpolate を使った様々な補間法
コード例
from scipy import interpolate # to interpolate x_out = np.linspace(min(x_in), max(x_in), n_samples) fit_curve = interpolate.interp1d(x_in, y_in) y_out = fit_curve(x_out)
x_inとy_inというデータがあるとする
それをx_inの最小値から最大値までn_samplesで等間隔に分けた点で補完する
fit_curveが補間の関数
これにx_outを食わせれば、そのx_outでのyの値がわかる
補間前のデータとの重ね合わせプロットなどは↑の記事を参照
ランキング参加中です
↓クリックしていただけると嬉しいです〜