I interpolated a dataset as follow:
y = [-2.35771490e-04, -2.04672372e-04, 5.40550849e-06, -3.26933980e-04,
-4.31306957e-04, -4.06928662e-04, -7.50889655e-04, -1.03669983e-03,
-5.28464040e-04, -5.01935670e-04, -8.09657243e-04, -4.21891416e-04,
-1.35441615e-04, -3.46855608e-04, -2.90791620e-04, -8.19357356e-05,
-2.58070932e-04, -1.58262175e-04, 1.32105126e-04, 2.42572582e-05,
9.88706879e-05]
x = [175., 165., 155., 145., 135., 125., 115., 105., 95., 85., 75.,
65., 55., 45., 35., 25., 15., 5., -5., -15., -25.]
f = interpolate.interp1d(x, y, kind='cubic')
x_new = np.arange(-25,175, 5)
y_interp = f(x_new))
However, I'd like to know if it's possible to calculate the standard deviation for each new element in y_interp. The errors for elements in y are:
err = [0.00012969551729667857, 0.00014864077922340332, 0.00010732361332456688, 8.95365810198269e-05, 8.559972679579093e-05, 0.00010669277818690999, 6.880710200343582e-05, 9.249378243164652e-05, 9.885179214527947e-05, 8.352246348207366e-05, 6.586538652949116e-05, 7.428127049298688e-05, 6.506191339534108e-05, 7.166116284348538e-05, 6.379032268503384e-05, 7.101008284147194e-05, 6.0593495968463165e-05, 4.699920194672463e-05, 5.854938570487613e-05, 7.140629409894438e-05, 9.66241238445066e-05]
Thank you in advance.
Yes, there are many ways in python to calculate the standard deviation! for example, you could use the numpy.std() function:
std_of_y_interp = np.std(y_interp)
If you want to know the standard deviation for each new element in y_interp, you have to call this function each time a new element is added to y_interp