लैब स्ट्रीमिंग लेयर (एलएसएल) कई डेटा स्ट्रीमों को समन्वयित करने के लिए
रोशिनी रंडेनिया
1 अक्तू॰ 2025
साझा करें:


रोशिनी रंधेनिया और लुकास क्लेन
ऑपरेशन:
कमांड लाइन में चलाने पर, यह स्क्रिप्ट तुरंत एक LSL स्ट्रीम शुरू करती है। जब भी 'एंटर' कुंजी दबाई जाती है, यह एक ट्रिगर भेजती है और एक ऑडियो फ़ाइल चलाती है।
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("पहले 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) # एक सरल स्पेक्ट्रोग्राम (पॉवर स्पेक्ट्रल डेनसिटी) का प्लॉट बनाना
अतिरिक्त संसाधन
इस ट्यूटोरियल को EMOTIV GitHub से Jupyter नोटबुक के रूप में डाउनलोड करें
आधिकारिक README फ़ाइल सहित LSL ऑनलाइन दस्तावेज़ देखें
आपको डेटा एकत्र करने के लिए एक या एक से अधिक समर्थित डेटा अधिग्रहण डिवाइस की आवश्यकता होगी
EMOTIV के सभी ब्रेनवेयर उपकरण EmotivPRO सॉफ़्टवेयर से जुड़े होते हैं, जिसमें डेटा स्ट्रीम भेजने और प्राप्त करने के लिए LSL अंतर्निहित क्षमताएँ होती हैं
अतिरिक्त संसाधन:
Emotiv के उपकरणों का उपयोग करके LSL चलाने के लिए कोड, उदाहरण स्क्रिप्ट के साथ
YouTube पर उपयोगी LSL डेमो
SCCN LSL GitHub भंडार सभी संबद्ध पुस्तकालयों के लिए
उप-आधारों और ऐप्स के संग्रह के लिए GitHub भंडार
हाईपरस्कैनिंग अध्ययन के लिए HyPyP विश्लेषण पाइपलाइन
रोशिनी रंधेनिया और लुकास क्लेन
ऑपरेशन:
कमांड लाइन में चलाने पर, यह स्क्रिप्ट तुरंत एक LSL स्ट्रीम शुरू करती है। जब भी 'एंटर' कुंजी दबाई जाती है, यह एक ट्रिगर भेजती है और एक ऑडियो फ़ाइल चलाती है।
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("पहले 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) # एक सरल स्पेक्ट्रोग्राम (पॉवर स्पेक्ट्रल डेनसिटी) का प्लॉट बनाना
अतिरिक्त संसाधन
इस ट्यूटोरियल को EMOTIV GitHub से Jupyter नोटबुक के रूप में डाउनलोड करें
आधिकारिक README फ़ाइल सहित LSL ऑनलाइन दस्तावेज़ देखें
आपको डेटा एकत्र करने के लिए एक या एक से अधिक समर्थित डेटा अधिग्रहण डिवाइस की आवश्यकता होगी
EMOTIV के सभी ब्रेनवेयर उपकरण EmotivPRO सॉफ़्टवेयर से जुड़े होते हैं, जिसमें डेटा स्ट्रीम भेजने और प्राप्त करने के लिए LSL अंतर्निहित क्षमताएँ होती हैं
अतिरिक्त संसाधन:
Emotiv के उपकरणों का उपयोग करके LSL चलाने के लिए कोड, उदाहरण स्क्रिप्ट के साथ
YouTube पर उपयोगी LSL डेमो
SCCN LSL GitHub भंडार सभी संबद्ध पुस्तकालयों के लिए
उप-आधारों और ऐप्स के संग्रह के लिए GitHub भंडार
हाईपरस्कैनिंग अध्ययन के लिए HyPyP विश्लेषण पाइपलाइन
रोशिनी रंधेनिया और लुकास क्लेन
ऑपरेशन:
कमांड लाइन में चलाने पर, यह स्क्रिप्ट तुरंत एक LSL स्ट्रीम शुरू करती है। जब भी 'एंटर' कुंजी दबाई जाती है, यह एक ट्रिगर भेजती है और एक ऑडियो फ़ाइल चलाती है।
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("पहले 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) # एक सरल स्पेक्ट्रोग्राम (पॉवर स्पेक्ट्रल डेनसिटी) का प्लॉट बनाना
अतिरिक्त संसाधन
इस ट्यूटोरियल को EMOTIV GitHub से Jupyter नोटबुक के रूप में डाउनलोड करें
आधिकारिक README फ़ाइल सहित LSL ऑनलाइन दस्तावेज़ देखें
आपको डेटा एकत्र करने के लिए एक या एक से अधिक समर्थित डेटा अधिग्रहण डिवाइस की आवश्यकता होगी
EMOTIV के सभी ब्रेनवेयर उपकरण EmotivPRO सॉफ़्टवेयर से जुड़े होते हैं, जिसमें डेटा स्ट्रीम भेजने और प्राप्त करने के लिए LSL अंतर्निहित क्षमताएँ होती हैं
अतिरिक्त संसाधन:
Emotiv के उपकरणों का उपयोग करके LSL चलाने के लिए कोड, उदाहरण स्क्रिप्ट के साथ
YouTube पर उपयोगी LSL डेमो
SCCN LSL GitHub भंडार सभी संबद्ध पुस्तकालयों के लिए
उप-आधारों और ऐप्स के संग्रह के लिए GitHub भंडार
हाईपरस्कैनिंग अध्ययन के लिए HyPyP विश्लेषण पाइपलाइन
सहायता
कंपनी

© 2025 EMOTIV, सभी अधिकार सुरक्षित।

आपकी गोपनीयता की पसंद (कुकी सेटिंग्स)
*अस्वीकृति – EMOTIV उत्पादों का उद्देश्य केवल अनुसंधान अनुप्रयोगों और व्यक्तिगत उपयोग के लिए होना है। हमारे उत्पादों को EU निर्देश 93/42/EEC में परिभाषित चिकित्सा उपकरणों के रूप में बेचा नहीं जाता है। हमारे उत्पादों को किसी बीमारी के निदान या उपचार के लिए उपयोग के लिए डिज़ाइन या उद्देश्य नहीं किया गया है।
अनुवाद पर नोट: इस वेबसाइट के गैर-अंग्रेजी संस्करणों का अनुवाद आपकी सुविधा के लिए कृत्रिम बुद्धिमत्ता का उपयोग करके किया गया है। जबकि हम सटीकता के लिए प्रयास करते हैं, स्वचालित अनुवाद में त्रुटियाँ या ऐसे अंतरों हो सकते हैं जो मूल पाठ से भिन्न होते हैं। सबसे सटीक जानकारी के लिए, कृपया इस साइट के अंग्रेजी संस्करण को देखें।
सहायता
कंपनी

© 2025 EMOTIV, सभी अधिकार सुरक्षित।

आपकी गोपनीयता की पसंद (कुकी सेटिंग्स)
*अस्वीकृति – EMOTIV उत्पादों का उद्देश्य केवल अनुसंधान अनुप्रयोगों और व्यक्तिगत उपयोग के लिए होना है। हमारे उत्पादों को EU निर्देश 93/42/EEC में परिभाषित चिकित्सा उपकरणों के रूप में बेचा नहीं जाता है। हमारे उत्पादों को किसी बीमारी के निदान या उपचार के लिए उपयोग के लिए डिज़ाइन या उद्देश्य नहीं किया गया है।
अनुवाद पर नोट: इस वेबसाइट के गैर-अंग्रेजी संस्करणों का अनुवाद आपकी सुविधा के लिए कृत्रिम बुद्धिमत्ता का उपयोग करके किया गया है। जबकि हम सटीकता के लिए प्रयास करते हैं, स्वचालित अनुवाद में त्रुटियाँ या ऐसे अंतरों हो सकते हैं जो मूल पाठ से भिन्न होते हैं। सबसे सटीक जानकारी के लिए, कृपया इस साइट के अंग्रेजी संस्करण को देखें।
सहायता
कंपनी

© 2025 EMOTIV, सभी अधिकार सुरक्षित।

आपकी गोपनीयता की पसंद (कुकी सेटिंग्स)
*अस्वीकृति – EMOTIV उत्पादों का उद्देश्य केवल अनुसंधान अनुप्रयोगों और व्यक्तिगत उपयोग के लिए होना है। हमारे उत्पादों को EU निर्देश 93/42/EEC में परिभाषित चिकित्सा उपकरणों के रूप में बेचा नहीं जाता है। हमारे उत्पादों को किसी बीमारी के निदान या उपचार के लिए उपयोग के लिए डिज़ाइन या उद्देश्य नहीं किया गया है।
अनुवाद पर नोट: इस वेबसाइट के गैर-अंग्रेजी संस्करणों का अनुवाद आपकी सुविधा के लिए कृत्रिम बुद्धिमत्ता का उपयोग करके किया गया है। जबकि हम सटीकता के लिए प्रयास करते हैं, स्वचालित अनुवाद में त्रुटियाँ या ऐसे अंतरों हो सकते हैं जो मूल पाठ से भिन्न होते हैं। सबसे सटीक जानकारी के लिए, कृपया इस साइट के अंग्रेजी संस्करण को देखें।
