tfanalysis - NaN

Jan Mathijs Schoffelen Jan.Schoffelen at FCDONDERS.RU.NL
Tue Jun 26 10:00:52 CEST 2007


Dear V and C,

Sorry to hop in into this discussion, but did you (V) explicitly check the
time-axes present in your data? In other words: there is a field in the data
structure (data.time) which specifies the time axis for each trial.
According to this axis, windows (cfg.t_ftimwins) are placed around the
(cfg.tois) you specify in your configuration. If there is a discrepancy
between cfg.toi, and data.time, NaNny things could happen. Because you
imported your files from BESA, something might be going on here.

Yours,

Jan-M

-----Original Message-----
From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf
Of Virginie van Wassenhove
Sent: Tuesday, June 26, 2007 6:25 AM
To: FIELDTRIP at NIC.SURFNET.NL
Subject: Re: [FIELDTRIP] tfanalysis - NaN

Hi Christian,

>In the configuration options you have specified cfg.taper =
>'hanning' which will apply only one (i.e., the hanning) taper to
>your data. If you want to use multitapers you need to set cfg.taper
>= 'dpss'  or just leave the field it out of the cfg (since
>multitapers are the default).

Ah yes, sorry, I have been playing around with most parameters so
both 'hanning' and 'dpss' lead to the same result (and other windows
and wavelet analysis).

>I'm not really sure what you mean by normalized (the csd is
>obviously a density) but if there were any divide by zero issues
>then matlab would be chucking warnings. What happens when you set
>cfg.output = 'pow'; ?

Same thing whether I use 'pow' or 'powandcsd'. So I meant 'pow'
normalization (I assume it's baseline corrected on the pre-stimulus
interval?).

Since I imported raw data from besa (as .dat files) there might be an
error in the previous specifications / preprocessing. I don't see
otherwise see any major confound in the tf analysis... I will look
some more into that part.

Thanks for your help!
-vv




>>>>>>>Hi Virginie,
>>>>>>>
>>>>>>>the function freqanalysis will return NaNs when a time
>>>>>>>frequency tile extends beyond a corresponding data segment.
>>>>>>>One would usually expect a "U" shaped padding of NaNs at the
>>>>>>>boundaries of any TFR which has longer time windows for lower
>>>>>>>frequencies. From the cfg options you specify below I can see
>>>>>>>that you have a data segment of 1.1 seconds length and the
>>>>>>>moving windows cfg.t_tfimwin are quite long at the low
>>>>>>>ffrequencies, e.g., 1 Hz = 4 s, 6 Hz  = 0.6666 s. Hence the
>>>>>>>NaNs seem perfectly "normal" in this case. The only way to
>>>>>>>avoid NaN in the time window of interest (using this type of
>>>>>>>time-frequency tiling) is to make your epochs longer.
>>>>>>>
>>>>>>>Hope this helps,
>>>>>>>Christian
>>>>>>>
>>>>>>>
>>>>>>>On 21 Jun 2007, at 20:44, Virginie van Wassenhove wrote:
>>>>>>>
>>>>>>>>Hello again.
>>>>>>>>
>>>>>>>>I am finding NaN whatever method I use (multitaper and
>>>>>>>>wavelet analysis), yet using a different analysis tool with
>>>>>>>>similar parameters I obtain clean results.
>>>>>>>>epoch length    = 1.1 s
>>>>>>>>baseline length = 0.3 s
>>>>>>>>sampling rate   = 500Hz
>>>>>>>>
>>>>>>>>I tried several suggestions listed in the previous message
>>>>>>>>list for a similar problem, but none seem to provide
>>>>>>>>reasonable results (aka always NaN).
>>>>>>>>Also tried with different subjects, no particular error
>>>>>>>>otherwise. I am sending a sample script in case someone has a
>>>>>>>>suggestion on this...
>>>>>>>>Thanks for your help once more!
>>>>>>>>
>>>>>>>>Virginie
>>>>>>>>
>>>>>>>>%% ================================================
>>>>>>>>% TF analysis - MULTITAPER
>>>>>>>>cfg             = [];
>>>>>>>>cfg.method      = 'mtmconvol';
>>>>>>>>cfg.taper       = 'hanning';
>>>>>>>>cfg.output      = 'powandcsd';
>>>>>>>>%cfg.channel    = 'all';
>>>>>>>>cfg.channel     = 'E75';
>>>>>>>>
>>>>>>>>%win_length     = 0.128;
>>>>>>>>%win_n  = floor(2.*(1.1./win_length)-1);
>>>>>>>>
>>>>>>>>cfg.foi = 1:5:45;
>>>>>>>>%cfg.t_ftimwin = ones(1,win_n).*win_length;
>>>>>>>>cfg.t_ftimwin   = 4./cfg.foi;
>>>>>>>>%cfg.toi        = -0.3:win_length/2:0.8;
>>>>>>>>cfg.toi         = -0.3:0.05:0.8;
>>>>>>>>
>>>>>>>>% cfg.pad       = 'maxperlen';
>>>>>>>>% cfg.keeptrials = 'no';
>>>>>>>>% cfg.keeptapers ='no';
>>>>>>>>s08_ill_mult = freqanalysis(cfg,s08_ill);
>>>>>>>>
>>>>>>>>%% ========================
>>>>>>>>% plot freq data
>>>>>>>>cfg             = [];
>>>>>>>>cfg.baseline    = [-0.3 0];
>>>>>>>>cfg.layout      = egilay;
>>>>>>>>cfg.zlim        = [-0.00001 0.000001];          % a comparer
>>>>>>>>entre participants
>>>>>>>>% warning off                 % NaN
>>>>>>>>clf
>>>>>>>>%multiplotTFR(cfg,s08_ill_mult);
>>>>>>>>singleplotTFR(cfg,s08_ill_mult);
>>>>>>>>
>>>>>>>>%% ================================================
>>>>>>>>% TF analysis - wavelet
>>>>>>>>cfg             = [];
>>>>>>>>cfg.method      = 'wltconvol';
>>>>>>>>cfg.width               = 4;
>>>>>>>>cfg.output       = 'pow';
>>>>>>>>cfg.foi                 = 1:2:30;
>>>>>>>>cfg.toi                 = -0.3:0.05:0.8;
>>>>>>>>s14_ill_wvlt    = freqanalysis(cfg, s14_ill);
>>>>>>>>%% ========================
>>>>>>>>cfg = [];
>>>>>>>>cfg.baseline    = [-0.3 0];
>>>>>>>>cfg.zlim        = [-1 1];
>>>>>>>>cfg.showlabels = 'yes';
>>>>>>>>cfg.layout      = egilay;
>>>>>>>>clf
>>>>>>>>multiplotTFR(cfg, s14_ill_wvlt)
>>>>>>>>
>>>>>>>>%% ================================================
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>Virginie van Wassenhove, PhD
>>>>>>>>
>>>>>>>>:::::::::::: contact info  :::::::::::::
>>>>>>>>Caltech - Division of Biology
>>>>>>>>1200 E. California Blvd M/C 139-74
>>>>>>>>Pasadena CA 91125 USA
>>>>>>>>:::::::::::::::::::::::::::::::::::::::::::::::::
>>>>>>>><<<<mailto:vvw at caltech.edu>mailto:vvw at caltech.edu>mailto:vvw at caltech
.edu>mailto:vvw at caltech.edu><<<mailto:vvw at caltech.edu>mailto:vvw at caltech.edu
>mailto:vvw at caltech.edu><<mailto:vvw at caltech.edu>mailto:vvw at caltech.edu><mai
lto:vvw at caltech.edu>vvw at caltech.edu
>>>>>>>><<<<mailto:Virginie.van.Wassenhove at gmail.com>mailto:Virginie.van.Was
senhove at gmail.com>mailto:Virginie.van.Wassenhove at gmail.com>mailto:Virginie.v
an.Wassenhove at gmail.com><<<mailto:Virginie.van.Wassenhove at gmail.com>mailto:V
irginie.van.Wassenhove at gmail.com>mailto:Virginie.van.Wassenhove at gmail.com><<
mailto:Virginie.van.Wassenhove at gmail.com>mailto:Virginie.van.Wassenhove at gmai
l.com><mailto:Virginie.van.Wassenhove at gmail.com>Virginie.van.Wassenhove at gmai
l.com
>>>>>>>>W: 626.395.8959
>>>>>>>><<<<http://www.its.caltech.edu/~vvw>http://www.its.caltech.edu/~vvw>
http://www.its.caltech.edu/~vvw>http://www.its.caltech.edu/~vvw>http://www.i
ts.caltech.edu/~vvw
>>>>>>>>
>>>>>>>>:::::::::::::::::: extras ::::::::::::::::::::
>>>>>>>><<<<http://www.kiva.org>http://www.kiva.org>http://www.kiva.org>http
://www.kiva.org>http://www.kiva.org
>>>>>>>><<<http://www.thehungersite.com>http://www.thehungersite.com>http://
www.thehungersite.com>http://www.thehungersite.com/
>>>>>>>><<<http://www.agloco.com/r/BBBS1539>http://www.agloco.com/r/BBBS1539
>http://www.agloco.com/r/BBBS1539>http://www.agloco.com/r/BBBS1539
>>>>>>>>:::::::::::::::::::::::::::::::::::::::::::::::::
>>>>>>>>
>>>>>>>>----------------------------------
>>>>>>>>The aim of this list is to facilitate the discussion between
>>>>>>>>users of the FieldTrip  toolbox, to share experiences and to
>>>>>>>>discuss new ideas for MEG and EEG analysis. See also
>>>>>>>><<<<http://listserv.surfnet.nl/archives/fieldtrip.html>http://listse
rv.surfnet.nl/archives/fieldtrip.html>http://listserv.surfnet.nl/archives/fi
eldtrip.html>http://listserv.surfnet.nl/archives/fieldtrip.html>http://lists
erv.surfnet.nl/archives/fieldtrip.html
>>>>>>>>and
>>>>>>>><<<<http://www.ru.nl/fcdonders/fieldtrip>http://www.ru.nl/fcdonders/
fieldtrip>http://www.ru.nl/fcdonders/fieldtrip>http://www.ru.nl/fcdonders/fi
eldtrip>http://www.ru.nl/fcdonders/fieldtrip.
>>>>>>>
>>>>>>>---------------------------------------------------------------------
-
>>>>>>>Christian Hesse, PhD, MIEEE
>>>>>>>
>>>>>>>F.C. Donders Centre for Cognitive Neuroimaging
>>>>>>>P.O. Box 9101
>>>>>>>NL-6500 HB Nijmegen
>>>>>>>The Netherlands
>>>>>>>
>>>>>>>Tel.: +31 (0)24 36 68293
>>>>>>>Fax: +31 (0)24 36 10989
>>>>>>>
>>>>>>>Email:
>>>>>>><<<<mailto:c.hesse at fcdonders.ru.nl>mailto:c.hesse at fcdonders.ru.nl>mai
lto:c.hesse at fcdonders.ru.nl>mailto:c.hesse at fcdonders.ru.nl><<<mailto:c.hesse
@fcdonders.ru.nl>mailto:c.hesse at fcdonders.ru.nl>mailto:c.hesse at fcdonders.ru.
nl><<mailto:c.hesse at fcdonders.ru.nl>mailto:c.hesse at fcdonders.ru.nl><mailto:c
.hesse at fcdonders.ru.nl>c.hesse at fcdonders.ru.nl
>>>>>>>Web:
>>>>>>><<<<http://www.fcdonders.ru.nl>http://www.fcdonders.ru.nl>http://www.
fcdonders.ru.nl>http://www.fcdonders.ru.nl>www.fcdonders.ru.nl
>>>>>>>---------------------------------------------------------------------
-
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>----------------------------------
>>>>>>>
>>>>>>>The aim of this list is to facilitate the discussion between
>>>>>>>users of the FieldTrip toolbox, to share experiences and to
>>>>>>>discuss new ideas for MEG and EEG analysis.
>>>>>>>
>>>>>>><<<http://listserv.surfnet.nl/archives/fieldtrip.html>http://listserv
.surfnet.nl/archives/fieldtrip.html>http://listserv.surfnet.nl/archives/fiel
dtrip.html>http://listserv.surfnet.nl/archives/fieldtrip.html
>>>>>>>
>>>>>>><<http://www.ru.nl/fcdonders/fieldtrip/>http://www.ru.nl/fcdonders/fi
eldtrip/>http://www.ru.nl/fcdonders/fieldtrip/
>>>>>>
>>>>>>Virginie van Wassenhove, PhD
>>>>>>
>>>>>>:::::::::::: contact info  :::::::::::::
>>>>>>Caltech - Division of Biology
>>>>>>1200 E. California Blvd M/C 139-74
>>>>>>Pasadena CA 91125 USA
>>>>>>:::::::::::::::::::::::::::::::::::::::::::::::::
>>>>>><<<mailto:vvw at caltech.edu>mailto:vvw at caltech.edu>mailto:vvw at caltech.ed
u><<mailto:vvw at caltech.edu>mailto:vvw at caltech.edu><mailto:vvw at caltech.edu>vv
w at caltech.edu
>>>>>><<<mailto:Virginie.van.Wassenhove at gmail.com>mailto:Virginie.van.Wassen
hove at gmail.com>mailto:Virginie.van.Wassenhove at gmail.com><<mailto:Virginie.va
n.Wassenhove at gmail.com>mailto:Virginie.van.Wassenhove at gmail.com><mailto:Virg
inie.van.Wassenhove at gmail.com>Virginie.van.Wassenhove at gmail.com
>>>>>>W: 626.395.8959
>>>>>><<<http://www.its.caltech.edu/~vvw>http://www.its.caltech.edu/~vvw>htt
p://www.its.caltech.edu/~vvw>http://www.its.caltech.edu/~vvw
>>>>>>
>>>>>>:::::::::::::::::: extras ::::::::::::::::::::
>>>>>><<<http://www.kiva.org>http://www.kiva.org>http://www.kiva.org>http://
www.kiva.org
>>>>>><<http://www.thehungersite.com>http://www.thehungersite.com>http://www
.thehungersite.com/
>>>>>><<http://www.agloco.com/r/BBBS1539>http://www.agloco.com/r/BBBS1539>ht
tp://www.agloco.com/r/BBBS1539
>>>>>>:::::::::::::::::::::::::::::::::::::::::::::::::
>>>>>>
>>>>>>----------------------------------
>>>>>>The aim of this list is to facilitate the discussion between
>>>>>>users of the FieldTrip  toolbox, to share experiences and to
>>>>>>discuss new ideas for MEG and EEG analysis. See also
>>>>>><<<http://listserv.surfnet.nl/archives/fieldtrip.html>http://listserv.
surfnet.nl/archives/fieldtrip.html>http://listserv.surfnet.nl/archives/field
trip.html>http://listserv.surfnet.nl/archives/fieldtrip.html
>>>>>>and
>>>>>><<<http://www.ru.nl/fcdonders/fieldtrip>http://www.ru.nl/fcdonders/fie
ldtrip>http://www.ru.nl/fcdonders/fieldtrip>http://www.ru.nl/fcdonders/field
trip.
>>>>>
>>>>>----------------------------------------------------------------------
>>>>>Christian Hesse, PhD, MIEEE
>>>>>
>>>>>F.C. Donders Centre for Cognitive Neuroimaging
>>>>>P.O. Box 9101
>>>>>NL-6500 HB Nijmegen
>>>>>The Netherlands
>>>>>
>>>>>Tel.: +31 (0)24 36 68293
>>>>>Fax: +31 (0)24 36 10989
>>>>>
>>>>>Email:
>>>>><<<mailto:c.hesse at fcdonders.ru.nl>mailto:c.hesse at fcdonders.ru.nl>mailto
:c.hesse at fcdonders.ru.nl><<mailto:c.hesse at fcdonders.ru.nl>mailto:c.hesse at fcd
onders.ru.nl><mailto:c.hesse at fcdonders.ru.nl>c.hesse at fcdonders.ru.nl
>>>>>Web:
>>>>><<<http://www.fcdonders.ru.nl>http://www.fcdonders.ru.nl>http://www.fcd
onders.ru.nl>www.fcdonders.ru.nl
>>>>>----------------------------------------------------------------------
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>----------------------------------
>>>>>
>>>>>The aim of this list is to facilitate the discussion between
>>>>>users of the FieldTrip toolbox, to share experiences and to
>>>>>discuss new ideas for MEG and EEG analysis.
>>>>>
>>>>><<http://listserv.surfnet.nl/archives/fieldtrip.html>http://listserv.su
rfnet.nl/archives/fieldtrip.html>http://listserv.surfnet.nl/archives/fieldtr
ip.html
>>>>>
>>>>><http://www.ru.nl/fcdonders/fieldtrip/>http://www.ru.nl/fcdonders/field
trip/
>>>>
>>>>Virginie van Wassenhove, PhD
>>>>
>>>>:::::::::::: contact info  :::::::::::::
>>>>Caltech - Division of Biology
>>>>1200 E. California Blvd M/C 139-74
>>>>Pasadena CA 91125 USA
>>>>:::::::::::::::::::::::::::::::::::::::::::::::::
>>>><<mailto:vvw at caltech.edu>mailto:vvw at caltech.edu><mailto:vvw at caltech.edu>
vvw at caltech.edu
>>>><<mailto:Virginie.van.Wassenhove at gmail.com>mailto:Virginie.van.Wassenhov
e at gmail.com><mailto:Virginie.van.Wassenhove at gmail.com>Virginie.van.Wassenhov
e at gmail.com
>>>>W: 626.395.8959
>>>><<http://www.its.caltech.edu/~vvw>http://www.its.caltech.edu/~vvw>http:/
/www.its.caltech.edu/~vvw
>>>>
>>>>:::::::::::::::::: extras ::::::::::::::::::::
>>>><<http://www.kiva.org>http://www.kiva.org>http://www.kiva.org
>>>><http://www.thehungersite.com>http://www.thehungersite.com/
>>>><http://www.agloco.com/r/BBBS1539>http://www.agloco.com/r/BBBS1539
>>>>:::::::::::::::::::::::::::::::::::::::::::::::::
>>>>
>>>>----------------------------------
>>>>The aim of this list is to facilitate the discussion between
>>>>users of the FieldTrip  toolbox, to share experiences and to
>>>>discuss new ideas for MEG and EEG analysis. See also
>>>><<http://listserv.surfnet.nl/archives/fieldtrip.html>http://listserv.sur
fnet.nl/archives/fieldtrip.html>http://listserv.surfnet.nl/archives/fieldtri
p.html
>>>>and
>>>><<http://www.ru.nl/fcdonders/fieldtrip>http://www.ru.nl/fcdonders/fieldt
rip>http://www.ru.nl/fcdonders/fieldtrip.
>>>
>>>----------------------------------------------------------------------
>>>Christian Hesse, PhD, MIEEE
>>>
>>>F.C. Donders Centre for Cognitive Neuroimaging
>>>P.O. Box 9101
>>>NL-6500 HB Nijmegen
>>>The Netherlands
>>>
>>>Tel.: +31 (0)24 36 68293
>>>Fax: +31 (0)24 36 10989
>>>
>>>Email:
>>><<mailto:c.hesse at fcdonders.ru.nl>mailto:c.hesse at fcdonders.ru.nl><mailto:c
.hesse at fcdonders.ru.nl>c.hesse at fcdonders.ru.nl
>>>Web:
>>><<http://www.fcdonders.ru.nl>http://www.fcdonders.ru.nl>www.fcdonders.ru.
nl
>>>----------------------------------------------------------------------
>>>
>>>
>>>
>>>
>>>----------------------------------
>>>
>>>The aim of this list is to facilitate the discussion between users
>>>of the FieldTrip toolbox, to share experiences and to discuss new
>>>ideas for MEG and EEG analysis.
>>>
>>><http://listserv.surfnet.nl/archives/fieldtrip.html>http://listserv.surfn
et.nl/archives/fieldtrip.html
>>>
>>>http://www.ru.nl/fcdonders/fieldtrip/
>>
>>Virginie van Wassenhove, PhD
>>
>>:::::::::::: contact info  :::::::::::::
>>Caltech - Division of Biology
>>1200 E. California Blvd M/C 139-74
>>Pasadena CA 91125 USA
>>:::::::::::::::::::::::::::::::::::::::::::::::::
>><mailto:vvw at caltech.edu>vvw at caltech.edu
>><mailto:Virginie.van.Wassenhove at gmail.com>Virginie.van.Wassenhove at gmail.co
m
>>W: 626.395.8959
>><http://www.its.caltech.edu/~vvw>http://www.its.caltech.edu/~vvw
>>
>>:::::::::::::::::: extras ::::::::::::::::::::
>><http://www.kiva.org>http://www.kiva.org
>>http://www.thehungersite.com/
>><http://www.agloco.com/r/BBBS1539>http://www.agloco.com/r/BBBS1539
>>:::::::::::::::::::::::::::::::::::::::::::::::::
>>
>>----------------------------------
>>The aim of this list is to facilitate the discussion between users
>>of the FieldTrip  toolbox, to share experiences and to discuss new
>>ideas for MEG and EEG analysis. See also
>><http://listserv.surfnet.nl/archives/fieldtrip.html>http://listserv.surfne
t.nl/archives/fieldtrip.html
>>and
<http://www.ru.nl/fcdonders/fieldtrip>http://www.ru.nl/fcdonders/fieldtrip.
>
>----------------------------------------------------------------------
>Christian Hesse, PhD, MIEEE
>
>F.C. Donders Centre for Cognitive Neuroimaging
>P.O. Box 9101
>NL-6500 HB Nijmegen
>The Netherlands
>
>Tel.: +31 (0)24 36 68293
>Fax: +31 (0)24 36 10989
>
>Email: <mailto:c.hesse at fcdonders.ru.nl>c.hesse at fcdonders.ru.nl
>Web: <http://www.fcdonders.ru.nl>www.fcdonders.ru.nl
>----------------------------------------------------------------------
>
>
>
>
>----------------------------------
>
>The aim of this list is to facilitate the discussion between users
>of the FieldTrip toolbox, to share experiences and to discuss new
>ideas for MEG and EEG analysis.
>
>http://listserv.surfnet.nl/archives/fieldtrip.html
>
>http://www.ru.nl/fcdonders/fieldtrip/

Virginie van Wassenhove, PhD

:::::::::::: contact info  :::::::::::::
Caltech - Division of Biology
1200 E. California Blvd M/C 139-74
Pasadena CA 91125 USA
:::::::::::::::::::::::::::::::::::::::::::::::::
vvw at caltech.edu
Virginie.van.Wassenhove at gmail.com
W: 626.395.8959
http://www.its.caltech.edu/~vvw

:::::::::::::::::: extras ::::::::::::::::::::
http://www.kiva.org
http://www.thehungersite.com/
http://www.agloco.com/r/BBBS1539
:::::::::::::::::::::::::::::::::::::::::::::::::

----------------------------------
The aim of this list is to facilitate the discussion between users of the
FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG
and EEG analysis. See also
http://listserv.surfnet.nl/archives/fieldtrip.html and
http://www.ru.nl/fcdonders/fieldtrip.

----------------------------------
The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/fcdonders/fieldtrip.



More information about the fieldtrip mailing list