Scaling issue while plotting EEG signal

  • MNE version: 1.8.0
  • operating system: e.g. Windows 11

I recorded SSVEP based BCI Paradigm EEG signal using Mitsar SmartBCIx24 (19 channel) acquisition system. I recorded the signal for 5.6 minutes with sampling frequency of 256 Hz. I exported that signal in .DAT format and imported that EEG file in python.

Then the signal values are extracted and created an MNE object using that data. Raw data is in the shape of [19, 86416]. If I plot that signal using “raw_mne.plot(scalings=‘auto’, title=‘EEG Data’, show=True)”, it shows the EEG signal for 5.6 minutes. But there is an scaling issues occurred in that plot, where, It I tried to visualize 2 second data, the signal becomes flat line. I had attached that code and EEG signal file and its output for the reference. Kindly explain the issue and rectify it. Thank you.

Python code:

import pandas as pd
import numpy as np
import mne

# Define the file path
file_path = r"C:\Users\Barath\Desktop\MITSAR_RAW\14_11_24\win_eeg_formats\SSVEP_EEG.txt"

# Load the data into a DataFrame, assuming tab or space-separated values
# Adjust delimiter if necessary (e.g., ',' for comma-separated)
eeg_data = pd.read_csv(file_path, delimiter='\t', header=None)  # Use '\t' for tab, adjust if needed

# Split each row into 19 separate columns
# Use space as the delimiter within each row and expand to 19 columns
eeg_data_corrected = eeg_data[0].str.split(expand=True).astype(float)

raw_data = eeg_data_corrected.T
print("Shape of the raw data", raw_data.shape)

# Define sampling frequency and channel info
sfreq = 256  # Sampling frequency in Hz
n_channels = raw_data.shape[0]  # Number of EEG channels
channel_names = [f"EEG {i+1}" for i in range(n_channels)]
channel_types = ['eeg'] * n_channels

# Create MNE Info object
info = mne.create_info(ch_names=channel_names, sfreq=sfreq, ch_types=channel_types)
# Create RawArray object
raw_mne = mne.io.RawArray(raw_data.values, info)

# Plot the EEG data
raw_mne.plot(scalings='auto', title='EEG Data', show=True)

I also attached the google drive file link to download data file below for the reference,

It seems like the data is not stored in V. You can rescale your data after importing by e.g.

raw.apply_function(lambda x: x * 1e-6, channel_wise=False)

This rescales from µV to V, but you can adjust the factor to match the actual scaling of your data.

1 Like

I tried this manual rescaling also, still it shows similar above results only. In MNE library, there is an option for adjusting the sensitivity of the plotted signal manually by pressing plus key. If I decrease the sensitivity to the range of 100 microvolts, then the signal is appears like this, it is not in the zero baseline . I had attached the snip of that output below for the reference.

It seems like your data might not be in microvolts then. I’d try adjusting the scaling factor until you get signals in the expected range. Also, I’m not sure how to read the data you linked – which format is this?