Traceback (most recent call last):
File "real_time_SSVEP_simulation.py", line 16, in <module>
import pyseeg.modules.ssveplib as slt
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PysEEG-0.0.1-py2.7.egg/pyseeg/modules/ssveplib.py", line 18
self.x_freq = [i/window_len/(float(fs)/2.)) for i in range(window_len)]
^
SyntaxError: invalid syntax
Hi, Can anyone suggest what might the possible cause for this error?
Any help is highly appreciated.
Thanks!
Traceback (most recent call last):
File "real_time_SSVEP_simulation.py", line 16, in <module>
import pyseeg.modules.ssveplib as slt
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PysEEG-0.0.1-py2.7.egg/pyseeg/modules/ssveplib.py", line 18
self.x_freq = [i/window_len/(float(fs)/2.)) for i in range(window_len)]
^
SyntaxError: invalid syntax
And here is the snippet of the code -
import numpy as np
from pyseeg.modules.fft import transform
class SSVEPRealTime(object):
def __init__(self, fs, window_len, freq_ranges, window_kind='nooverpal'):
self.fs = fs
self.window_len = window_len
self.window_kind = window_kind
self.data = np.zeros(self.window_len)
self.cnt = 0
self.freq_ranges = freq_ranges
self.x_freq = [i/window_len/(float(fs)/2.0)for i in range(window_len)]
self.decision = 0
def ssvep_detect(self, smp):
self.data[self.cnt] = smp
self.cnt += 1
if self.cnt == self.window_len:
data_fft = transform(self.data)
mean_freqs = []
freq_idxs = []
for (low, hi) in freq_ranges:
low_idx = np.argmin(np.abs(x_freq - low))
hi_idx = np.argmin(np.abs(x_freq - hi))
freq_idxs.append([low_idx, hi_idx])
for idxs in freq_idxs:
mean_freqs.append(data_ffs[idxs[0]:idxs[1]])
self.cnt = 0
self.decision = np.argmax(mean_freqs)
return self.decision
The line quoted in the error message still has the extra paren and does not appear in the code snippet, suggesting perhaps that the file was not saved after you made the correction.
Also, if you are executing that module by issuing a command from a running interpreter, make sure to re-start the interpreter an re-import modules after editing. Python will keep using the old version until you make it use the new one.
Hi Allen, I executed by building the package again. However, I do not see that error now, but instead I get this error. This was not present before.
Traceback (most recent call last):
File "real_time_SSVEP_simulation.py", line 13, in <module>
from pyseeg.modules.csvlib import read_csv
ImportError: No module named pyseeg.modules.csvlib
I have checked all the modules and path directories, it is correct. Also, init.py package is associated as well with all the directories. Do you have any idea what might be the possible cause of this error?
The errors you report seem to be general beginner Python issues not specific to Psychopy, so you might be helped by Googling for answers and reading an online tutorial or book.
If you can find the missing module in one of the directories listed on the path then it should import. You can also try help(“modules”) to list installed modules and you can try importing stuff from the Python prompt as a test.