Back to the main page.
Bug 1211 - ft_chantype should be made faster
Status | CLOSED WONTFIX |
Reported | 2011-12-01 21:23:00 +0100 |
Modified | 2012-03-14 10:00:39 +0100 |
Product: | FieldTrip |
Component: | core |
Version: | unspecified |
Hardware: | PC |
Operating System: | Mac OS |
Importance: | P3 enhancement |
Assigned to: | Eelke Spaak |
URL: | |
Tags: | |
Depends on: | |
Blocks: | |
See also: |
Robert Oostenveld - 2011-12-01 21:23:54 +0100
See ft_chantype, around line 454 % if possible, set additional types based on channel labels label2type = { {'ecg', 'ekg'}; {'emg'}; {'eog', 'heog', 'veog'}; {'lfp'}; {'eeg'}; }; for i = 1:numel(label2type) for j = 1:numel(label2type{i}) type(intersect(strmatch(label2type{i}{j}, lower(label)), strmatch('unknown', type, 'exact'))) = label2type{i}(1); end end This section is very slow due to the many strmatch calls. Please use tic/toc and especially the profiler to determine the time to execute.
Boris Reuderink - 2012-01-03 12:08:31 +0100
See revision 5086, fileio/ft_chantyp:472. Could you indicate how slow it is, and how much faster it should be? Do you have a specific benchmark?
Robert Oostenveld - 2012-01-03 12:19:09 +0100
Created attachment 208 screenshot of profiler
Robert Oostenveld - 2012-01-03 12:19:36 +0100
(In reply to comment #2) It is called in each FT function, and takes ~1 second at the start of each function. Speeding up this type of bookkeeping is beneficial in general. See attached screenshot and try cd data/ hdr = ft_read_header('Subject01.ds'); profile on ft_channelselection('MEG', hdr.label); profile report
Boris Reuderink - 2012-01-10 11:59:37 +0100
Created attachment 211 Screenshot of profiler run on mentat308.
Boris Reuderink - 2012-01-10 12:05:53 +0100
Created attachment 213 Screenshot of profiler run on Windows 7 (64bit)
Boris Reuderink - 2012-01-10 12:15:37 +0100
I have run the profiler both on Linux (mentat308) and my Windows laptop; and the results seem to differ quite a bit. However, I cannot find ft_chantype in the profile reports, nor in the profiled ft_channelselection. How are they related?
Eelke Spaak - 2012-02-08 14:25:35 +0100
Robert, my guess is you more likely mean ft_senstype? Indeed, ft_chantype is basically never used in the ft_* top-level functions.
Eelke Spaak - 2012-02-29 14:39:37 +0100
not worth investing time; ft_senstype only accounts for a few percent of execution time in e.g. ft_channelselection