Raw Graph vs OSC - High-Frequency Noise

Post Reply
stellarpower
Posts: 10
Joined: Sat Jul 08, 2023 12:36 pm

Raw Graph vs OSC - High-Frequency Noise

Post by stellarpower »

Hi,

I have read in a few posts that the raw EEG data, as forwarded over OSC, hasn't had any processing applied - it's exactly as comes out the SDK (please correct me if I am wrong).

However, when I compare the graph I get of the raw OSC data on my PC against what I see on my phone, the graph in MindMonitor is a lot less noisy. I've put it through a 10th-order Butterworth bandstop at 48Hz-52Hz, and also am seeing a peak around 45 Hz at the moment, so have done the same around that frequency, but still, the trace on my computer has much more power in the high frequencies and visually is a lot noisier than in the graphing view built into the app.

Do you know why this might be at all? I was wondering about any filters the SDK/hardware might be applying, but, if the OSC data is in theory the same as the data that gets graphed, I'm not sure what can be going on, unless it's to do with the drawing settings (e.g. phone screen resolution) and not actually the data itself. I assumed there was a DC cut applied to say 1Hz, and powerline notch applied (given it's mentioned in the settings), but from what I gather from the posts I have read, nothing is in fact applied, and any appearance of DC removal is in effect due to the fact that it continually recentres the trace over time.

Thanks!
User avatar
James
Site Admin
Posts: 1082
Joined: Wed Jan 02, 2013 9:06 pm

Re: Raw Graph vs OSC - High-Frequency Noise

Post by James »

The RAW EEG has no filtering, what you see in the graph is the same as goes over OSC.

For the discrete frequency graph in the app (FFT frequency breakdown) I normalise to the mean, apply a hamming window, then FFT.
That's it.
In the app settings you can change the FFT window, but the default is 1024 (4 seconds). This window is passed over the live data and the graph refresh rate will depend on your phone CPU.

Lastly, note that a peak at 50Hz or 60Hz will be powerline noise.
stellarpower
Posts: 10
Joined: Sat Jul 08, 2023 12:36 pm

Re: Raw Graph vs OSC - High-Frequency Noise

Post by stellarpower »

Thanks, it's mainly the time-series I'm interested in at the moment; I did mean to look into the FFT settings more out of interest, but, am not worried right now re figuring this out.

Do you reckon it's most likely just the plotting then? As if the effective refresh rate of the plot is lower than the noise then these higher frequencies should, in a manner of speaking, not show up in the graph. Analysing some data offline (so I can go back and apply different filters at leisure) it seems if I cut everything above about 30 Hz then it looks closer to the plot I get in the app, but even with 50Hz and 45Hz notch it's definitely quite different.

Image
Image

These aren't at exactly the same time, but just two screenshots I had to hand that illustrate what I usually see. Definitely something like an eyeblink is often smooth in the MuseMonitor plot but quite noisy in the OSC plot.
User avatar
James
Site Admin
Posts: 1082
Joined: Wed Jan 02, 2013 9:06 pm

Re: Raw Graph vs OSC - High-Frequency Noise

Post by James »

Here's a quick test I did with TouchDesigner, displaying live RAW EEG data.
Looks the same to me #nofilters ;-)
Mind-Monitor-TouchDesigner-RAW.toe
(4.1 KiB) Downloaded 328 times
Screenshot 2023-07-08 221011.jpg
Screenshot 2023-07-08 221011.jpg (138.22 KiB) Viewed 1296 times
stellarpower
Posts: 10
Joined: Sat Jul 08, 2023 12:36 pm

Re: Raw Graph vs OSC - High-Frequency Noise

Post by stellarpower »

Apologies for the delay; I have modified my OSC code to output a copy to CSV as well. I was going to compare against the CSV from the app and graph it, but, I see this file seems to have the bandpowers in it, but not the raw data. I also managed to find a copy of what should be the protobuf specification on github, but not sure if would be the same situation - is there a way at all to output the raw values per sample for each sensor in the app recording output? Thanks
stellarpower
Posts: 10
Joined: Sat Jul 08, 2023 12:36 pm

Re: Raw Graph vs OSC - High-Frequency Noise

Post by stellarpower »

Does the plot perform any interpolation, by the way?
stellarpower
Posts: 10
Joined: Sat Jul 08, 2023 12:36 pm

Re: Raw Graph vs OSC - High-Frequency Noise

Post by stellarpower »

Afraid the quality isn't great as the only way I managed was to record the screen on my phone, which has suffered a bit from the MP4 compression on the fly, but this is an example of what I am seeing.

I've got two largeish troughs on the temporal lobes I've dotted in pink and used to align and scale the two plots so that they align. The frontal lobes look quite different, although some features can be seen between the two:
Frontal.jpg
Frontal.jpg (67.19 KiB) Viewed 1228 times
and in fact I synchronised the OSC and the screen recording video by making some large blinks, and even within this the two can be aligned and you can see there's a lot more noise in the temporal lobes than in the app graph:
Blinks noise.jpg
Blinks noise.jpg (31.55 KiB) Viewed 1228 times

For these images, I've scaled down the plots from EDFBrowser to fit, rather than upscaling the MindMonitor plots, so as not to distort the image size from MindMonitor and thus favour its plot.

Cheers
User avatar
James
Site Admin
Posts: 1082
Joined: Wed Jan 02, 2013 9:06 pm

Re: Raw Graph vs OSC - High-Frequency Noise

Post by James »

That looks like the same data to me.
I think what you're seeing is just the difference in pixel density on your phone vs your computer display.

The vertical dashed lines in the RAW EEG display are second markers. In your very first screenshot showing TP9, if I crop between them, then I count 107 pixels. 1 second has 256 data points, so it's likely you're only seeing half on your phone. Your computer render on the other hand is likely showing all the points with it's higher resolution screen and/or interpolation render.

By default the RAW EEG display shows 5 seconds of data, so that's 256*5 = 1280 pixels needed to display 100% of the points, plus ~1/3 extra for the data labels, so lets round up to 1400 pixels. My iPad Mini 4 in the screenshot has a resolution of 2048x1536, so it'll easily display all the data regardless of orientation. I'm wondering if your phone has a lower res?
User avatar
James
Site Admin
Posts: 1082
Joined: Wed Jan 02, 2013 9:06 pm

Re: Raw Graph vs OSC - High-Frequency Noise

Post by James »

BTW, the CSV does output all the RAW EEG data, but by default only writes to the CSV once per second, as most people just want to graph the waves. If you go to settings and change "Recording Interval" to "Constant" you'll get all the RAW EEG, but note that you will get a lot of duplicates on all the other data channels. For where the RAW EEG is in the file, check the CSV data spec in the FAQ section of the website.
Post Reply