Very large amplitude values of EEG while plotting

Hi,

So I am recording EEG data using the pyLSL streaming in Python. I save the recorded data files in a .fif format so I can use the MNE libraries for processing and analysis. As I was plotting the data I was confused by the scaling. It looks like the amplitude is really big but the plot shows it in uV.

I realise the amplitude shouldn’t be greater than 100uV so I am not quite sure what went wrong.

I am using the G.tech Unicorn Hybrid black recording device. I am not sure if it is recording the data in V or uV.

This is the code I used to record the data.

# Initialize the LSL stream
streams = resolve_stream()
inlet = StreamInlet(streams[0])
 
# Define the parameters
sfreq = 250  # Sample frequency in Hz
ch_names = ['Fz', 'C3', 'Cz', 'C4', 'Pz', 'PO7', 'Oz', 'PO8']  
ch_types = ['eeg'] * len(ch_names)  
 
# Create an MNE info structure
info = mne.create_info(ch_names=ch_names, sfreq=sfreq, ch_types=ch_types)
 
# Collect data 
data = []
timestamps = []
for _ in range(sfreq * 30):  # 30sec of data
    sample, timestamp = inlet.pull_sample()
    data.append(sample[:len(ch_names)])  
    timestamps.append(timestamp)
 
# Convert the data list to a numpy array and transpose it
data = np.array(data).T

 
# Create a RawArray and save it as a FIF file
raw = mne.io.RawArray(data, info)
filename = "testing_raw.fif"
raw.save(filename, overwrite=True)

Here is the screenshot of the plot below.

Thanks!

Taniya

The amplifier is probably recording the data in µV. You could verify this by looking at the data array (e.g. print the first few values of one or two channels). If you get values between about 10–500, that’s µV. MNE expects values to be in V, so you’d need to multiply by 1e-6 before creating the RawArray.

1 Like

Hi Clemens,

I printed the first few values and it was in the range of 200,000s. It doesn’t seem to be in uV.

Sounds more like nV, then? So you would need to multiply the value by 1e-9.

Hi Richard,

So I multiplied the data with 1e-9 and this is the graph I get.

The scaling still looks a bit small in my opinion and when I try to increase it a bit more, it cuts off the amplitude after a point.

Is this normal?

Also is there other ways to plot data in a raw.fif file without using the mne plot feature?

Thanks!

This doesn’t look right either, maybe you can check out the LSL configuration and/or the amplifier settings to find out what the actual unit is. But I’d say µV is more likely than nV.

You can plot the data (raw.get_data()) with any tool you like (e.g. Matplotlib), it’s arranged in a 2D array (channels × time).

Hi Clemens,

Sorry, I am quite new to this but where can I find the LSL configuration or the amplifier settings to check the units?

You would have to check the outlet, it depends on the specific app, but some outlets might let you set the scale of the recorded data. Regarding the amplifier, this should be documented in their manual.

However, if you didn’t record the data, maybe you can ask the person responsible for data collection?

1 Like

Hi everyone,

Thanks for the help! I checked the documentation and the device records the data in uV. So I have converted it by multiplying it into 1e-6 and it looks better.

The images above also had some additional drift to it so that’s probably why it still looked a bit off even after converting it from uV to V. Hopefully, I can fix that using a highpass filter.

Thank you a lot for the help!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.