আপনার স্মৃতিকে চ্যালেঞ্জ করুন! Emotiv App-এ নতুন N-Back গেম খেলুন
আপনার স্মৃতিকে চ্যালেঞ্জ করুন! Emotiv App-এ নতুন N-Back গেম খেলুন
ল্যাব স্ট্রিমিং লেয়ার (এলএসএল) একাধিক ডেটা স্ট্রিমকে সমন্বয় করতে
রোশিনি রেন্দেনিয়া
১ অক্টো, ২০২৫
শেয়ার:

রোশিনি রেন্দেনিয়া এবং লুকাস ক্লেইন দ্বারা
অপারেশন:
কমান্ড লাইন থেকে চলার পরপরই, এই স্ক্রিপ্টটি একটি LSL স্ট্রিম শুরু করে। যখনই 'Enter' কী টিপানো হয়, এটি একটি ট্রিগার পাঠায় এবং একটি অডিও ফাইল চালায়।"""
import sounddevice as sd
import soundfile as sf
from pylsl import StreamInfo, StreamOutlet
def wait_for_keypress():
print("অডিও প্লেব্যাক শুরু করতে এবং একটি LSL মার্কার পাঠাতে ENTER চাপুন।")
while True: # This loop waits for a keyboard input input_str = input() # Wait for input from the terminal if input_str == "": # If the enter key is pressed, proceed break
def AudioMarker(audio_file, outlet): # অডিও চালানো এবং মার্কার পাঠানোর ফাংশন
data, fs = sf.read(audio_file) # অডিও ফাইল লোড করুন
print("Playing audio and sending LSL marker...") marker_val = [1] outlet.push_sample(marker_val) # Send marker indicating the start of audio playback sd.play(data, fs) # play the audio sd.wait() # Wait until audio is done playing print("Audio playback finished.")
if name == "main": # প্রধান লুপ
# মার্কারগুলির জন্য LSL স্ট্রিম সেটআপ করুন
stream_name = 'AudioMarkers'
stream_type = 'Markers'
n_chans = 1
sr = 0 # অনিয়মিত মার্কার হওয়ার কারণে স্যাম্পলিং রেট 0 সেট করুন
chan_format = 'int32'
marker_id = 'uniqueMarkerID12345'
info = StreamInfo(stream_name, stream_type, n_chans, sr, chan_format, marker_id) outlet = StreamOutlet(info) # create LSL outlet # Keep the script running and wait for ENTER key to play audio and send marker while True: wait_for_keypress() audio_filepath = "/path/to/your/audio_file.wav" # replace with correct path to your audio file AudioMarker(audio_filepath, outlet) # After playing audio and sending a marker, the script goes back to waiting for the next keypress</code></pre><p><em><strong>**By running this file (even before playing the audio), you've initiated an LSL stream through an outlet</strong></em><strong>. Now we'll view that stream in LabRecorder</strong></p><p><strong>STEP 5 - Use LabRecorder to view and save all LSL streams</strong></p><ol><li data-preset-tag="p"><p>Open LabRecorder</p></li><li data-preset-tag="p"><p>Press <em><strong>Update</strong></em>. The available LSL streams should be visible in the stream list<br> • You should be able to see streams from both EmotivPROs (usually called "EmotivDataStream") and the marker stream (called "AudioMarkers")</p></li><li data-preset-tag="p"><p>Click <em><strong>Browse</strong></em> to select a location to store data (and set other parameters)</p></li><li data-preset-tag="p"><p>Select all streams and press <em><strong>Record</strong></em> to start recording</p></li><li data-preset-tag="p"><p>Click Stop when you want to end the recording</p></li></ol><p><br></p><img alt="" src="https://framerusercontent.com/images/HFGuJF9ErVu2Jxrgtqt11tl0No.jpg"><h2><strong>Working with the data</strong></h2><p><strong>LabRecorder outputs an XDF file (Extensible Data Format) that contains data from all the streams. XDF files are structured into, </strong><em><strong>streams</strong></em><strong>, each with a different </strong><em><strong>header</strong></em><strong> that describes what it contains (device name, data type, sampling rate, channels, and more). You can use the below codeblock to open your XDF file and display some basic information.</strong></p><pre data-language="JSX"><code>
এই উদাহরণ স্ক্রিপ্টটি EmotivPRO সফটওয়্যার থেকে সংগ্রহ করা EEG তথ্য আমদানি এবং ব্যাখ্যার কয়েকটি মৌলিক ফাংশন প্রদর্শন করে। এটি একটি XDF ফাইল লোড করতে MNE ব্যবহার করে, কিছু মৌলিক মেটাডেটা মুদ্রণ করে, একটি info অবজেক্ট তৈরি করে এবং পাওয়ার স্পেকট্রাম প্লট করে।"""
import pyxdf
import mne
import matplotlib.pyplot as plt
import numpy as np
আপনার XDF ফাইলে পথ
data_path = '/path/to/your/xdf_file.xdf'
XDF ফাইল লোড করুন
streams, fileheader = pyxdf.load_xdf(data_path)
print("XDF ফাইল শিরোনাম:", fileheader)
print("কত স্ট্রিম পাওয়া গেছে:", len(streams))
for i, stream in enumerate(streams):
print("\nস্ট্রিম", i + 1)
print("স্ট্রিমের নাম:", stream['info']['name'][0])
print("স্ট্রিমের ধরন:", stream['info']['type'][0])
print("চ্যানেলের সংখ্যা:", stream['info']['channel_count'][0])
sfreq = float(stream['info']['nominal_srate'][0])
print("স্যাম্পলিং হার:", sfreq)
print("নমুনার সংখ্যা:", len(stream['time_series']))
print("প্রথম ৫টি উপাত্ত নির্দেশ করে:", stream['time_series'][:5])
channel_names = [chan['label'][0] for chan in stream['info']['desc'][0]['channels'][0]['channel']] print("Channel Names:", channel_names) channel_types = 'eeg'
MNE info অবজেক্ট তৈরি করুন
info = mne.create_info(channel_names, sfreq, channel_types)
data = np.array(stream['time_series']).T # ডেটা স্থানান্তর করতে হবে: চ্যানেল x নমুনা
raw = mne.io.RawArray(data, info)
raw.plot_psd(fmax=50) # একটি সহজ স্পেকট্রোগ্রাম (পাওয়ার স্পেকট্রাল ঘনত্ব) প্লট করুনঅতিরিক্ত সংস্থানএই টিউটোরিয়ালটি একটি Jupyter নোটবুক হিসাবে EMOTIV GitHub থেকে ডাউনলোড করুনLSL অনলাইন ডকুমেন্টেশন দেখুন, GitHub এ অফিসিয়াল README সহডেটা সংগ্রহের জন্য একটি বা একাধিক সমর্থিত ডেটা অধিগ্রহণ ডিভাইস প্রয়োজনEMOTIV-এর সব ব্রেইনওয়্যার ডিভাইসগুলি EmotivPRO সফটওয়্যারে সংযোগ করে, যা LSL বিল্ট-ইন ক্ষমতাগুলির জন্য সংরক্ষিতঅতিরিক্ত সংস্থান:Emotiv এর ডিভাইস ব্যবহার করে LSL চালানোর জন্য কোড, উদাহরণ স্ক্রিপ্ট সহYouTube এ উপকারী LSL ডেমোSCCN LSL GitHub রিপোজিটরি সমস্ত সংশ্লিষ্ট লাইব্রেরি জন্যসাবমডিউল এবং অ্যাপসগুলির একটি সংগ্রহের জন্য GitHub রিপোজিটরিHyperscanning গবেষণার জন্য HyPyP বিশ্লেষণ পাইপলাইন
রোশিনি রেন্দেনিয়া এবং লুকাস ক্লেইন দ্বারা
অপারেশন:
কমান্ড লাইন থেকে চলার পরপরই, এই স্ক্রিপ্টটি একটি LSL স্ট্রিম শুরু করে। যখনই 'Enter' কী টিপানো হয়, এটি একটি ট্রিগার পাঠায় এবং একটি অডিও ফাইল চালায়।"""
import sounddevice as sd
import soundfile as sf
from pylsl import StreamInfo, StreamOutlet
def wait_for_keypress():
print("অডিও প্লেব্যাক শুরু করতে এবং একটি LSL মার্কার পাঠাতে ENTER চাপুন।")
while True: # This loop waits for a keyboard input input_str = input() # Wait for input from the terminal if input_str == "": # If the enter key is pressed, proceed break
def AudioMarker(audio_file, outlet): # অডিও চালানো এবং মার্কার পাঠানোর ফাংশন
data, fs = sf.read(audio_file) # অডিও ফাইল লোড করুন
print("Playing audio and sending LSL marker...") marker_val = [1] outlet.push_sample(marker_val) # Send marker indicating the start of audio playback sd.play(data, fs) # play the audio sd.wait() # Wait until audio is done playing print("Audio playback finished.")
if name == "main": # প্রধান লুপ
# মার্কারগুলির জন্য LSL স্ট্রিম সেটআপ করুন
stream_name = 'AudioMarkers'
stream_type = 'Markers'
n_chans = 1
sr = 0 # অনিয়মিত মার্কার হওয়ার কারণে স্যাম্পলিং রেট 0 সেট করুন
chan_format = 'int32'
marker_id = 'uniqueMarkerID12345'
info = StreamInfo(stream_name, stream_type, n_chans, sr, chan_format, marker_id) outlet = StreamOutlet(info) # create LSL outlet # Keep the script running and wait for ENTER key to play audio and send marker while True: wait_for_keypress() audio_filepath = "/path/to/your/audio_file.wav" # replace with correct path to your audio file AudioMarker(audio_filepath, outlet) # After playing audio and sending a marker, the script goes back to waiting for the next keypress</code></pre><p><em><strong>**By running this file (even before playing the audio), you've initiated an LSL stream through an outlet</strong></em><strong>. Now we'll view that stream in LabRecorder</strong></p><p><strong>STEP 5 - Use LabRecorder to view and save all LSL streams</strong></p><ol><li data-preset-tag="p"><p>Open LabRecorder</p></li><li data-preset-tag="p"><p>Press <em><strong>Update</strong></em>. The available LSL streams should be visible in the stream list<br> • You should be able to see streams from both EmotivPROs (usually called "EmotivDataStream") and the marker stream (called "AudioMarkers")</p></li><li data-preset-tag="p"><p>Click <em><strong>Browse</strong></em> to select a location to store data (and set other parameters)</p></li><li data-preset-tag="p"><p>Select all streams and press <em><strong>Record</strong></em> to start recording</p></li><li data-preset-tag="p"><p>Click Stop when you want to end the recording</p></li></ol><p><br></p><img alt="" src="https://framerusercontent.com/images/HFGuJF9ErVu2Jxrgtqt11tl0No.jpg"><h2><strong>Working with the data</strong></h2><p><strong>LabRecorder outputs an XDF file (Extensible Data Format) that contains data from all the streams. XDF files are structured into, </strong><em><strong>streams</strong></em><strong>, each with a different </strong><em><strong>header</strong></em><strong> that describes what it contains (device name, data type, sampling rate, channels, and more). You can use the below codeblock to open your XDF file and display some basic information.</strong></p><pre data-language="JSX"><code>
এই উদাহরণ স্ক্রিপ্টটি EmotivPRO সফটওয়্যার থেকে সংগ্রহ করা EEG তথ্য আমদানি এবং ব্যাখ্যার কয়েকটি মৌলিক ফাংশন প্রদর্শন করে। এটি একটি XDF ফাইল লোড করতে MNE ব্যবহার করে, কিছু মৌলিক মেটাডেটা মুদ্রণ করে, একটি info অবজেক্ট তৈরি করে এবং পাওয়ার স্পেকট্রাম প্লট করে।"""
import pyxdf
import mne
import matplotlib.pyplot as plt
import numpy as np
আপনার XDF ফাইলে পথ
data_path = '/path/to/your/xdf_file.xdf'
XDF ফাইল লোড করুন
streams, fileheader = pyxdf.load_xdf(data_path)
print("XDF ফাইল শিরোনাম:", fileheader)
print("কত স্ট্রিম পাওয়া গেছে:", len(streams))
for i, stream in enumerate(streams):
print("\nস্ট্রিম", i + 1)
print("স্ট্রিমের নাম:", stream['info']['name'][0])
print("স্ট্রিমের ধরন:", stream['info']['type'][0])
print("চ্যানেলের সংখ্যা:", stream['info']['channel_count'][0])
sfreq = float(stream['info']['nominal_srate'][0])
print("স্যাম্পলিং হার:", sfreq)
print("নমুনার সংখ্যা:", len(stream['time_series']))
print("প্রথম ৫টি উপাত্ত নির্দেশ করে:", stream['time_series'][:5])
channel_names = [chan['label'][0] for chan in stream['info']['desc'][0]['channels'][0]['channel']] print("Channel Names:", channel_names) channel_types = 'eeg'
MNE info অবজেক্ট তৈরি করুন
info = mne.create_info(channel_names, sfreq, channel_types)
data = np.array(stream['time_series']).T # ডেটা স্থানান্তর করতে হবে: চ্যানেল x নমুনা
raw = mne.io.RawArray(data, info)
raw.plot_psd(fmax=50) # একটি সহজ স্পেকট্রোগ্রাম (পাওয়ার স্পেকট্রাল ঘনত্ব) প্লট করুনঅতিরিক্ত সংস্থানএই টিউটোরিয়ালটি একটি Jupyter নোটবুক হিসাবে EMOTIV GitHub থেকে ডাউনলোড করুনLSL অনলাইন ডকুমেন্টেশন দেখুন, GitHub এ অফিসিয়াল README সহডেটা সংগ্রহের জন্য একটি বা একাধিক সমর্থিত ডেটা অধিগ্রহণ ডিভাইস প্রয়োজনEMOTIV-এর সব ব্রেইনওয়্যার ডিভাইসগুলি EmotivPRO সফটওয়্যারে সংযোগ করে, যা LSL বিল্ট-ইন ক্ষমতাগুলির জন্য সংরক্ষিতঅতিরিক্ত সংস্থান:Emotiv এর ডিভাইস ব্যবহার করে LSL চালানোর জন্য কোড, উদাহরণ স্ক্রিপ্ট সহYouTube এ উপকারী LSL ডেমোSCCN LSL GitHub রিপোজিটরি সমস্ত সংশ্লিষ্ট লাইব্রেরি জন্যসাবমডিউল এবং অ্যাপসগুলির একটি সংগ্রহের জন্য GitHub রিপোজিটরিHyperscanning গবেষণার জন্য HyPyP বিশ্লেষণ পাইপলাইন
রোশিনি রেন্দেনিয়া এবং লুকাস ক্লেইন দ্বারা
অপারেশন:
কমান্ড লাইন থেকে চলার পরপরই, এই স্ক্রিপ্টটি একটি LSL স্ট্রিম শুরু করে। যখনই 'Enter' কী টিপানো হয়, এটি একটি ট্রিগার পাঠায় এবং একটি অডিও ফাইল চালায়।"""
import sounddevice as sd
import soundfile as sf
from pylsl import StreamInfo, StreamOutlet
def wait_for_keypress():
print("অডিও প্লেব্যাক শুরু করতে এবং একটি LSL মার্কার পাঠাতে ENTER চাপুন।")
while True: # This loop waits for a keyboard input input_str = input() # Wait for input from the terminal if input_str == "": # If the enter key is pressed, proceed break
def AudioMarker(audio_file, outlet): # অডিও চালানো এবং মার্কার পাঠানোর ফাংশন
data, fs = sf.read(audio_file) # অডিও ফাইল লোড করুন
print("Playing audio and sending LSL marker...") marker_val = [1] outlet.push_sample(marker_val) # Send marker indicating the start of audio playback sd.play(data, fs) # play the audio sd.wait() # Wait until audio is done playing print("Audio playback finished.")
if name == "main": # প্রধান লুপ
# মার্কারগুলির জন্য LSL স্ট্রিম সেটআপ করুন
stream_name = 'AudioMarkers'
stream_type = 'Markers'
n_chans = 1
sr = 0 # অনিয়মিত মার্কার হওয়ার কারণে স্যাম্পলিং রেট 0 সেট করুন
chan_format = 'int32'
marker_id = 'uniqueMarkerID12345'
info = StreamInfo(stream_name, stream_type, n_chans, sr, chan_format, marker_id) outlet = StreamOutlet(info) # create LSL outlet # Keep the script running and wait for ENTER key to play audio and send marker while True: wait_for_keypress() audio_filepath = "/path/to/your/audio_file.wav" # replace with correct path to your audio file AudioMarker(audio_filepath, outlet) # After playing audio and sending a marker, the script goes back to waiting for the next keypress</code></pre><p><em><strong>**By running this file (even before playing the audio), you've initiated an LSL stream through an outlet</strong></em><strong>. Now we'll view that stream in LabRecorder</strong></p><p><strong>STEP 5 - Use LabRecorder to view and save all LSL streams</strong></p><ol><li data-preset-tag="p"><p>Open LabRecorder</p></li><li data-preset-tag="p"><p>Press <em><strong>Update</strong></em>. The available LSL streams should be visible in the stream list<br> • You should be able to see streams from both EmotivPROs (usually called "EmotivDataStream") and the marker stream (called "AudioMarkers")</p></li><li data-preset-tag="p"><p>Click <em><strong>Browse</strong></em> to select a location to store data (and set other parameters)</p></li><li data-preset-tag="p"><p>Select all streams and press <em><strong>Record</strong></em> to start recording</p></li><li data-preset-tag="p"><p>Click Stop when you want to end the recording</p></li></ol><p><br></p><img alt="" src="https://framerusercontent.com/images/HFGuJF9ErVu2Jxrgtqt11tl0No.jpg"><h2><strong>Working with the data</strong></h2><p><strong>LabRecorder outputs an XDF file (Extensible Data Format) that contains data from all the streams. XDF files are structured into, </strong><em><strong>streams</strong></em><strong>, each with a different </strong><em><strong>header</strong></em><strong> that describes what it contains (device name, data type, sampling rate, channels, and more). You can use the below codeblock to open your XDF file and display some basic information.</strong></p><pre data-language="JSX"><code>
এই উদাহরণ স্ক্রিপ্টটি EmotivPRO সফটওয়্যার থেকে সংগ্রহ করা EEG তথ্য আমদানি এবং ব্যাখ্যার কয়েকটি মৌলিক ফাংশন প্রদর্শন করে। এটি একটি XDF ফাইল লোড করতে MNE ব্যবহার করে, কিছু মৌলিক মেটাডেটা মুদ্রণ করে, একটি info অবজেক্ট তৈরি করে এবং পাওয়ার স্পেকট্রাম প্লট করে।"""
import pyxdf
import mne
import matplotlib.pyplot as plt
import numpy as np
আপনার XDF ফাইলে পথ
data_path = '/path/to/your/xdf_file.xdf'
XDF ফাইল লোড করুন
streams, fileheader = pyxdf.load_xdf(data_path)
print("XDF ফাইল শিরোনাম:", fileheader)
print("কত স্ট্রিম পাওয়া গেছে:", len(streams))
for i, stream in enumerate(streams):
print("\nস্ট্রিম", i + 1)
print("স্ট্রিমের নাম:", stream['info']['name'][0])
print("স্ট্রিমের ধরন:", stream['info']['type'][0])
print("চ্যানেলের সংখ্যা:", stream['info']['channel_count'][0])
sfreq = float(stream['info']['nominal_srate'][0])
print("স্যাম্পলিং হার:", sfreq)
print("নমুনার সংখ্যা:", len(stream['time_series']))
print("প্রথম ৫টি উপাত্ত নির্দেশ করে:", stream['time_series'][:5])
channel_names = [chan['label'][0] for chan in stream['info']['desc'][0]['channels'][0]['channel']] print("Channel Names:", channel_names) channel_types = 'eeg'
MNE info অবজেক্ট তৈরি করুন
info = mne.create_info(channel_names, sfreq, channel_types)
data = np.array(stream['time_series']).T # ডেটা স্থানান্তর করতে হবে: চ্যানেল x নমুনা
raw = mne.io.RawArray(data, info)
raw.plot_psd(fmax=50) # একটি সহজ স্পেকট্রোগ্রাম (পাওয়ার স্পেকট্রাল ঘনত্ব) প্লট করুনঅতিরিক্ত সংস্থানএই টিউটোরিয়ালটি একটি Jupyter নোটবুক হিসাবে EMOTIV GitHub থেকে ডাউনলোড করুনLSL অনলাইন ডকুমেন্টেশন দেখুন, GitHub এ অফিসিয়াল README সহডেটা সংগ্রহের জন্য একটি বা একাধিক সমর্থিত ডেটা অধিগ্রহণ ডিভাইস প্রয়োজনEMOTIV-এর সব ব্রেইনওয়্যার ডিভাইসগুলি EmotivPRO সফটওয়্যারে সংযোগ করে, যা LSL বিল্ট-ইন ক্ষমতাগুলির জন্য সংরক্ষিতঅতিরিক্ত সংস্থান:Emotiv এর ডিভাইস ব্যবহার করে LSL চালানোর জন্য কোড, উদাহরণ স্ক্রিপ্ট সহYouTube এ উপকারী LSL ডেমোSCCN LSL GitHub রিপোজিটরি সমস্ত সংশ্লিষ্ট লাইব্রেরি জন্যসাবমডিউল এবং অ্যাপসগুলির একটি সংগ্রহের জন্য GitHub রিপোজিটরিHyperscanning গবেষণার জন্য HyPyP বিশ্লেষণ পাইপলাইন
পড়তে থাকুন
নিউরাল অস্কিলেশনের মৌলিক কথা
