0
我有一個簡單的程序,我粘貼在below.I有一個問題,因爲當我運行該程序時,我得到一個錯誤。這裏是我的錯誤:「Axis more than data dimensions」 - Python
Traceback (most recent call last):
File "C:\Users\Anaconda3\lib\site-packages\pywt\_multilevel.py", line 90, in wavedec
axes_shape = data.shape[axis]
IndexError: tuple index out of range
During handling of the above exception, another exception occurred:
python
Traceback (most recent call last):
File "C:/Users/Main.py", line 10, in <module>
tree = pywt.wavedec(data=record, wavelet='db2', level=5, mode='symmetric')
File "C:\Users\Anaconda3\lib\site-packages\pywt\_multilevel.py", line 92, in wavedec
raise ValueError("Axis greater than data dimensions")
ValueError: Axis greater than data dimensions
這是我的代碼:
import wfdb
import pywt
import matplotlib.pyplot as plt
record = wfdb.rdsamp('230', sampto = 2000)
annotation = wfdb.rdann('230', 'atr', sampto = 2000)
wfdb.plotrec(record, annotation = annotation, title='Output record', timeunits = 'seconds')
tree = pywt.wavedec(data=record, wavelet='db2', level=5, mode='symmetric')
newTree = [tree[0], tree[1], tree[2], tree[3]*0, tree[4]*0, tree[5]*0]
recSignal = pywt.waverec(newTree, 'db2')
plt.plot(recSignal[:2000])
什麼,在你看來,有可能在代碼,以使工作方案改變?
錯誤是pywt模塊,線路90中,所以你應該告訴我們的代碼。 –
此外,對numpy.ndarray.shape的調用是檢索'shape'的''axis'元素,並且錯誤表明它大於'data.shape'的尺寸 –