[Eeglablist] Why does pop_saveset force data to single precision?

Scott Makeig smakeig at gmail.com
Sun Apr 17 11:43:28 PDT 2011


To clarify further, double precision is most necessary when running
iterative calculations, incuding ICA decomposition, in which the 32-bit
floating-point round-off errors would increase (at least) geometrically...
 The raw data, however are < 32-bit resolution, so saving it in double
precision is not necessary.

Scott Makeig

On Sat, Apr 16, 2011 at 9:08 AM, Arnaud Delorme <arno at ucsd.edu> wrote:

> Hi Niko,
>
> the reason EEGLAB saves in single precision is because no manufacturer can
> record precision of more than 32-bit (single precision). The actual
> resolution of most systems is 18 meaningful bits. The BDF format for
> instance only saves the first 24 bits (the EDF format only saves the first
> 16 bits so it might truncate some information).
>
> Then you might ask, why bother with double precision at all (double
> precision is 64-bit). The reason is that data processing algorithms (ICA for
> instance) do complex calculation on the data and that sometimes the result
> might not be accurate if you use 32 bits. This was especially true at the
> start of Matlab 7.x when single-precision routine had just been introduced
> and when single-precision routines were using some not-so-well-chosen
> approximations. For instance, when running ICA, we still systematically
> convert the data to double precision (unless there is not enough memory)
> even if you have selected single precision in your options.
>
> So the basic answer is: we sometimes need double precision for some complex
> calculation but it is not necessary to save as double precision since the
> first 18 bits of the data contain all of the relevant EEG information.
>
> Hope this helps,
>
> Arno
>
> On Apr 12, 2011, at 5:07 PM, Niko Busch wrote:
>
> > Hi everyone,
> >
> > I recently had trouble using signal processing functions because my EEG
> data are in single precision, whereas these functions expect double
> precision. On my machine, RAM is not really an issue, so I unchecked the
> EEGLAB option to use single precision to save RAM.
> >
> > After digging through a number of EEGLAB functions, which were used for
> pre-processing the data, I found that most functions do read the eeg_options
> file and use single/double precision accordingly. However, pop_saveset seems
> to force the data to single precision when the data are stored to the hard
> drive no matter which options are set in the eeg_options file:
> >
> > if ~strcmpi(class(EEG.data), 'memmapdata') & ~strcmpi(class(EEG.data),
> 'single')
> >         tmpdata       = single(reshape(EEG.data, EEG.nbchan,
>  EEG.pnts*EEG.trials));
> >
> > Of course I could delete these lines or use double(EEG.data) whenever I
> need double precision. However, I would like to understand why pop_saveset
> forces single precision and why it does not use the eeg_options.
> >
> > Any ideas, anyone?
> >
> > Best
> > Niko
> > _______________________________________________
> > 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
>



-- 
Scott Makeig, Research Scientist and Director, Swartz Center for
Computational Neuroscience, Institute for Neural Computation & Adj. Prof. of
Neurosciences, University of California San Diego, La Jolla CA 92093-0559,
http://sccn.ucsd.edu/~scott
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20110417/177eff51/attachment.html>


More information about the eeglablist mailing list