I can read the EEG data coming from the OpenBCI-All-in-One (Cyton-16 channel) EEG device in the python program in Psychopy Coder and save it as Excel. However, although the sampling frequency of the OpenBCICyton device is 125 Hz, the data saved in Excel is 120 (Hz) (sample/second).
I could not determine the reason. Many thanks in advance to those who will contribute by commenting.
Are you presenting stimuli at 120Hz? Is it only checking the EEG data once per frame?
It would be helpful to see the parts of your code that have to do with getting the EEG data as well. I don’t know this specific system, but with this specific mismatch it’s probably going to be one of two kinds of issue:
- Something about sampling based on framerate
- Some kind of slowdown either due to a setting or just performance.
Thank you for your reply. I present visual stimuli on the screen for 1 sec at 3 sec intervals. I checked the EEG data more than once per frame.
It would be reasonable to assume that there is some kind of slowdown due to the performance you listed among the possible causes.
My code is below;
with open(eeg_csv, 'w', newline='') as f:
csv.writer(f).writerow(['timestamp'] + [f'EEG_{i+1}' for i in range(16)] + ['marker'])
# LSL Streams Setup
info_eeg = StreamInfo('OpenBCIEEG', 'EEG', 16, 125, 'float32', 'OpenBCItestEEG')
outlet_eeg = StreamOutlet(info_eeg)
info_marker = StreamInfo('VisualMarkers', 'Markers', 1, 0, 'string', 'VisualMarkerStream')
outlet_marker = StreamOutlet(info_marker)
# PsychoPy Window Setup
win = visual.Window(size=(800, 600), color='black')
stimuli = [
(visual.ImageStim(win, image=f'image{i+1}.png'), f'Stimulus_{i+1}') for i in range(3)
]
current_marker = "None"
Do you have the code that actually checks/samples the EEG data itself?
What I’m seeing here is just StreamOutlets, which would suggest that all the actual data recording is happening outside of PsychoPy, in which case performance of the EEG recording system is the most likely answer.