[Eeglablist] Scaling data to microvolts after loadavg()

Yang Zhang zhangyang873 at yahoo.com.cn
Fri May 20 18:32:24 PDT 2011


Dear Arno and Stephen,

The reason for the Stephen problem is that the nsweeps parameter in the header data of avg file have different means for two types of avg file,(i.e., single subject avg and grand average avg).

Hence even the loadavg.m do a right rescale for grand

In single subject based avg file, the "nsweeps" parameter indicates the true sweeps numbers in the eeg file that the avg file averaged from. 
But for grand averaged (i.e., averaging cross multiple single subject avg file) the "nsweeps" indicated the number of subjects rather than the sweep numbers that supposed be submitted into the rescale equation(...electrodes(elec).calib/nsweeps). 
In the later case (grand averaged file) the true sweeps numbers is given by the compsweeps parameter in the header data of avg files.

Also attached a new loadavg_bcl.m file revised from EEGLAB's original loadeeg function. 

The new function will automatically determine the type of the avg file(single vs. grand) and accordingly choose the right parameter for the rescale formulation.

And the output data would be the same as your can see in Scan 4. 


Hope this help for you!


Best wishes!

-YANG



Yang Zhang
------------------------------------
Department of Psychology
Northeast Normal University
Chang Chun, Ji Lin, China
130024
zhangyang873 at yahoo.com.cn
zhangyang873 at gmail.com
-------------------------------------





On May 20, 2011, at 10:49 PM, Arnaud Delorme wrote:

> Dear Stephen,
> 
> this is a known problem with the loadavg() function. I suggest you modify the loadavg.m function directly and send us an updated version with microvolt scaling. Ideally, there would be an input parameter that would indicate if the user wants the data converted to microvolt or not.
> 
> Best,
> 
> Arno
> 
> On May 17, 2011, at 7:52 PM, Stephen Politzer-Ahles wrote:
> 
>> Hello all,
>> 
>> I am using loadavg() to import Neuroscan average files for some simple processing in MATLAB, and I would like to scale the imported data back into microvolts (so that I can compare the data I'm working with in MATLAB against data processed in Neuroscan, which represents data points in microvolts). Does anyone happen to have any sample code to do this? I found the following instructions in http://sccn.ucsd.edu/eeglab/allfunctions/loadavg.m :
>> 
>> % Average data is stored as 4-byte floats in vectored format for each
>> % channel. Each channel has a 5-byte header that is no longer used. Thus,
>> 
>> % after the main file header, there is an unused 5-byte header followed by
>> % erp.pnts of 4-byte floating point numbers for the first channel; then a
>> % 5-byte header for channel two followed by erp.pnts*sizeof(float) bytes,
>> 
>> % etc. Therefore, the total number of bytes after the main header is:
>> % erp.nchannels * (5 + erp.pnts*sizeof(float)). To scale a data point to
>> % microvolts, multiply by the channel-specific calibration factor (i.e., for
>> 
>> % electrode j: channel[j]->calib) and divide by the number of sweeps in the
>> % average (i.e., channel[j]->n).
>> 
>> 
>> However, I don't know how to retrieve the necessary information (number of sweeps and calibration factor) when running loadavg(). The function outputs the number of sweeps in the MATLAB command window (from fprintf('number of trials (s)       : %d\n', nsweeps);), but as far as I can tell that number isn't stored in a variable anywhere that I can access? Any advice would be greatly appreciated.
>> 
>> Thank you,
>> Stephen Politzer-Ahles
>> 
>>  
>> -- 
>> Stephen Politzer-Ahles
>> University of Kansas
>> Linguistics Department
>> http://www.linguistics.ku.edu/
>> _______________________________________________
>> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
>> To unsubscribe, send an empty email to eeglablist-unsubscribe at sccn.ucsd.edu
>> For digest mode, send an email with the subject "set digest mime" to eeglablist-request at sccn.ucsd.edu
> 
> _______________________________________________
> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> To unsubscribe, send an empty email to eeglablist-unsubscribe at sccn.ucsd.edu
> For digest mode, send an email with the subject "set digest mime" to eeglablist-request at sccn.ucsd.edu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20110521/7fb5e75d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: loadavg_bcl.m
Type: application/octet-stream
Size: 4475 bytes
Desc: not available
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20110521/7fb5e75d/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20110521/7fb5e75d/attachment-0001.html>


More information about the eeglablist mailing list