اپنی یادداشت کو چیلنج کریں! نیا این-بیک گیم Emotiv App میں کھیلیں

لیب سٹریمنگ لیئر (LSL) بیک وقت متعدد ڈیٹا سٹریمز کو ہم آہنگ کرنے کے لئے

روشنی راندینیہ

-

شئیر کریں:

روشنا رندینیا اور لوکاس کلائنے کی جانب سے

آپریشن:
جب کمانڈ لائن میں چلایا جاتا ہے، تو یہ اسکرپٹ فوراً 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 فائل لوڈ کرنے، کچھ بنیادی میٹا ڈیٹا پرنٹ کرنے، ایک info آبجیکٹ بنانے اور پاور اسپیکٹرم کی پلاٹ کے لیے MNE استعمال کرتا ہے۔"""

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("\nStream", 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("پہلے 5 ڈیٹا پوائنٹس کو پرنٹ کریں:", 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 = 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) # سہل اسپیکٹروگرام (پاور اسپیکٹرل ڈینسٹی) کو پلاٹ کریںاضافی وسائلایموٹو کے گیٹ ہب سے یہ ٹیوٹوریل جیوپیٹر نوٹ بک کی شکل میں ڈاؤن لوڈ کریںآن لائن دستاویزات LSLکا معائنہ کریں، اس کے علاوہ ایم اوایفیشنٹ مستریڈمی فائل گیثب پرآپ کو کسی ایک یا ایک سے زیادہ ڈیٹا اکوزیشن ڈیوائس کے ضرورت ہو گی صحیح ڈیٹا حاصل کرنے کے لیےایموٹو کے تمام برین ویئر ڈیوائسزظائف سافٹ ویئر، جو کے اندرونی LSLکیپبلٹز کے ساتھ بناتے ہے ڈیٹا اسٹریم بھیجنے اور حاصل کرنے اضافی وسائل:ایموٹو کے آلات استعمال کرنے کے لیے LSLکوڈ چلایا، مثال کے لیے اسکرپٹ کے ساتھ مفید LSLڈیما یوٹیوب پرSCCNگی انہیں لائبریریز LSLگیثب ذخیرہ شدہپوریل ترکیبی جمعات اور ایپسH مائپ آئنالیسس پائیپ لائن آین الحیرا امنیات کے لئےب ایموٹیو اور R گیثب ذخیرے

روشنا رندینیا اور لوکاس کلائنے کی جانب سے

آپریشن:
جب کمانڈ لائن میں چلایا جاتا ہے، تو یہ اسکرپٹ فوراً 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 فائل لوڈ کرنے، کچھ بنیادی میٹا ڈیٹا پرنٹ کرنے، ایک info آبجیکٹ بنانے اور پاور اسپیکٹرم کی پلاٹ کے لیے MNE استعمال کرتا ہے۔"""

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("\nStream", 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("پہلے 5 ڈیٹا پوائنٹس کو پرنٹ کریں:", 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 = 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) # سہل اسپیکٹروگرام (پاور اسپیکٹرل ڈینسٹی) کو پلاٹ کریںاضافی وسائلایموٹو کے گیٹ ہب سے یہ ٹیوٹوریل جیوپیٹر نوٹ بک کی شکل میں ڈاؤن لوڈ کریںآن لائن دستاویزات LSLکا معائنہ کریں، اس کے علاوہ ایم اوایفیشنٹ مستریڈمی فائل گیثب پرآپ کو کسی ایک یا ایک سے زیادہ ڈیٹا اکوزیشن ڈیوائس کے ضرورت ہو گی صحیح ڈیٹا حاصل کرنے کے لیےایموٹو کے تمام برین ویئر ڈیوائسزظائف سافٹ ویئر، جو کے اندرونی LSLکیپبلٹز کے ساتھ بناتے ہے ڈیٹا اسٹریم بھیجنے اور حاصل کرنے اضافی وسائل:ایموٹو کے آلات استعمال کرنے کے لیے LSLکوڈ چلایا، مثال کے لیے اسکرپٹ کے ساتھ مفید LSLڈیما یوٹیوب پرSCCNگی انہیں لائبریریز LSLگیثب ذخیرہ شدہپوریل ترکیبی جمعات اور ایپسH مائپ آئنالیسس پائیپ لائن آین الحیرا امنیات کے لئےب ایموٹیو اور R گیثب ذخیرے

روشنا رندینیا اور لوکاس کلائنے کی جانب سے

آپریشن:
جب کمانڈ لائن میں چلایا جاتا ہے، تو یہ اسکرپٹ فوراً 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 فائل لوڈ کرنے، کچھ بنیادی میٹا ڈیٹا پرنٹ کرنے، ایک info آبجیکٹ بنانے اور پاور اسپیکٹرم کی پلاٹ کے لیے MNE استعمال کرتا ہے۔"""

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("\nStream", 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("پہلے 5 ڈیٹا پوائنٹس کو پرنٹ کریں:", 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 = 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) # سہل اسپیکٹروگرام (پاور اسپیکٹرل ڈینسٹی) کو پلاٹ کریںاضافی وسائلایموٹو کے گیٹ ہب سے یہ ٹیوٹوریل جیوپیٹر نوٹ بک کی شکل میں ڈاؤن لوڈ کریںآن لائن دستاویزات LSLکا معائنہ کریں، اس کے علاوہ ایم اوایفیشنٹ مستریڈمی فائل گیثب پرآپ کو کسی ایک یا ایک سے زیادہ ڈیٹا اکوزیشن ڈیوائس کے ضرورت ہو گی صحیح ڈیٹا حاصل کرنے کے لیےایموٹو کے تمام برین ویئر ڈیوائسزظائف سافٹ ویئر، جو کے اندرونی LSLکیپبلٹز کے ساتھ بناتے ہے ڈیٹا اسٹریم بھیجنے اور حاصل کرنے اضافی وسائل:ایموٹو کے آلات استعمال کرنے کے لیے LSLکوڈ چلایا، مثال کے لیے اسکرپٹ کے ساتھ مفید LSLڈیما یوٹیوب پرSCCNگی انہیں لائبریریز LSLگیثب ذخیرہ شدہپوریل ترکیبی جمعات اور ایپسH مائپ آئنالیسس پائیپ لائن آین الحیرا امنیات کے لئےب ایموٹیو اور R گیثب ذخیرے

پڑھنا جاری رکھیں

عصبی اتارات کی بنیادی باتیں