[Pybrainsim-activity] SF.net SVN: pybrainsim:[106] trunk/src/Experiment.py
Status: Planning
Brought to you by:
rgoj
From: <rg...@us...> - 2009-08-15 11:01:24
|
Revision: 106 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=106&view=rev Author: rgoj Date: 2009-08-15 11:01:16 +0000 (Sat, 15 Aug 2009) Log Message: ----------- * Changed plotRecording so that multiple channels can be plotted at the same time. * Used advice from the matplotlib cookbook: http://www.scipy.org/Cookbook/Matplotlib/MultilinePlots * Only the ongoing activity plot is changed, the ERP plots will be reimplemented in the next few commits. Modified Paths: -------------- trunk/src/Experiment.py Modified: trunk/src/Experiment.py =================================================================== --- trunk/src/Experiment.py 2009-08-14 12:56:59 UTC (rev 105) +++ trunk/src/Experiment.py 2009-08-15 11:01:16 UTC (rev 106) @@ -110,17 +110,53 @@ return average def plotRecording(self): - subplot(211) - plot(self.timePoints, self.recording[0], linewidth=1.0) - for i in range(len(self.stimulusTimes[0])): - axvline(self.stimulusTimes[0][i], color='r') - xlabel('Time (s)') - ylabel('Amplitude') - title('Simulated EEG recording') - subplot(212) - plot(self.epochTimePoints, self.getERP(), linewidth=1.0) - axvline( 0.0, color='r' ) - xlabel('Time (s)') - ylabel('Amplitude') - title('Simulated ERP') + # Creating a new matplotlib figure for the plots + fig = figure() + + # Each channel will have a plot of the same width and height + plotWidth = 0.8 + plotHeight = 0.4/len(self.recording) + + # + # Ongoing activity + # + + # Multiple axes will be created, all sharing the same properties + axes = [] + axesProperties = dict([]) + + for channel in range(len(self.recording)): + # Plotting the recording for each channel + axes.append(fig.add_axes([0.1, 0.55 + plotHeight * channel, + plotWidth, plotHeight], + **axesProperties)) + axes[channel].plot(self.timePoints, self.recording[channel]) + axes[channel].set_ylabel("CH " + str(channel+1)) + + # All channels must be zoomed in/out and moved at the same time + if channel == 0: + axesProperties['sharex'] = axes[0] + axesProperties['sharey'] = axes[0] + + # Plotting vertical lines to indicate times of stimuli + for i in range(len(self.stimulusTimes[0])): + axvline(self.stimulusTimes[0][i], color='r') + + # Time values will be printed only for the lowest axis + axes[0].set_xlabel("Time") + for axis in axes[1:]: + setp(axis.get_xticklabels(), visible=False) + + # + # Event-related activity + # + + #subplot(212) + #plot(self.epochTimePoints, self.getERP(), linewidth=1.0) + #axvline( 0.0, color='r' ) + #xlabel('Time (s)') + #ylabel('Amplitude') + #title('Simulated ERP') + + #show() show() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |