EEGLAB and supercomputing applications using free alternatives to Matlab
In the next few years at least, Matlab will remain the platform onto which EEGLAB is developed and supported. Matlab has a breadth of useful tools that are not yet matched by open source environments (e.g., the capacity to use multiple cores, 3-D interactive graphics with transparency, memory mapping, timers for real time programming), plus a wealth of available Matlab toolboxes that are handy and well teswted (e.g., image processing toolbox, for correcting for multiple comparisons; signal processing toolbox, for spectral decompositions; optimization toolbox, for optimizing code; bioinformatics toolbox, for EEG classification; virtual reality toolbox, for real time 3-D rendering of EEG activity). Finally, the Matlab compiler allows compiling EEGLAB, thus freeing oneself from using Matlab itself; even Matlab scripts can be run by the EEGLAB compiled version). Given that Matlab is accessible to almost anyone working in science, our incentive to find a Matlab alternative remains relatively low (except for high performance and cloud computing applications).
In the short term, Octave is the shortest way to using EEGLAB functions and actually obtain useful results (see below). In the longer term, SAGE (based on Python) are other potential alternatives to Matlab.
Deployment of EEGLAB on supercomputers
When it comes to using supercomputers, Matlab, although quite efficient, may become incredibly expensive. A single Matlab license may cost $2,100 ($1,050 for academia), and with all its commercial toolboxes might come to $145,000 or more. If you have a supercomputer with about 100 processors (as of 2011, this amounts to about $30,000 or 20,000 euros), you might need to pay the Mathworks about $30,000 to $500,000 to be able to run Matlab on it (the exact price depends on the number of users on the cluster, the number of nodes, and the extra toolboxes). This may be much more than the price of the supercomputer itself! Given that the Matlab core has not evolved dramatically over the past 10 years, and still has flaws (lack of consistency of the graphic interface between platforms; numerical inconsistencies in early version of Matlab 7.0), free alternatives to Matlab are needed in the Open Source community to run computation on supercomputers.
We have attempted to tackle this problem and as of June 2011 (EEGLAB 10.2+), we are currently supporting Octave (v3.4) for supercomputing applications (command line calls only, no graphic support). In our tests, Octave is about 50% slower than Matlab but this can easily be compensated by increasing the number of processors assigned to a specific processing task. Note that EEGLAB functions have not been parallelized (except a few rare exceptions). Therefore, you are required to open a Octave/Matlab session on each node and run custom scripts you write to take advantage of your parallel processing capability.
EEGLAB and Octave graphics
Although Octave is relatively compatible with Matlab for pure computation, the Octave graphic rendering engine (based on Gnuplot) is not powerful enough to render all subtleties of EEGLAB graphics. In particular the following cannot be rendered under Octave:
- Menus. Maybe QtOctave could help in this area; we have not yet tested it.
- Contour, surface, 3-D objects, complex graphics, interactive graphics...
However, Octave is actively evolving, and a more complete graphics environment might be supported in the future.
Below is a time-frequency decomposition plotted by Octave 3.0.3 for the tutorial dataset using the EEGLAB/Matlab code following it. The plot below is provided for illustrative purposes only; we had to implement some minor changes to make the EEGLAB time-frequency function newtimef() compatible with Octave (since the changes were compatible with Matlab, we registered them in the main repository). Other EEGLAB functions (even signal processing functions) also require minor changes to be run under Octave.
% cd xxxxx/eeglab % move to the proper directory/folder % octave --traditional % start Octave addpath('functions/timefreqfunc/') % within Octave, addpath('functions/adminfunc/') addpath('functions/sigprocfunc/') load('sample_data/eeglab_data_epochs_ica.set') [ersp itc imbase time freqs] = newtimef(EEG.data(1,:,:), EEG.pnts, [-1000 2000], EEG.srate, ... [3 0.5], 'plotitc', 'off', 'plotersp', 'off'); figure; imagesc(time, freqs, ersp); set(gca, 'ydir', 'normal'); xlim([time(1) time(end)]); xlabel('Time (ms)'); ylabel('Frequency (hz)'); colorbar;
For comparison, below is the graphic output of newtimef() under Matlab -- the same function used within Octave to create the figure above (note: here with ITC plotting disabled).
Scilab is another alternative to Matlab but it seems less compatible than Octave and does not support all the Matlab commands. It also requires the user to convert all Matlab scripts to the Scilab language and to import all new functions into the Scilab environment.
JMathLib is a Java clone implementation of Matlab. It does seem that Java is going to be the best language to implement a Matlab clone (since Matlab uses java itself for all its graphic output). JMathLib is a nice start but is not actively developed and does not have the same active community involvement as Octave.
Of course, Python (and SAGE, a Math package build on top of Python) would be an interesting alternative. However, this would require converting the 70,000 lines of EEGLAB code to Python. We do not have the resources or willingness to undertake that at this point.
Please enter comments under the discussion tab (above) for this page, or send us email to firstname.lastname@example.org.