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)
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.
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).
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?
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.