我在工作的程序,以衡量心率变异性(心率变异性)分析,但我得到一个错误如下。你知道吗
from scipy.interpolate import interp1d
meaures = [peaklist]
print('this peaklist is for measuring of frequency domain maesures', peaklist)
RR_x = peaklist[1:]
print('RR_X IS : ', RR_x)
RR_y = RR_interval_list
print('RR_Y IS : ', RR_y)
RR_x_new = np.linspace(RR_x[0], RR_x[-1],RR_x[-1])
print("RR_X_NEW IS : ", RR_x_new)
f = interp1d(RR_x_new, RR_y, kind='cubic')
print('f is : ',f(250))
这个峰值列表是用来测量频率域的
[63, 165, 264, 360, 460, 565, 674, 773, 863, 953, 1048, 1156, 1272, 1385, 1487, 1592, 1698, 1803, 1897, 1994, 2097, 2206, 2308, 2406]
RR\u X是:
[165, 264, 360, 460, 565, 674, 773, 863, 953, 1048, 1156, 1272, 1385, 1487, 1592, 1698, 1803, 1897, 1994, 2097, 2206, 2308, 2406]
资源是:
[1020.0, 990.0, 960.0, 1000.0, 1050.0, 1090.0, 990.0, 900.0, 900.0, 950.0, 1080.0, 1160.0, 1130.0, 1020.0, 1050.0, 1060.0, 1050.0, 940.0, 970.0, 1030.0, 1090.0, 1020.0, 980.0]
新的是:
[ 165. 165.93180873 166.86361746 ... 2404.13638254 2405.06819127
2406. ]
Traceback (most recent call last): File "C:/Users/Dee1/PycharmProjects/HeartAna1.1/HeartAna.py", line 235, in f = interp1d(RR_x_new, RR_y, kind='cubic') File "C:\ProgramData\Anaconda3\envs\HeartAna1.1\lib\site-packages\scipy\interpolate\interpolate.py", line 433, in init _Interpolator1D.init(self, x, y, axis=axis) File "C:\ProgramData\Anaconda3\envs\HeartAna1.1\lib\site-packages\scipy\interpolate\polyint.py", line 60, in init self._set_yi(yi, xi=xi, axis=axis) File "C:\ProgramData\Anaconda3\envs\HeartAna1.1\lib\site-packages\scipy\interpolate\polyint.py", line 125, in _set_yi raise ValueError("x and y arrays must be equal in length along " ValueError: x and y arrays must be equal in length along interpolation axis.
进程已完成,退出代码为1
这不是
interp1d
的设计原理。x
和y
参数必须具有相同的长度。以你的例子来说,你想做的是:相关问题 更多 >
编程相关推荐