Skip to content

Commit ee6e4b2

Browse files
authored
Update EEGLAB_and_python.md
1 parent dbcb5e1 commit ee6e4b2

File tree

1 file changed

+25
-16
lines changed

1 file changed

+25
-16
lines changed

others/EEGLAB_and_python.md

+25-16
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,25 @@ MATLAB. However, irrespective of what Python enthusiasts might claim,
3737
Python might not be ideal because it remains a programming language
3838
designed for programmers. For example,
3939

40-
- It is hard to understand for novices why an n-size vector should be
41-
indexed, beginning at 0 and ending at n-1 (in MATLAB and R, vectors
42-
begin at position 1 and end at n).
43-
- Code indentation is a nice feature of Python. However, this style
40+
- **Code indentation.** Code indentation is a nice feature of Python. However, this style
4441
does not come naturally to the novice programmer. It also makes
4542
copying and pasting code between file sources and the command line
4643
interface problematic (since a snippet of code will most likely have
4744
unwanted indentation when copied to the Python command line).
48-
- Python is much more object-oriented than MATLAB, sometimes requiring
49-
users to understand object-oriented concepts when calling functions.
50-
- Python usually requires the user to install multiple external
45+
- **Object-oriented notation.** Python is much more object-oriented than MATLAB, sometimes requiring
46+
users to understand object-oriented concepts when calling functions. MNE, for example, do not
47+
let you access EEG data structures. If you want to access some information, such as channel coordinates,
48+
you need to dig through the MNE code in the hope of finding the non-documented method that will return
49+
this information.
50+
- **Where are my libraries?** Python usually requires the user to install multiple external
5151
libraries; this can be tedious and does not come naturally to
5252
novices. Even experienced users sometimes spend hours getting their
5353
library settings right. There are also other technical problems
5454
related to the operating system and library compatibility that can take
5555
hours or days to solve (we speak from experience).
56-
- Matrix manipulation in Python is not as intuitive as MATLAB. For
56+
- **Matrix for dummies!** It is hard to understand for novices why an n-size vector should be
57+
indexed, beginning at 0 and ending at n-1 (in MATLAB and R, vectors
58+
begin at position 1 and end at n). Matrix manipulation in Python is not as intuitive as MATLAB. For
5759
example, the already non-intuitive Python code to concatenate arrays
5860
<i>np.concatenate((np.array(\[\[/1,_2\],_\[5,_6\|1, 2\], \[5,
5961
6\]\]), np.array(\[1, 2\])))</i> will fail because, unlike MATLAB,
@@ -62,29 +64,36 @@ designed for programmers. For example,
6264
\[1 2; 5 6\]; \[1 2\] \]</i> or <i>\[ \[1 2; 5 6\] \[1 2\]' \]</i>
6365
depending on the dimension to concatenate. The MATLAB code is
6466
readable for someone with math training.
65-
- And of course, version problems: Python versions 2 and 3 are not
67+
- **Which version am I running?** Python versions 2 and 3 are not
6668
fully compatible -- and Python 2.7, although no longer supported
6769
since January 1, 2020, is still widely used because a large number
6870
of Python libraries are not available in Python 3 -- leading to all
6971
kinds of unexpected problems that can slow down a novice
70-
programmer.
71-
- Python is free. Why should I have to pay for MATLAB? Good conduct in
72+
programmer. Python version libraries stability across platforms
73+
can also be a headache.
74+
- **But Python is free.** Why should I have to pay for MATLAB? Good conduct in
7275
(open) science should transcend discussions on finances. We pay for
7376
Microsoft or Adobe licenses because the free alternative, even
7477
if it exists, does not fulfill our needs. The compiled version of
7578
EEGLAB does not require users to purchase MATLAB, and EEGLAB code
7679
also runs on Octave.
77-
- MEEG software packages on MATLAB are mainly EEGLAB, Fieldtrip, and
78-
Brainstorm. MEEG software on Python is MNE which is more tailored to MEG users than EEG users.
79-
The MATLAB suite of available software is currently more mature than
80-
the Python one, which is a good reason to stick to MATLAB.
81-
- The closest alternative to the Matlab interactive interface is the
80+
- **Jupyter notebooks.** The closest alternative to the Matlab interactive interface is the
8281
Jupyter notebook environment that runs in your browser. However, the
8382
graphical capabilities of Jupyter notebooks remain limited (it is
8483
sometimes hard to manipulate figures, impossible to zoom, etc...).
8584
Most people who are used to Matlab and tried
8685
Jupyter notebooks dislike Jupyter notebooks - then learn to live with the
8786
limitations if they need it for their work. By contrast, the less popular [Spyder IDE](https://www.spyder-ide.org/) is a decent equivalent of the MATLAB graphical interface and should feel more familiar.
87+
- **Lack of features.** MEEG software packages on MATLAB are mainly EEGLAB, Fieldtrip, and
88+
Brainstorm. MEEG software on Python is MNE which is more tailored to MEG users than EEG users.
89+
The MATLAB suite of available software is currently more mature than
90+
the Python one, which is a good reason to stick to MATLAB. EEGLAB has 32 plugins for automated artifact rejections. MNE has one (autoreject).
91+
- **Show some respect!** Python numpy has been partially mapped onto MATLAB. In numpy, you can
92+
map the names of some of the functions to their MATLAB counterparts (reshape, squeeze, meshgrid, griddata,
93+
transpose, dot, linspace, logspace, sum, mean, std, min, max, prod,
94+
diff, cumsum, cumprod, zeros, ones, eye, etc...).
95+
There is no doubt that Python is great, especially for developers, but please
96+
show some respect to your elders :-).
8897

8998
How to call EEGLAB functions from Python
9099
----------------------------------------

0 commit comments

Comments
 (0)