OpenBCI_GUI incorrect calculation of rms value

edited August 2016 in OpenBCI_GUI
Currently, the rms value of a channel is calculated as its standard deviation (call to std() in Open_BCI file, line 227). 
IMHO, this is incorrect since Yrms = sqrt(<Y^2>) while std(Y) = sqrt(<Y^2> - <Y>^2).
This bites you when the signal has a DC bias, which shows up when no BP filter is employed.
std(Y) = sqrt(<Y^2> - <Y>^2). If Y=DC+X, then <Y^2> = DC^2+Xrms^2, <Y>^2 = DC^2, and std(Y) = Xrms rather than Yrms = sqrt(DC^2 + Xrms^2).
Consider changing line 227 to:  data_std_uV[Ichan]=sqrt(pow(std(fooData_filt),2) + pow(mean(fooData_filt),2));

D

PS This is exactly the situation I ran into this: I had some electrodes that were railing and couldn't understand what was happening. Turns out, they were DC biased because of bio-incompatibility of the electrode material (brass).

Comments

  • wjcroftwjcroft Mount Shasta, CA
    @qwer1304, thanks for that correction on the RMS calculation.

    It IS widely acknowledged in EEG not to mix electrode metal types, because this causes a battery effect.

    Here is an insightful paper on the noise characteristics of various electrode metal types,

    http://www.eeginfo.ch/fileadmin/images/was_ist_neurofeedback/wie_funktionierts/SCP_recording_electrodes_and_paste.pdf

    This is especially important when measuring SCP, Slow Cortical Potentials or ILF, Infra Low Frequency EEG. In other words, very slowly changing DC bias. Brass is not mentioned at all.

    William

  • Thanx William. I was wondering why OpenBCI doesn't include (at least as an option) DC blocking caps to block offset voltages?
    Since the current design leaves this to DSP, high offset voltage easily saturates the input (especially if high gain is used).
  • wjcroftwjcroft Mount Shasta, CA
    OpenBCI is FbEEG, (full band EEG) so that protocols such ILF and SCP can be run.

    http://openbci.com/forum/index.php?p=/discussion/201/large-millivolt-data-values-fbeeg-full-band-eeg

    For conventional EEG, a high pass filter at around .5 hz removes the slow components. In an ILF design, the signal paths fork just before the highpass filter, with the slow waves having their own processing algorithms.

    See some of the links in that thread for the research supporting use of slow wave EEG.

    William

  • Thx William.
    This is why I was thinking of having an external optional (bypassable) high-pass filter. This would help folks who're not doing ILF but who struggle with high offsets that saturate the DSP. Filtering in software is fine as long as the offset does not saturate (rail) the DSP. In that case you need a filter before the DSP. Just a thought.
  • wjcroftwjcroft Mount Shasta, CA
    edited March 2016
    But with 24 bit samples, even at highest gain, you should not be saturating the amp (exceeding the max value), unless you have an electrode battery type of issue. If this is switchable at the amp itself, it adds to the complexity. All EEG amps these days are DC coupled. The old standard was AC coupling with a capacitor, but no one is doing that these days. 

    Regards,

    William


Sign In or Register to comment.