Back to the main page.

Bug 1462 - speed up ft_prepare_neighbours

Status CLOSED FIXED
Reported 2012-05-09 10:08:00 +0200
Modified 2012-08-23 14:02:05 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P3 normal
Assigned to: Jörn M. Horschig
URL:
Tags:
Depends on:
Blocks:
See also:

Robert Oostenveld - 2012-05-09 10:08:57 +0200

around line 204 there is the following code k = 0; for i=1:length(neighbours) if isempty(neighbours(i).neighblabel) warning('FIELDTRIP:NoNeighboursFound', 'no neighbours found for %s\n', neighbours(i).label); else % only selected desired channels neighbours(i).neighblabel = ft_channelselection(desired, neighbours(i).neighblabel); end k = k + length(neighbours(i).neighblabel); end This causes ft_channelselection to be called many times, which in turn calls ft_senstype, which makes it very slow.


Jan-Mathijs Schoffelen - 2012-05-16 07:37:25 +0200

let's team up and fix. JM


Jörn M. Horschig - 2012-06-20 15:39:52 +0200

*** Bug 1541 has been marked as a duplicate of this bug. ***


Jörn M. Horschig - 2012-06-20 16:11:46 +0200

taken and...


Jörn M. Horschig - 2012-06-20 16:14:45 +0200

... fixed! 644 $ svn add test/test_ft_prepare_neighbours.m A test/test_ft_prepare_neighbours.m jorhor@mentat309:~/FieldTrip/trunk 645 $ svn ci ft_prepare_neighbours.m test/test_ft_prepare_neighbours.m -m "bugfix-#1462-prepare_neighbours works faster now when giving data as input" Sending ft_prepare_neighbours.m Adding test/test_ft_prepare_neighbours.m Transmitting file data .. fix: taking ismember, and calling ft_channelselection only once: desired = ft_channelselection({'all', '-SCALE', '-COMNT'}, desired); (...) neighbours(i).neighblabel = neighbours(i).neighblabel(ismember(neighbours(i).neighblabel, desired)); (...)


Jörn M. Horschig - 2012-08-23 14:02:05 +0200

bug closing time (http://www.youtube.com/watch?v=xGytDsqkQY8)