Closed Buddies-as-you-know closed 8 months ago
@YuminosukeSato Can you explain more about your question?
@hoangphamemotiv I would like to gather EEG data in real-time using the emotiv lsl system. Specifically, my goal is to collect 1 second of EEG readings and store them in a numpy variable, and then stack the data in 1-second intervals.
def aquire_eeg_10_second(inlet):
state_10second_eeg = np.empty((0, 256, 14), dtype=float)
state_eeg = np.empty((0, 14), dtype=float)
while True:
# Returns a tuple (sample,timestamp) where sample is a list of channel values and timestamp is the capture time of the sample on the remote machine,
# or (None,None) if no new sample was available
sample, timestamp = inlet.pull_sample()
state_eeg = np.append(
state_eeg, np.expand_dims(np.array(sample[3:17]), axis=0), axis=0
)
if state_10second_eeg.shape[0] % 10 == 0 and state_10second_eeg.shape[0] != 0:
break
elif state_eeg.shape[0] % 256 == 0 and state_eeg.shape[0] != 0:
state_10second_eeg = np.append(
state_10second_eeg, np.expand_dims(state_eeg, axis=0), axis=0
)
state_eeg = np.empty((0, 14), dtype=float)
print(state_10second_eeg.shape[0])
return state_10second_eeg
inlet = StreamInlet(streams[0])
eeg_data = aquire_eeg_10_second(inlet)
I would like to confirm if it is the proper method for real-time EEG data acquisition in LSL to stack and collect 1 second of EEG data for a total of 10 seconds. If there are any inquiries regarding the code, please don't hesitate to ask.
@YuminosukeSato data sample rates follow what you set for your headset (as other ticket you asked) i think you can count number of EEG sample you received to decide it is enough 1s yet. for example: your headset is 256 Hz EEG. if you received 256 samples -> it is 1 second, and 2560 samples, it is 10s.
@hoangphamemotiv Could you identify the location in the code where modifications are needed?
@hoangphamemotiv
How can I modify the settings to record an EEG with a frequency of 2560Hz for a duration of 10 seconds?
You can use EmotivPro to change the sample rate of your EpocX/Epoc+ to 256Hz. https://emotiv.gitbook.io/emotivpro-v3/using-emotivpro/untitled
How to aquire EEG in real time? I want to aquire EEG between 0Hz and 256Hz accurately.