[FieldTrip] Recording Biosemi GSR data in GDF files

Eric Pohlmeyer notthemindprobe at yahoo.com
Thu Feb 27 01:11:59 CET 2014


Thanks for your suggestions, after doing some digging in the Actiview Labview code and some Biosemi forums posting I found there is some interesting variations in the Biosemi GSR sensors that affect how they are interpreted by the biosemi2ft code and then stored in the GDF files.

Most significantly, for Biosemi there are two channels of analog data the correspond to 1 channel of GSR data.  In other words, to use biosemi2ft to get EEG channels 1:32 you would specify channels 1, 2, .... 32 in the biosemi2ft config file.  This corresponds to biosemi/BDF channels 1:32.  Similarly, if you want the 8 Biosemi external analog channels [biosemi channels 257 to 264] you would specify channels 257 to 264 in the config file for biosemi2ft.

However, if you specify that you want channels 265 and 266 in the biosemi2ft config this witll *not* give you the Biosemi GSR1 and Biosemi GSR2 channels.  Instead you will get two voltage measurements that are both used by Actiview to calculate GSR1.  Therefore you need to set up the biosemi2ft config file to recorded channels 265->268 [4 channels] in order the get the raw data that is used by Biosemi to calculate the contents of its channels 265(GSR1) and 266 (GSR2).

Actiview does something along the following with the pairs of channels to calculate GSR (the following would be for GSR1, GSR2 would use channels 268&267)
GSR1 = CH266-CH265
low pass filter GSR
GSR1 = 13.3*GSR
Max and minimum substraction in a sliding window (128 data points for a complete 16Hz excitation wave cycle when data is at 2048Hz, there is 50% window overlap)
GSR1 = GSR1/8192
GSR1 = 1/GSR1
GSR1 = 1E+9 * GSR1
There can be some variation to account for different speed modes/sampling rates (I've been running at 2048Hz).  There is also additional operations for verifying data integrity, and converting data types.

Anyway, one of the big things to be aware of is that when you go beyond channel 264 there is no longer a 1:1 relationship in the Biosemi data channeling numbering and the way that the biosemi2ft is accessing the (raw) data.  I haven't used any of the other Biosemi sensor data, but some of the messages in their forums suggest that the ERGO, RESP and TEMP sensors as well under go additional processing in Actiview.  So I don't know if there are multiple channels of 'raw' data that correspond to each of those.



 Message: 1
 Date: Tue, 18 Feb 2014 16:55:55 +0100
 From: Robert Oostenveld <r.oostenveld at donders.ru.nl>
 To: FieldTrip discussion list <fieldtrip at science.ru.nl>
 Subject: Re: [FieldTrip] Recording Biosemi GSR data in GDF
 Message-ID: <4A14FD77-D413-418C-B788-F45F0CD675AD at donders.ru.nl>
 Content-Type: text/plain; charset="us-ascii"
 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
   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 &&
     segment = signal(begsample:endsample);
     amplitude(t) = segment*model'; % discrete
 fourier transform
 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,
 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
 > 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

More information about the fieldtrip mailing list