Back to the main page.

Bug 1517 - dipole fitting dependent on optimization_toolbox

Status CLOSED INVALID
Reported 2012-06-11 22:17:00 +0200
Modified 2012-08-23 10:33:54 +0200
Product: FieldTrip
Component: forward
Version: unspecified
Hardware: Macintosh
Operating System: Mac OS
Importance: P3 blocker
Assigned to: Robert Oostenveld
URL:
Tags:
Depends on:
Blocks:
See also:

Joseph Dien - 2012-06-11 22:17:20 +0200

When I tried to use ft_dipolefitting with fieldtrip-20120608, I got the following error: License checkout failed. License Manager Error -5 Cannot find a license for optimization_toolbox. Make sure an INCREMENT line for optimization_toolbox exists in the license file, and that the formatting of the license file is correct. Troubleshoot this issue by visiting: http://www.mathworks.com/support/lme/R2012a/5 It might be helpful to test out changes by first disabling all but the core toolbox and seeing if it still runs, if compatibility is indeed a goal. Thanks for continuing the good work not the dipole code and the quick turnaround on the previous but report! Joe


Robert Oostenveld - 2012-06-11 22:38:55 +0200

Hi Joe, This error surprises me a bit, since the ft_dipolefitting calls inverse/dipole_fit, which explicitly checks for the optimization toolbox. If that is not present it will use the slower fminunc function and if it is present it will use the faster fminsearch. Could you check what is happening on line 72 in dipole_fit.m? You might want to explicitly clear ft_hastoolbox prior to that. Or just try clear ft_hastoolbox; ft_hastoolbox('optim') In my case it returns 1. From there you could dig further into the code at line 190 in ft_hastoolbox. That is where the presence of the toolbox AND the availability of a license is checked. The idea is that if the toolbox is installed but a license not available (e.g. because they ran out on the server due to other people using them), that dipole fitting still works. A more elaborate trail of the error (i.e. the backtrace of where the error happened) might also help. And the output of the "ver" command. Regarding your last comment: do you know how one can "disable" toolboxes? The only method I can think of is to reinstall MATLAB from DVD and in the GUI installation procedure make sure that the toolbox is not selected. The license of course will remain available on our university license server, but not having the toolbox in the local installation might be enough to emulate the toolbox-not-available situation.


Robert Oostenveld - 2012-06-11 22:54:59 +0200

(In reply to comment #1) I have just tried to reproduce it (with a completely different toolbox). Are you actually sure it is a real error? If I do >> license('checkout','random_toolbox') License checkout failed. License Manager Error -5 Cannot find a license for random_toolbox. Make sure an INCREMENT line for random_toolbox exists in the license file, and that the formatting of the license file is correct. Troubleshoot this issue by visiting: http://www.mathworks.com/support/lme/R2009a/5 Diagnostic Information: Feature: random_toolbox License path: /Users/robert/.matlab/R2009a_licenses:/Applications/MATLAB_R2009a.app/licenses/license.dat:/Applications/MATLAB_R2009a.app/licenses/license_MacBook_161051_R2009a.lic: FLEXnet Licensing error: -5,357. ans = 0 Then it prints very serious looking messages in the command window, but in the end it returns 0 (i.e. false). That is what ft_hastoolbox cares about, and then in dipole_fit it will use the default/core matlab fminunc version. So it might just be "noise" that is printed on the screen without affecting the proper functioning.


Joseph Dien - 2012-06-11 23:13:35 +0200

Created attachment 276 workspace contents


Joseph Dien - 2012-06-11 23:15:40 +0200

Hmmm... not used to this interface... Ah, the license error was a red herring that threw off my troubleshooting. It'd be a good idea to disable the output to the screen with an evalc function call I think. Anyway, the true problem is: Error: File: fminsearch.m Line: 1 Column: 1 The input character is not valid in MATLAB statements or expressions. It occurs at the call: [param, fval, exitflag, output] = optimfun(@dipfit_error, param, options, dat, sens, vol, constr, metric, checkinside, reducerank, normalize, normalizeparam, weight); I'm not really clear how the @ calls work so I'm having some trouble diagnosing this on my own. After doing: K>> which('fminsearch') /Applications/MATLAB_R2012a.app/toolbox/matlab/optimfun/fminsearch.m it looks to me like the set of input variables just doesn't match up with what fmnisearch is expecting. I'm attaching the contents of my workspace so you can try to replicate this issue. Thanks! Joe


Robert Oostenveld - 2012-06-12 10:00:37 +0200

(In reply to comment #4, short intermezzo) the @ syntax (function handle) allows you to use a symbolic name for the function. So you can do >> add = @plus; >> add(1,1) ans = 2 which is the same as >> plus(1,1) ans = 2 See >> help function_handle


Robert Oostenveld - 2012-06-12 10:10:27 +0200

(In reply to comment #4) I had to temporary copy dipfit_error into a separate m-file because from the command line I cannot directly call a sub-function, but then I am able to do load test.mat optimfun(@dipfit_error, param, options, dat,sens, vol, constr, metric, checkinside, reducerank, normalize, normalizeparam,weight) Iteration Func-count min f(x) Procedure 0 1 0.230587 1 4 0.228908 initial simplex 2 5 0.228908 reflect ... 112 198 0.224206 contract inside 113 200 0.224206 reflect 114 202 0.224206 contract outside Optimization terminated: the current x satisfies the termination criteria using OPTIONS.TolX of 1.000000e-04 and F(X) satisfies the convergence criteria using OPTIONS.TolFun of 1.000000e-04 ans = 61.4638 -15.9018 -13.0530 So everything still works for me... Your error Error: File: fminsearch.m Line: 1 Column: 1 The input character is not valid in MATLAB statements or expressions. suggests that the file /Applications/MATLAB_R2012a.app/toolbox/matlab/optimfun/fminsearch.m is corrupt. Matlab complains that it cannot read the file. What about >> help fminsearch and trying out one of the examples in the help? PS I should note that I don't have MATLAB 2012a yet, so I cannot exactly reproduce your situation.


Joseph Dien - 2012-06-12 16:12:52 +0200

Agh... I figured it out. It's a compatibility conflict with eeglab11_0_0_0b. Arno is including Octave versions of some of the Matlab functions it seems. When I remove eeglab11_0_0_0b/functions/octavefunc from the path, everything works fine again. Matlab isn't giving me the usual warnings of function name conflicts for some reason. I guess I need to talk to Arno about this. I wish he'd be more careful about these naming conflicts. Thanks for the help! Joe


Robert Oostenveld - 2012-06-12 16:16:22 +0200

good that it has been resolved!


Robert Oostenveld - 2012-08-23 10:33:54 +0200

closed multiple bugs that have been resolved for some time