<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Eric,<div><br></div><div>Although I don't have any real expertise in this matter, let me share my 2 cents:</div><div><br></div><div>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:</div><div><br></div><div>for a given time t</div><div>  take the signal from t-1/16s in the past up to t-0 (i.e. now)</div><div>  estimate the 16Hz amplitude using a DFT, this is a single positive number (either RMS, Vpeak, or Vpeak-to-peak)</div><div>  estimate R = V/I (this requires that you know the current I)</div><div><br></div><div>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</div><div><br></div><div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier; min-height: 12.0px"> <br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Courier; color: rgb(49, 156, 43); "><span style="color: #000000">time    = (1:(fsample/16))/fsample; </span>% just enough time for one oscillation</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Courier; ">model_c = cos(16*2*pi*time);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Courier; ">model_s = sin(16*2*pi*time);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Courier; ">model   = model_c + i*model_s;      <span style="color: #319c2b">% i is the complex number</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Courier; ">model   = model./norm(model);</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier; min-height: 12.0px"> <br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Courier; ">signal    = randn(1,10*fsample);    <span style="color: #319c2b">% the raw signal</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Courier; ">amplitude = nan(size(signal));      <span style="color: #319c2b">% the estimated amplitude</span></div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier; color: #319c2b; min-height: 12.0px"> <br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Courier; "><span style="color: #3b01ff">for</span> t=1:length(signal)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Courier; color: rgb(49, 156, 43); "><span style="color: #000000">  begsample = t - fsample/16 + 1;   </span>% note the +1, the segment should be 64 samples long</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Courier; ">  endsample = t - 0;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Courier; ">  <span style="color: #3b01ff">if</span> begsample>=1 && endsample<=length(signal)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Courier; ">    segment = signal(begsample:endsample);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Courier; ">    amplitude(t) = segment*model'; <span style="color: #319c2b">% discrete fourier transform</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Courier; color: rgb(59, 1, 255); "><span style="color: #000000">  </span>end</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Courier; color: rgb(59, 1, 255); ">end</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier; color: #3b01ff; min-height: 12.0px"> <br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Courier; ">plot(abs(amplitude))</div></div><div><br></div><div>This can be translated to the online case by inserting it into one of the examples at <a href="http://fieldtrip.fcdonders.nl/development/realtime">http://fieldtrip.fcdonders.nl/development/realtime</a></div><div><br></div><div>best regards,</div><div>Robert</div><div><br></div><div><br><div><div>On 18 Feb 2014, at 0:00, Eric Pohlmeyer wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Fieldtrip users:<br><br>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.<br><br>Some more details:<br><br>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.<br><br>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. <br><br>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?<br><br>Thanks!<br><br>Eric<br><br>_______________________________________________<br>fieldtrip mailing list<br><a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>http://mailman.science.ru.nl/mailman/listinfo/fieldtrip<br></div></blockquote></div><br></div></body></html>