[Pybrainsim-activity] SF.net SVN: pybrainsim:[143] trunk/src/PyBrainSim.py
Status: Planning
Brought to you by:
rgoj
From: <rg...@us...> - 2010-06-27 19:43:38
|
Revision: 143 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=143&view=rev Author: rgoj Date: 2010-06-27 19:43:32 +0000 (Sun, 27 Jun 2010) Log Message: ----------- * Preparing for the presentation of dipoles with different rotations in the dipolar model example. Modified Paths: -------------- trunk/src/PyBrainSim.py Modified: trunk/src/PyBrainSim.py =================================================================== --- trunk/src/PyBrainSim.py 2010-06-27 17:14:44 UTC (rev 142) +++ trunk/src/PyBrainSim.py 2010-06-27 19:43:32 UTC (rev 143) @@ -281,33 +281,51 @@ def menuButton9(self, control): # head will hold sources, registrations sites and the head model - head = Head() + head1 = Head() + head2 = Head() + head3 = Head() # headModel will be our single sphere head model - headModel = HeadModelDipoleSphere(head, 10.0) + headModel1 = HeadModelDipoleSphere(head1, 10.0) + headModel2 = HeadModelDipoleSphere(head2, 10.0) + headModel3 = HeadModelDipoleSphere(head3, 10.0) # We need only one data point per simulation - head.setSamplingFrequency(1) + head1.setSamplingFrequency(1) + head2.setSamplingFrequency(1) + head3.setSamplingFrequency(1) # Adding registration sites nElectrodes = 200 angles = [] for i in range(nElectrodes): angles.append(i*numpy.pi/(nElectrodes-1) - numpy.pi/2) - head.addRegistrationSite([angles[-1],numpy.pi/2]) + head1.addRegistrationSite([angles[-1],numpy.pi/2]) + head2.addRegistrationSite([angles[-1],numpy.pi/2]) + head3.addRegistrationSite([angles[-1],numpy.pi/2]) # Adding a generator - orientation = 0; - generator = GeneratorNoisy('Gen', head, position = [ 0.3, 0, orientation, 0, 0], mean=1, stddev=0.1) + orientation1= 0; + orientation2= numpy.pi/2; + orientation3= numpy.pi/4; + generator1 = GeneratorNoisy('Gen', head1, position = [ 0.3, 0, orientation1, 0, 0], mean=1, stddev=0.1) + generator2 = GeneratorNoisy('Gen', head2, position = [ 0.3, 0, orientation2, 0, 0], mean=1, stddev=0.1) + generator3 = GeneratorNoisy('Gen', head3, position = [ 0.3, 0, orientation3, 0, 0], mean=1, stddev=0.1) # Run the simulation just once (or, equivalently for one second with the sampling rate of 1 Hz) - simulatedData = numpy.array(head.runSimulation(1)) + simulatedData1 = numpy.array(head1.runSimulation(1)) + simulatedData2 = numpy.array(head2.runSimulation(1)) + simulatedData3 = numpy.array(head3.runSimulation(1)) - print(simulatedData) - pylab.plot(angles,simulatedData) + pylab.subplot(311) + pylab.plot(angles,simulatedData1) + pylab.title("Potential from superficial dipoles of different orientations") + pylab.subplot(312) + pylab.plot(angles,simulatedData2) + pylab.subplot(313) + pylab.plot(angles,simulatedData3) pylab.xlabel("Location of measurement on scalp [radians]") - pylab.ylabel("Potential on scalp [arbitrary units]") - pylab.title("Potential from superficial dipole of orientation " + str(orientation)) + pylab.ylabel("Scalp potential [relative]") pylab.show() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |