[FieldTrip] Interpolation and ft_channelrepair

Jörn M. Horschig jorn at artinis.com
Wed Oct 21 14:16:10 CEST 2015


Hi Grazia,

 

uh, jah, my bad, try cfg.elec instead ;) 

 

Best,

Jörn

 

--

 

Jörn M. Horschig, PhD, Software Engineer

 <http://www.artinis.com/> Artinis Medical Systems  |  +31 481 350 980 

 

From: fieldtrip-bounces at science.ru.nl [mailto:fieldtrip-bounces at science.ru.nl] On Behalf Of Grazia Di Pisa
Sent: Wednesday, October 21, 2015 12:28 PM
To: fieldtrip at science.ru.nl
Subject: Re: [FieldTrip] Interpolation and ft_channelrepair

 

Hi Jörn,

 

Thanks for the advice - I've just tried to add cfg.sens = sens but still the same error.

 

Any other suggestions?

 

thanks,

~ grazia

 

 

On 21Oct, 2015, at 12:00, fieldtrip-request at science.ru.nl <mailto:fieldtrip-request at science.ru.nl>  wrote:

 

Send fieldtrip mailing list submissions to
          fieldtrip at science.ru.nl <mailto:fieldtrip at science.ru.nl> 

To subscribe or unsubscribe via the World Wide Web, visit
          http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
or, via email, send a message with subject or body 'help' to
          fieldtrip-request at science.ru.nl <mailto:fieldtrip-request at science.ru.nl> 

You can reach the person managing the list at
          fieldtrip-owner at science.ru.nl <mailto:fieldtrip-owner at science.ru.nl> 

When replying, please edit your Subject line so it is more specific
than "Re: Contents of fieldtrip digest..."


Today's Topics:

  1. Call for new post docs in the Obleser lab | Auditory
     Cognition (Jonas Obleser)
  2. Spectrum normalization (Wunderle, Thomas)
  3. Interpolation and ft_channelrepair (Grazia Di Pisa)
  4. Re: Interpolation and ft_channelrepair
     (=?UTF-8?Q?J=C3=B6rn_M._Horschig?=)


----------------------------------------------------------------------

Message: 1
Date: Tue, 20 Oct 2015 06:07:51 -0500
From: Jonas Obleser <jonas at obleser.de <mailto:jonas at obleser.de> >
To: fieldtrip at science.ru.nl <mailto:fieldtrip at science.ru.nl> , AUDITORY at LISTS.MCGILL.CA <mailto:AUDITORY at LISTS.MCGILL.CA> 
Subject: [FieldTrip] Call for new post docs in the Obleser lab |
          Auditory         Cognition
Message-ID: <71625964-4C4D-41CA-BEDB-171CEFBC87F8 at obleser.de <mailto:71625964-4C4D-41CA-BEDB-171CEFBC87F8 at obleser.de> >
Content-Type: text/plain; charset=utf-8

The research group ?Auditory Cognition? (headed by Jonas Obleser; auditorycognition.com), now at the University of L?beck, is seeking to hire two Postdoctoral researchers, initially for 3 years, with the option of extension.

These positions fall into the larger framework of an ERC Consolidator grant ?The listening challenge: How ageing brains adapt? (AUDADAPT) recently awarded to Jonas Obleser, and will allow the joint development of cognitive-neuroscience and psychological research projects targeting adaptive control in the auditory modality of middle-aged adults.

Please download the full job advert here: https://www.dropbox.com/s/sqc9c94ewl6bjjh/Ausschreibung_1031_15_Wiss%20MitarbeiterIn_Psychologie_EN.pdf?dl=1 

Note the application deadline of November 12 (postal receipt).

http://auditorycognition.com
http://uni-luebeck.de




------------------------------

Message: 2
Date: Tue, 20 Oct 2015 14:58:25 +0000
From: "Wunderle, Thomas" <thomas.wunderle at esi-frankfurt.de <mailto:thomas.wunderle at esi-frankfurt.de> >
To: "fieldtrip at science.ru.nl <mailto:fieldtrip at science.ru.nl> " <fieldtrip at science.ru.nl <mailto:fieldtrip at science.ru.nl> >
Subject: [FieldTrip] Spectrum normalization
Message-ID:
          <27E5CAD9145EEC41BB9B34C01716A198880C3CD4 at UM-excdag-a02.um.gwdg.de <mailto:27E5CAD9145EEC41BB9B34C01716A198880C3CD4 at UM-excdag-a02.um.gwdg.de> >
Content-Type: text/plain; charset="iso-8859-1"

Hi all,

I have a question about how FieldTrip normalizes the output of a spectral analyses using ft_freqanalysis.
This is important for me, because I need the absolute value of the spectrum for a publication.

I was scanning through the code trying to find the normalization steps.
In particular, I don't understand the following steps:


1.)    The tapers (e.g. hanning) are normalized prior to the multiplication with the data by the following code:
tap = tap./norm(tap, 'fro');   (line 195 in the function fr_specest_mtmfft)
What is the rationale of dividing through this special norm of the taper itself?


2.)    After calculating the fft, the specrum is scaled (i.e. in the function fr_specest_mtmfft) by:

dum = dum .* sqrt(2 ./ endnsample);  (line 251)

Later on, to get to the power spectrum, the abs of the spectrum is taken and squared

powdum = abs(spectrum(acttap,:,foiind(ifoi),acttboi)) .^2; (line 629 in ft_frequanalysis)



This puzzles me, because scanning through the literature, the power spectrum should be given by

(2*abs(X)^2) ./ (nfft^2)                -> unit: V^2        (X=signal, nfft = number of data points)

and the PSD by

(2*abs(X)^2) ./ (nfft*Fs)              -> unit: V^2/Hz (X=signal, nfft = number of data points, Fs=sampling rate)



Alternatively, one can get the amplitude spectrum from the power spectrum by taking the square root of the PSD:

sqrt(PSD)                             -> unit: V/sqrt(Hz)

which is still different from

(2*abs(X)) ./ (nfft*Fres)               -> unit: V/Hz ?   (Fres = frequency resolution = Fs/nfft)



The result of these equations are different from what comes out of the FieldTrip code.

So what is the unit of the spectrum in FieldTrip?

What is the rationale of scaling the complex spectrum by sqrt(2/nfft) ?

Furthermore, is the unit for the different spectral estimation methods the same? That is, using mtmfft, mtmconvol, wavelet,...?

It would help me a lot if someone could clarify these points.

Thanks in advance,
Thomas


-----
Dr. Thomas Wunderle
Ernst Str?ngmann Institute (ESI) for Neuroscience<http://www.ncbi.nlm.nih.gov/feed/rss.cgi?ChanKey=PubMedNews>
in Cooperation with Max Planck Society <http://www.ncbi.nlm.nih.gov/feed/rss.cgi?ChanKey=PubMedNews>
Deutschordenstrasse 46
60528 Frankfurt am Main, Germany
www.esi-frankfurt.de <http://www.esi-frankfurt.de%3chttp:/www.esi-frankfurt.de/> <http://www.esi-frankfurt.de/>
thomas.wunderle at esi-frankfurt.de <mailto:thomas.wunderle at esi-frankfurt.de%3cmailto:thomas.wunderle at esi-frankfurt.de> <mailto:thomas.wunderle at esi-frankfurt.de>
Tel:   +49 69 96769 516
Fax:   +49 69 96769 555

Sitz der Gesellschaft: Frankfurt am Main
Registergericht: Amtsgericht Frankfurt - HRB 84266
Gesch?ftsf?hrer: Prof. Dr. Pascal Fries


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20151020/eebaf460/attachment-0001.html>

------------------------------

Message: 3
Date: Wed, 21 Oct 2015 10:30:07 +0200
From: Grazia Di Pisa <g.dipisa at gmail.com <mailto:g.dipisa at gmail.com> >
To: fieldtrip at science.ru.nl <mailto:fieldtrip at science.ru.nl> 
Subject: [FieldTrip] Interpolation and ft_channelrepair
Message-ID: <A46541FB-BC67-44E7-A9CD-541FB39B7C54 at gmail.com <mailto:A46541FB-BC67-44E7-A9CD-541FB39B7C54 at gmail.com> >
Content-Type: text/plain; charset=utf-8

Dear all,

I?m trying to do interpolation to repair some bad channels, but I?m getting the error below.
I've read the ft_fetch_sens help but I don?t understand how I should specify the electrodes.

Is there a file I should upload or am I missing something in my code? 
Any help or hint is very much appreciated!

thanks in advance,
~ grazia


//
Error using ft_fetch_sens (line 183)
no electrodes or gradiometers specified.

Error in ft_channelrepair (line 115)
sens = ft_fetch_sens(cfg, data);

Error in new_analyse_GDP (line 42)
ft_channelrepair(cfg, data)
//

This is my code:

15      cfg = [];
16      cfg_neighb                  = [];
17      cfg_neighb.method     = 'triangulation'; 
18    cfg.senstype       = 'EEG';
19    cfg_neighb.layout         = 'biosemi64.lay';
20    neighbours         = ft_prepare_neighbours(cfg_neighb);
21    
22    cfg.neighbours               = neighbours;
23    cfg.channel        = {'Fp1', 'Fp2', 'AF7', 'AF3','AF8','F7','F5','FT9',}; 
24    cfg.feedback      = 'yes';
25    cfg.layout                      = 'biosemi64.lay';
26    lay                                              = ft_prepare_layout(cfg);
27    
28    sens                                = data;
29    sens.type                        = 'eeg';
30    sens.label                       = lay.label;
31    sens.chanpos                  = lay.pos;
32    sens.chanpos(:,3)           = 0;
33  
34   ft_neighbourplot(cfg, data)
35 
36    cfg                                             = [];
37    cfg.method                    = 'nearest';
38    cfg.badchannel              = {'Fp1', 'Fp2', 'AF7', 'AF3','AF8','F7','F5','FT9'};
39    cfg.neighbours               = neighbours;
40    cfg.trials                        = 'all';
41     
42    ft_channelrepair(cfg, data)







------------------------------

Message: 4
Date: Wed, 21 Oct 2015 10:42:03 +0200
From: "=?UTF-8?Q?J=C3=B6rn_M._Horschig?=" <jorn at artinis.com <mailto:jorn at artinis.com> >
To: "'FieldTrip discussion list'" <fieldtrip at science.ru.nl <mailto:fieldtrip at science.ru.nl> >
Subject: Re: [FieldTrip] Interpolation and ft_channelrepair
Message-ID: <002b01d10bdc$5d377040$17a650c0$@artinis.com <mailto:002b01d10bdc$5d377040$17a650c0$@artinis.com> >
Content-Type: text/plain;      charset="UTF-8"

Dear Grazia,

try adding cfg.sens = sens; before line 42. That will set the sensor definition so that ft_channelrepair knows the location of your channels, which is otherwise not obvious.

Best,
J?rn

--

J?rn M. Horschig, PhD, Software Engineer
Artinis Medical Systems  |  +31 481 350 980 




-----Original Message-----
From: fieldtrip-bounces at science.ru.nl <mailto:fieldtrip-bounces at science.ru.nl>  [mailto:fieldtrip-
bounces at science.ru.nl <mailto:bounces at science.ru.nl> ] On Behalf Of Grazia Di Pisa
Sent: Wednesday, October 21, 2015 10:30 AM
To: fieldtrip at science.ru.nl <mailto:fieldtrip at science.ru.nl> 
Subject: [FieldTrip] Interpolation and ft_channelrepair

Dear all,

I?m trying to do interpolation to repair some bad channels, but I?m getting
the error below.
I've read the ft_fetch_sens help but I don?t understand how I should specify
the electrodes.

Is there a file I should upload or am I missing something in my code?
Any help or hint is very much appreciated!

thanks in advance,
~ grazia


//
Error using ft_fetch_sens (line 183)
no electrodes or gradiometers specified.

Error in ft_channelrepair (line 115)
sens = ft_fetch_sens(cfg, data);

Error in new_analyse_GDP (line 42)
ft_channelrepair(cfg, data)
//

This is my code:

15      cfg = [];
16      cfg_neighb                  = [];
17      cfg_neighb.method     = 'triangulation';
18    cfg.senstype       = 'EEG';
19    cfg_neighb.layout         = 'biosemi64.lay';
20    neighbours         = ft_prepare_neighbours(cfg_neighb);
21
22    cfg.neighbours               = neighbours;
23    cfg.channel        = {'Fp1', 'Fp2', 'AF7', 'AF3','AF8','F7','F5','FT9',};
24    cfg.feedback      = 'yes';
25    cfg.layout                      = 'biosemi64.lay';
26    lay                                              = ft_prepare_layout(cfg);
27
28    sens                                = data;
29    sens.type                        = 'eeg';
30    sens.label                       = lay.label;
31    sens.chanpos                  = lay.pos;
32    sens.chanpos(:,3)           = 0;
33
34   ft_neighbourplot(cfg, data)
35
36    cfg                                             = [];
37    cfg.method                    = 'nearest';
38    cfg.badchannel              = {'Fp1', 'Fp2', 'AF7', 'AF3','AF8','F7','F5','FT9'};
39    cfg.neighbours               = neighbours;
40    cfg.trials                        = 'all';
41
42    ft_channelrepair(cfg, data)





_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl <mailto:fieldtrip at donders.ru.nl> 
http://mailman.science.ru.nl/mailman/listinfo/fieldtrip





------------------------------

_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl <mailto:fieldtrip at donders.ru.nl> 
http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

End of fieldtrip Digest, Vol 59, Issue 17
*****************************************

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20151021/fdead2ac/attachment-0002.html>


More information about the fieldtrip mailing list