I’ve made quite a bad mistake in ca. 14 EEG recordings – I recorded at 10uV resolution @ 5000 Hz instead of 0.1 uV @ 500 Hz. I’m conducting an ERP experiment, and the signals of interest are on the order of ~5 uV. I’m wondering if there is any way to up-sample the voltage given I have way more time series data points than I need..? Some sort of interpolation?

I’ve seen a number of posts on up-sampling from say 500 hz to 1000 hz, but not sure if the principal is the same?

Is there a way to trade off the sample rate against the poor resolution? Maybe by means of interpolation, or an averaging method to apply directly to the raw data**

This represents about 42 hours of recording time and I’m anxious to know if I can recover any usable data from these recordings, or if I have to try to get participants back in (there is a treatment enrollment deadline which means I can’t simply acquire more data).

migrated from psychology.stackexchange.com 2 days ago

This question came from our site for practitioners, researchers, and students in cognitive science, psychology, neuroscience, and psychiatry.

  • This question should be migrated to DSP.SE: See OP's comment. – StrongBad Dec 10 at 16:46

The bit depth basically indicates how accurately your analog-to-digital converter records and reproduces the signal (Fig. 1). A higher bit depth means that more subtle fluctuations in the waveform are more faithfully reproduced in the digitized signal (source: Presonus)

As the answer from Bryan alludes to, data cannot be generated de novo, unfortunately. Data can be processed, yes, but data acquired at a certain resolution cannot be enhanced. Of course, as Strongbad indicates, you can generate an indefinite number of steps by upsampling, that's not an issue, but that will simply leave you with an estimate of possible intervening values; the real values are simply not there and are lost. Look at Fig. 1. If we would upsample the data, the points between successive samples would be interpolated, seemingly increasing your voltage steps, but the resulting trace will not be any better than it was before (only bigger :-).

Note that the resolution in the time-domain (sample rate) will not help you in any way. The amplitude (y) step size in Fig. 1 will not change, even if you has used an infinitely high sample rate.

enter image description here
Fig. 1. Illustration of bit depth. source: Presonus

  • Comments are not for extended discussion; this conversation has been moved to chat. – AliceD Dec 5 at 12:33
  • Hi Alice, thanks for your post. I'm obviously not experienced here but I'm curious what figure a and b above would look like after a moving average filter was applied as Strongbad suggests..? Would you recover similar approximations of the underlying smooth waveform? – PKnight Dec 5 at 22:25
  • Hi @AliceD. Due to a technique known as oversampling noise reduction, amplitude resolution (bit-depth) of an acquired data can be enhanced. Simply stated 4x oversampling adds 1 bit of extra amplitude resolution (after downsampling)... – Fat32 yesterday

When converting from a continuous time signal (i.e., analog signal) to a digital signal, we need to first sample it to create a discrete time signal and then quantize it to create a digital signal. Up sampling in time/frequency is not the same thing as increasing the number of quantization levels (i.e., bits).

Assuming your continuous time signal is band limited and you sampled at an appropriate sample rate (cf. Nyquist rate), then you do not lose any information by converting from a continuous time signal to a discrete time signal.

The quantization process is different. Moving from a discrete time signal to a digital signal introduces noise. The fewer sampling levels/bits you use, the more noise you introduce. This quantization "noise" is typically thought about as an additive white noise, but that really depends on the specifics of your recording system.

While the number of quantization levels you used means you added noise to your recordings, to the extent that the quantization noise is well modeled as additive white noise, your increased sampling rate means you can average to reduce the noise. Something like a moving average low pass filter might help you see what you are after in the time domain. Alternatively, you could look in the frequency domain and this might help.

In an attempt to illustrate this here is some uncommented MATLAB code and an unlabeled figure

enter image description here

The top panel shows a quasi-continuous sine wave in black, and two sampled versions (blue low rate, red high rate). The high sample rate was 16x the low rate. The second panel shows the quasi-continuous sine wave in black, and the sampled versions after quantization. The low rate was quantized with roughly 32 levels and the high rate with 8 levels. The 32 levels and low sample rate captures the sine wave nearly perfectly, while there are clear errors with the high sample rate low resolution version.

The bottom panel shows what happens if you downsample/decimate the high sample rate version in green while the red version is a 32 sample moving average filter (applied twice to deal with phase affects) followed by decimation. The moving average filter has removed some of the additional quantization noise. With real signals and depending on how they are recorded and the sample rate and quantization levels are set, your results may vary.

As for the idea that data cannot be generated de novo, that is not what we are doing. We are in effect trading high frequency information to better see the low frequency information. If the EEG signal used the entire bandwidth of the high sample rate recording, then there would be little you can do. This answer relies on the fact that there is spare bandwidth and much of the quantization noise is located outside the spectral region of interest.

slowSR = 32;
fastSR = 2;
NPTS = 1024;

q = @(x, N)round(x.*(N./2))./(N./2);
d = @(x, N)downsample(x, N);
f = @(x, N)filtfilt(1/N.*ones(N, 1), 1, x);

t = 0:(1/NPTS):1;
n1 = 1:slowSR:(NPTS+1);
n2 = 1:fastSR:(NPTS+1);
t3 = t(1:slowSR:(NPTS+1));

x = sin(2*pi*1*t);
x1 = x(n1);
x2 = x(n2);
y1 = q(x1, 32);
y2 = q(x2, 8);

d3 = d(y2, slowSR./fastSR);
dr3 = d(f(y2, 32), slowSR./fastSR);


figure;

subplot(3,1,1); hold on;
plot(t, x, 'k'); stem(t(n2), x2, 'r'); stem(t(n1), x1, 'b');

subplot(3,1,2); hold on;
plot(t, x, 'k'); stem(t(n2), y2, 'r'); stem(t(n1), y1, 'b');

subplot(3,1,3); hold on;
plot(t, x, 'k'); stem(t3, d3, 'g'); stem(t3, dr3, 'r'); stem(t(n1), y1, 'b');
  • 1
    I don't think the OP asks for an answer on the sample rate; it's about the bit depth. – AliceD Dec 5 at 7:41
  • @AliceDthe OP asked if the processes were the same or different and how to proceed. I tried to explain why quantization noise is different than sampling. There is a ton of work looking at quantization noise and how to spectral reshape it to allow lower bit depths. – StrongBad Dec 5 at 11:53
  • The question is not about noise at all. – AliceD Dec 5 at 12:35
  • @PKnight you may want to ask for this question to be migrated as I think you might get better answers somewhere else. – StrongBad Dec 6 at 1:58
  • StrongBad is correct: the question is about noise (quantization noise). I second StrongBad's suggestion of a simple moving average filter. I'm happy to have this question migrated to SE.SP (the signal processing SE site where I'm one of the mods). – Peter K. Dec 6 at 15:52

You can (potentially) improve the amplitude resolution due to the technique of oversampling noise reduction. However your oversampling ratio is 10x and that may not provide much improvement: more than 1 bits but less than 2 bits. Noise shaping could potentially improve it further, but I cannot figure out if that was applicable to post processing...

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.