Menu

[09bd5b]: / pythonapi / pythonfunctions.i  Maximize  Restore  History

Download this file

36 lines (30 with data), 839 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* put more python functionality here */
%pythoncode
%{
import pylab
import math
def plot_eeg(eeg, plotfilename=None, channels=None, trials=None, format="b-"):
"""
Plotting an EEG struct from pyeegtools.
pylab based.
"""
if type(eeg).__name__!='EEG':
print "This is not an EEG struct";
return
if not channels:
channels = range(0,eeg.nbchan);
d = eeg.get_data();
times = eeg.get_times();
nc = int(math.ceil(math.sqrt( len(channels) )));
idx = 1;
for c in channels:
pylab.subplot(nc,nc,idx);
if times!=None:
pylab.plot(times, d[c,trials], format);
else:
pylab.plot(d[c,trials], format);
pylab.title("Channel %i"%c);
idx = idx+1;
if( plotfilename ):
pylab.savefig( plotfilename );
%}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.