[FieldTrip] ft_singleplotTFR issues.

Marion Vincent marion.vincent at univ-lille.fr
Thu Mar 14 11:01:11 CET 2019


An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190314/7367adc9/attachment-0002.html>
-------------- next part --------------
Ooooo Thanks a lot! It works!!
I was so focused on the time error that I didn’t see it.
Thanks again!
Marion
Marion VINCENT
Eng., PhD , CNRS Research Engineer
Tel: +33 607 59 46 76
Laboratoire SCALab UMR CNRS 9193
Université Lille 3
BP 60149
59653 Villeneuve d'Ascq Cedex
http://scalab.cnrs.fr
--------------------------------------------
L’Imaginarium / SCV-IrDIVE Equipex
99a Boulevard Descat
59200 Tourcoing
http://www.irdive.fr/
De: Schoffelen, J.M. (Jan Mathijs)
Envoyé le:jeudi 14 mars 2019 10:52
À: FieldTrip discussion list
Objet:Re: [FieldTrip] ft_singleplotTFR issues.


Hi Marion,

There’s a typo in your configuration, cfg.method should read ‘mtmconvol’

Best wishes,
Jan-Mathijs



J.M.Schoffelen, MD PhD
Associate PI, VIDI-fellow - PI, language in interaction
Telephone: +31-24-3614793
Physical location: room 00.028
Donders Centre for Cognitive Neuroimaging, Nijmegen, The Netherlands



On 13 Mar 2019, at 17:25, Marion Vincent <marion.vincent at univ-lille.fr<mailto:marion.vincent at univ-lille.fr>> wrote:

Hi Jan-Mathijs,
Thanks for you answer. I’ve looked at the time axis and still can’t figure out why I don’t get the time vector in the TF output.
I’ve tried differetn range of toi vectors.
        % Low-frequencies 2-30 Hz
        cfg              = [];
        cfg.output       = 'pow';
        cfg.method       = 'mtmfft';
        cfg.taper        = 'hanning';
        cfg.foi          = 2:2:30;                         % analysis 2 to 30 Hz in steps of 2 Hz / because deltaT=1/500ms=2 Hz
        cfg.t_ftimwin    = ones(length(cfg.foi),1).*0.5;   % length of time window = 0.5 sec
        cfg.toi          = -0.5:0.05:0.5;                    % time window "slides" from -1 to 1 sec in steps of 0.05 sec (50 ms)
        tfreq_Low_1{i} = ft_freqanalysis(cfg, erp);
My erp signal has the following time vector:
Time: 1x2151 points
I segmented my trials starting 1 s before the trigger onset and ending 1.1s after it. Data were sampled at 1024 Hz.
If I understand well, as I’ve got a 500ms Hanning window I have to stop my cfg.toi vector to a maximun of 1.1s-500ms. So the cfg.toi I used should be fine.
Moreover I get the Following warning message: «Warning: the trial definition in the configuration is inconsistent with the actual data».
I’ve got a demo script analysis of data for the same processing pipeline, that give the same warning, but the ft_freqanalysis result contains a time vector.
So I don’t understand why I works in that case but not in mine.
Sorry for my «silly» questions..
And thanks for your help.
Marion
Marion VINCENT
Eng., PhD , CNRS Research Engineer
Tel: +33 607 59 46 76
Laboratoire SCALab UMR CNRS 9193
Université Lille 3
BP 60149
59653 Villeneuve d'Ascq Cedex
http://scalab.cnrs.fr<http://scalab.cnrs.fr/>
--------------------------------------------
L’Imaginarium / SCV-IrDIVE Equipex
99a Boulevard Descat
59200 Tourcoing
http://www.irdive.fr/
De: Schoffelen, J.M. (Jan Mathijs)
Envoyé le:mardi 5 mars 2019 11:37
À: FieldTrip discussion list
Objet:Re: [FieldTrip] ft_singleplotTFR issues.


In this case, I don’t believe in coincidence. I suspect that the time axis in your ‘erp’ variable does not align well with the cfg.toi you try to extract with ft_freqanalysis,  in combination with the time-frequency window specified, which is longer (0.5 s) in the ‘low’ frequency case than in the ‘high’ frequency case.

Jan-Mathijs


On 5 Mar 2019, at 11:06, Marion Vincent <marion.vincent at univ-lille.fr<mailto:marion.vincent at univ-lille.fr><mailto:marion.vincent at univ-lille.fr>> wrote:

Hi Jan-Mathijs,

Thanks for your reply. I noticed there is no time matrix in the tfreq_Low  structure (from ft_freqanalysis(cfg, erp)).
But I can’t figure out why.
I’ve compared my erp matrix and my code for setting the ft_freqanalysis  parameters with ones from examples and it seems that my structures are welle shaped.

Do you have any idea ?
Moreover I can’t figure out how my hig frequency analysis works fine compraed to the low frequency one. Maybe it worked by chance.

Thanks,
Marion


Marion VINCENT
Eng., PhD , CNRS Research Engineer
Tel: +33 607 59 46 76

Laboratoire SCALab UMR CNRS 9193
Université Lille 3
BP 60149
59653 Villeneuve d'Ascq CedexI
http://scalab.cnrs.fr<http://scalab.cnrs.fr/><http://scalab.cnrs.fr<http//scalab.cnrs.fr/%3E>
--------------------------------------------
L’Imaginarium / SCV-IrDIVE Equipex
99a Boulevard Descat
59200 Tourcoing
http://www.irdive.fr<http://www.irdive.fr/>/<http://www.irdive.fr/><http://www.irdive.fr<http//www.irdive.fr/%3E/%3Chttp://www.irdive.fr/%3E>

De : Schoffelen, J.M. (Jan Mathijs)<mailto:jan.schoffelen at donders.ru.nl>
Envoyé le :lundi 4 mars 2019 18:11
À : FieldTrip discussion list<mailto:fieldtrip at science.ru.nl>
Objet :Re: [FieldTrip] ft_singleplotTFR issues.

Hi Marion,

The assertion on line 177 (in the current version of the code this is line 178) of ft_singleplotTFR checks for the presence of a ‘freq’ and ‘time’ field in your data. It seems as if your data doesn’t meet this expectation. Hence the error.

Jan-Mathijs

J.M.Schoffelen, MD PhD
Senior Researcher, VIDI-fellow - PI, language in interaction
Telephone: +31-24-3614793
Physical location: room 00.028
Donders Centre for Cognitive Neuroimaging, Nijmegen, The Netherlands

On 4 Mar 2019, at 16:02, Marion Vincent <marion.vincent at univ-lille.fr<mailto:marion.vincent at univ-lille.fr><mailto:marion.vincent at univ-lille.fr>> wrote:

Dear all,

I’m having some troubles using the ft_singleplotTFR for time-frequency analysis.
I’ve tried 2 different TF analysis : 'mtmfft' for low frequencies and ‘'mtmconvol'’ for high frequencies.

However I’ve got the Following error for the single plot of the low freq TF (but it works for high freq TF).

****************************
Error using ft_singleplotTFR (line 177)
please use ft_singleplotER for time-only or frequency-only data
****************************

Does anyone have any idea ? I’ve put the entire code below.

Thanks !
Marion



%% TIME-FREQUENCY ANALYSIS
close all
clear all

%% ************************ INITIALIZATION ******************
%% Parameters to change
EXP             =   '1';
seg_window      =   [1 1.1]; % in seconds %preStim/postStim
cond            = 1; % number of the experimental condition 1 to 4
Baseline_Window      = [-1 0] ; %as the baseline lasts 1s before the stimulus onset

%%  initialize fieldtrip
startup()

%% initialize paths
path_Biosemi  = 'C:\Users\Marion\Documents\EEG\Prosodie - Angele\AV-Exps';
path_data='C:\Users\Marion\Documents\MATLAB\EEG_AV-Exps';

%% subjects list
load(fullfile(path_data, 'data', 'Participants_List.mat'));

for i=1:27
   subjects{i,1}=list_Participants(i);
end
clear list_Participants i

%% ************************ TIME-FREQUENCY DOMAIN ANALYSIS --- WANG et al. 2017 %%%%%%%%
% LOW FREQUENCIES: 2-30 Hz => Hanning multitaper %% fixed window length
% HIGH FREQUENCIES: 25-100 Hz => Slepian multitaper

tic
nsubj = 4;%numel(subjects);

tfreq_Low  = cell(1,nsubj);
tfreq_High  = cell(1,nsubj);

for i=1:nsubj
   % load the erp data
   datapath = strcat(path_data, '/data')
   results_path=fullfile(datapath,['Participant_' num2str(subjects{i})]);

   datafile = fullfile(results_path, ['erp_Cond' num2str(cond) '.mat']);
   % load the ERP data of subject i from disk
   load(datafile);

   erp=eval(['ERP_cond' num2str(cond)]);

   % Low-frequencies 2-30 Hz
   cfg              = [];
   cfg.output       = 'pow';
   cfg.method       = 'mtmfft';
   cfg.taper        = 'hanning';
   cfg.foi          = 2:2:30;                         % analysis 2 to 30 Hz in steps of 2 Hz
   cfg.t_ftimwin    = ones(length(cfg.foi),1).*0.5;   % length of time window = 0.5 sec
   cfg.toi          = -1:0.05:1.1;                    % time window "slides" from -1 to 1.1 sec in steps of 0.05 sec (50 ms)
   tfreq_Low = ft_freqanalysis(cfg, erp);

%     % Visualization single plot
%     cfg = [];
%     cfg.channel      = {'A1'};
%     figure
%     ft_singleplotTFR(cfg, tfreq_Low);


   % High frequencies 25-100 Hz
   cfg              = [];
   cfg.output       = 'pow';
   cfg.method       = 'mtmconvol';
   cfg.taper        = 'dpss';
   cfg.foi          = 25:5:100;                         % analysis 25 to 100 Hz in steps of 5 Hz
   h  =  ones(length(cfg.foi),1).*20 % vector 1 x numfoi, the amount of spectral smoothing through multi-tapering.
   % Note that 4 Hz smoothing means plus-minus 4 Hz, i.e. a 8 Hz smoothing box.
   cfg.t_ftimwin    = ones(length(cfg.foi),1).*0.2;   % length of time window = 0.2 sec FIXED
   cfg.toi          = -1:0.05:1.1;                  % time window "slides" from -0.1 to 1 sec in steps of 0.01 sec (10 ms)
   tfreq_High = ft_freqanalysis(cfg, erp);

   % Visualization single plot
   cfg = [];
   cfg.channel      = {'A1'};
   figure
   ft_singleplotTFR(cfg, tfreq_High);


   % Visualization single plot
   cfg = [];
   cfg.layout = 'C:\Users\Marion\Documents\MATLAB\EEG_AV-Exps\biosemi128.lay';
   ft_multiplotTFR(cfg, TFRhann_HF);

end


Marion VINCENT
Eng., PhD , CNRS Research Engineer
Tel: +33 607 59 46 76

Laboratoire SCALab UMR CNRS 9193
Université Lille 3
BP 60149
59653 Villeneuve d'Ascq Cedex
http://scalab.cnrs.fr<http://scalab.cnrs.fr/><http://scalab.cnrs.fr<http//scalab.cnrs.fr/%3E>
--------------------------------------------
L’Imaginarium / SCV-IrDIVE Equipex
99a Boulevard Descat
59200 Tourcoing
http://www.irdive.fr<http://www.irdive.fr/>/<http://www.irdive.fr/><http://www.irdive.fr<http//www.irdive.fr/%3E/%3Chttp://www.irdive.fr/%3E>

_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202





_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202



_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202





_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202
-------------- next part --------------
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202


More information about the fieldtrip mailing list