forrestbao / pyeeg

Python + EEG/MEG = PyEEG
GNU General Public License v3.0
241 stars 85 forks source link

Information Based Similarity run error #24

Closed thosvarley closed 5 years ago

thosvarley commented 6 years ago

When I try to run the example code for Information Based Similarity it returns:

information_based_similarity(test1, test2, 8) Traceback (most recent call last):

File "", line 1, in information_based_similarity(test1, test2, 8)

File "/home/tfv21/anaconda3/lib/python3.6/site-packages/pyeeg/init.py", line 955, in information_based_similarity Wm.append(embed_seq(SymbolicSeq[0], 1, n).tolist())

File "/home/tfv21/anaconda3/lib/python3.6/site-packages/pyeeg/init.py", line 161, in embed_seq shape = (X.size - Tau * (D - 1), D)

AttributeError: 'list' object has no attribute 'size'

I tried changing X.size to len(X), but that threw the same error in the same function (list object has no attribute 'itemsize.'

Please advise.

gemeinl commented 6 years ago

You can solve this issue by casting the SymbolicSeq list to a numpy ndarray:

Add SymbolicSeq = numpy.array(SymbolicSeq) in line 953.

https://github.com/forrestbao/pyeeg/blob/master/pyeeg/__init__.py#L953

forrestbao commented 5 years ago

Fixed by typecasting X at the beginning of embed_seq() in commit fdfb243b593e421f49be283f9c4ebbffdb1dcdb3