# [FieldTrip] Recording Biosemi GSR data in GDF files

Robert Oostenveld r.oostenveld at donders.ru.nl
Tue Feb 18 16:55:55 CET 2014

```Hi Eric,

Although I don't have any real expertise in this matter, let me share my 2 cents:

Your description suggests that the GSR is estimated using a 16Hz alternating current  of constant (but presumably unknown) amplitude, and that GSR is estimated by solving Ohms law (V=I*R). Rather than doing an instantaneous estimate (which is noisy, especially if the current passes the zero-crossing)  there will be a rectification and temporal smoothing of the voltage prior to the estimation. Or perhaps even better: a sliding window estimation:

for a given time t
take the signal from t-1/16s in the past up to t-0 (i.e. now)
estimate the 16Hz amplitude using a DFT, this is a single positive number (either RMS, Vpeak, or Vpeak-to-peak)
estimate R = V/I (this requires that you know the current I)

You could determine I by connecting a known resistor of appropriate size to the electrodes. Or perhaps you don't even have to; if you are not interested in the absolute value but only in changes, you would just take R as proportional to V. Something like this (for the offline case) would do it

time    = (1:(fsample/16))/fsample; % just enough time for one oscillation
model_c = cos(16*2*pi*time);
model_s = sin(16*2*pi*time);
model   = model_c + i*model_s;      % i is the complex number
model   = model./norm(model);

signal    = randn(1,10*fsample);    % the raw signal
amplitude = nan(size(signal));      % the estimated amplitude

for t=1:length(signal)
begsample = t - fsample/16 + 1;   % note the +1, the segment should be 64 samples long
endsample = t - 0;
if begsample>=1 && endsample<=length(signal)
segment = signal(begsample:endsample);
amplitude(t) = segment*model'; % discrete fourier transform
end
end

plot(abs(amplitude))

This can be translated to the online case by inserting it into one of the examples at http://fieldtrip.fcdonders.nl/development/realtime

best regards,
Robert

On 18 Feb 2014, at 0:00, Eric Pohlmeyer wrote:

> Fieldtrip users:
>
> Hi, my basic question is: Does anyone know how to record Biosemi GSR (skin conductance) data in a GDF file?  This is a different operation than just specifying additional non-EEG channels, as you do for the 8 external inputs on the Biosemi amp.
>
> Some more details:
>
> Currently we have been doing real-time transmission of EEG and the 8 external Biosemi channels using the Fieldtrip buffer and biosemi2ft, and all the data has been recorded fine.  We recently wanted to add GSR data to this.  However, it appears that the GSR data is treated differently by Biosemi than its other analog channels, thus when we add channel 265 (the GSR channel) to the biosemi2ft config file, we get another channel of data, but it is just the 16Hz excitation wave that Biosemi uses to deduce the GSR data, rather than the GSR data itself.  When we record the GSR data using Activew in a BDF file, the data is recorded fine.
>
> Apparently Biosemi does some extra manipulations to GSR data in Actiview prior its storage in the BDF files, this extra manipulation occurs after it arrives from the USB driver, and is likely why we just see the excitation sine wave in the GDF file.  This is in contrasts to the 8 external channels which do not undergo such additional manipulations.
>
> So, before I dove in and tried to work out a solution, I was just wondering if anyone had already come up with a workaround for saving the Biosemi GSR data into the GDF?
>
> Thanks!
>
> Eric
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20140218/5be55686/attachment-0002.html>
```