pybrainsim-activity Mailing List for PyBrainSim - The Brain Phantom Project (Page 7)
Status: Planning
Brought to you by:
rgoj
You can subscribe to this list here.
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(123) |
Aug
(114) |
Sep
(44) |
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(9) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <rg...@us...> - 2009-08-03 10:20:47
|
Revision: 48 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=48&view=rev Author: rgoj Date: 2009-08-03 10:20:38 +0000 (Mon, 03 Aug 2009) Log Message: ----------- * Correcting column width. Modified Paths: -------------- trunk/src/Experiment.py Modified: trunk/src/Experiment.py =================================================================== --- trunk/src/Experiment.py 2009-08-03 10:19:43 UTC (rev 47) +++ trunk/src/Experiment.py 2009-08-03 10:20:38 UTC (rev 48) @@ -3,23 +3,25 @@ # # This file is part of PyBrainSim. # -# PyBrainSim is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# PyBrainSim is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation, either version 3 of the License, or (at your option) any later +# version. # -# PyBrainSim is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# PyBrainSim is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with PyBrainSim. If not, see <http://www.gnu.org/licenses/>. +# You should have received a copy of the GNU General Public License along with +# PyBrainSim. If not, see <http://www.gnu.org/licenses/>. __metaclass__ = type # New style classes. Is this necessary? """ -The Experiment class holds information about stimuli, the recorded data and the even-related potential. It could be used to perform the basic operations on EEG data, such as baseline correction, averaging, etc. It should also serve as an interface to Neuroscan, e.g. by providing an export to .cnt files feature. +The Experiment class holds information about stimuli, the recorded data and the +even-related potential. It could be used to perform the basic operations on EEG +data, such as baseline correction, averaging, etc. It should also serve as an +interface to Neuroscan, e.g. by providing an export to .cnt files feature. """ class Experiment: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-08-03 10:19:52
|
Revision: 47 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=47&view=rev Author: rgoj Date: 2009-08-03 10:19:43 +0000 (Mon, 03 Aug 2009) Log Message: ----------- * Correcting a comment. Modified Paths: -------------- trunk/src/Head.py Modified: trunk/src/Head.py =================================================================== --- trunk/src/Head.py 2009-08-03 10:13:56 UTC (rev 46) +++ trunk/src/Head.py 2009-08-03 10:19:43 UTC (rev 47) @@ -36,8 +36,8 @@ self.samplingFrequency = samplingFrequency def addGenerator(self, generator): - # TODO: We must check for equal generator names - this can't currently - # be allowed to happen! + # TODO: We must check for equal generator names - two identical names + # can't currently be allowed to happen! self.generatorList.append(generator) self.generatorSiteList.append([0, 0, 0]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-08-03 10:14:06
|
Revision: 46 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=46&view=rev Author: rgoj Date: 2009-08-03 10:13:56 +0000 (Mon, 03 Aug 2009) Log Message: ----------- * Removing an outdated comment. Modified Paths: -------------- trunk/src/Head.py Modified: trunk/src/Head.py =================================================================== --- trunk/src/Head.py 2009-08-03 09:08:11 UTC (rev 45) +++ trunk/src/Head.py 2009-08-03 10:13:56 UTC (rev 46) @@ -21,11 +21,7 @@ The Head class is the main class in PyBrainSim. It holds a list of generators and connections between these generators, as well as a head model that governs the propagation of the activity of the generation throughout the modeled head, -to the specified registration sites. - -This class is only the simplest implementation of these ideas, intended to -serve as an example and a starting point for creating complex derived classes, -ready for real simulation tasks. +to the specified registration sites. """ class Head: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-08-03 09:08:24
|
Revision: 45 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=45&view=rev Author: rgoj Date: 2009-08-03 09:08:11 +0000 (Mon, 03 Aug 2009) Log Message: ----------- * Adding a new method of pairing connections with their source generators. But leaving the implementation for further testing to decide later which method is nicer. Modified Paths: -------------- trunk/src/Head.py Modified: trunk/src/Head.py =================================================================== --- trunk/src/Head.py 2009-08-02 18:57:23 UTC (rev 44) +++ trunk/src/Head.py 2009-08-03 09:08:11 UTC (rev 45) @@ -100,6 +100,14 @@ for j in range(len(self.generatorList)): if self.connectionList[i].getSourceName() == self.generatorList[j].getName(): sourceGeneratorIndex = j + + # Perhaps this is a nicer method of doing the same thing as + # above... but leaving this here for further testing. Besides + # it breaks the encapsulation of the connection class - + # directly communicating with one of it's members... + sourceGeneratorIndex2 = self.generatorList.index(self.connectionList[i].sourceGenerator) + print("Established method: " + str(sourceGeneratorIndex) + ", new method: " + str(sourceGeneratorIndex2)) + self.connectionList[i].runConnection(generatorOutput[sourceGeneratorIndex]) # Passing the output of the generators through to the head model to This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-08-02 18:57:30
|
Revision: 44 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=44&view=rev Author: rgoj Date: 2009-08-02 18:57:23 +0000 (Sun, 02 Aug 2009) Log Message: ----------- * Added another comment - TODO - checking generator names Modified Paths: -------------- trunk/src/Head.py Modified: trunk/src/Head.py =================================================================== --- trunk/src/Head.py 2009-08-02 18:50:08 UTC (rev 43) +++ trunk/src/Head.py 2009-08-02 18:57:23 UTC (rev 44) @@ -40,6 +40,8 @@ self.samplingFrequency = samplingFrequency def addGenerator(self, generator): + # TODO: We must check for equal generator names - this can't currently + # be allowed to happen! self.generatorList.append(generator) self.generatorSiteList.append([0, 0, 0]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-08-02 18:50:18
|
Revision: 43 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=43&view=rev Author: rgoj Date: 2009-08-02 18:50:08 +0000 (Sun, 02 Aug 2009) Log Message: ----------- * Added another explanatory comment about the way connections are handled in the Head.runSimulation() method. Modified Paths: -------------- trunk/src/Head.py Modified: trunk/src/Head.py =================================================================== --- trunk/src/Head.py 2009-08-02 18:47:20 UTC (rev 42) +++ trunk/src/Head.py 2009-08-02 18:50:08 UTC (rev 43) @@ -90,6 +90,10 @@ # Sending the output of generators through connections for i in range(len(self.connectionList)): + # All the generator names are checked against names of the + # source generators of all the connections, to find which + # generator's output should be passed on to the connection. + # There must be a better way to do this... sourceGeneratorIndex = 0 for j in range(len(self.generatorList)): if self.connectionList[i].getSourceName() == self.generatorList[j].getName(): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-08-02 18:47:28
|
Revision: 42 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=42&view=rev Author: rgoj Date: 2009-08-02 18:47:20 +0000 (Sun, 02 Aug 2009) Log Message: ----------- * Additional comments to make things more clear Modified Paths: -------------- trunk/src/Head.py Modified: trunk/src/Head.py =================================================================== --- trunk/src/Head.py 2009-08-02 18:40:00 UTC (rev 41) +++ trunk/src/Head.py 2009-08-02 18:47:20 UTC (rev 42) @@ -73,16 +73,22 @@ for i in range(len(self.registrationSiteList)): recording.append([]) - # Preparing a variable where the output of each of the generators will be stored - generatorOutput = [] + # Preparing a variable where the output of each of the generators will + # be stored + generatorOutput = [] for generator in self.generatorList: generatorOutput.append(0) - # Querying all generators and sending generator output through connections + # Querying all generators and sending generator output through + # connections for timePoint in range(duration * self.samplingFrequency): print("HEAD, time: " + str(timePoint/self.samplingFrequency)) + + # Recording the output of each generator for i in range(len(self.generatorList)): generatorOutput[i] = (self.generatorList[i]).runGenerator(timePoint/self.samplingFrequency) + + # Sending the output of generators through connections for i in range(len(self.connectionList)): sourceGeneratorIndex = 0 for j in range(len(self.generatorList)): @@ -90,6 +96,8 @@ sourceGeneratorIndex = j self.connectionList[i].runConnection(generatorOutput[sourceGeneratorIndex]) + # Passing the output of the generators through to the head model to + # get the recording recording = self.runHeadModel(generatorOutput, recording) return recording This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: PyBrainSim - T. i. <no...@so...> - 2009-08-02 18:41:25
|
#37: Redesign communication between generators to make it instantaneous --------------------+------------------------------------------------------- Reporter: rgoj | Owner: rgoj Type: task | Status: closed Priority: major | Milestone: Modelling phase resetting Component: Design | Resolution: fixed Keywords: | --------------------+------------------------------------------------------- Changes (by rgoj): * status: new => closed * resolution: => fixed -- Ticket URL: <http://sourceforge.net/apps/trac/pybrainsim/ticket/37#comment:2> PyBrainSim <http://sourceforge.net/projects/pybrainsim/> An interactive tool for the simulation and visualization of the electromagnetic activity of the brain. |
From: <rg...@us...> - 2009-08-02 18:40:07
|
Revision: 41 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=41&view=rev Author: rgoj Date: 2009-08-02 18:40:00 +0000 (Sun, 02 Aug 2009) Log Message: ----------- * Changed the way connections are run from Head, so that the generators do not generate their output more than once, possibly leading to unexpected results. * During simulation the current time is printed to standard output... at least for now. Modified Paths: -------------- trunk/src/Head.py Modified: trunk/src/Head.py =================================================================== --- trunk/src/Head.py 2009-08-02 18:36:19 UTC (rev 40) +++ trunk/src/Head.py 2009-08-02 18:40:00 UTC (rev 41) @@ -78,12 +78,17 @@ for generator in self.generatorList: generatorOutput.append(0) - # Querying all generators and connections + # Querying all generators and sending generator output through connections for timePoint in range(duration * self.samplingFrequency): + print("HEAD, time: " + str(timePoint/self.samplingFrequency)) for i in range(len(self.generatorList)): generatorOutput[i] = (self.generatorList[i]).runGenerator(timePoint/self.samplingFrequency) for i in range(len(self.connectionList)): - self.connectionList[i].runConnection() + sourceGeneratorIndex = 0 + for j in range(len(self.generatorList)): + if self.connectionList[i].getSourceName() == self.generatorList[j].getName(): + sourceGeneratorIndex = j + self.connectionList[i].runConnection(generatorOutput[sourceGeneratorIndex]) recording = self.runHeadModel(generatorOutput, recording) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-08-02 18:36:32
|
Revision: 40 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=40&view=rev Author: rgoj Date: 2009-08-02 18:36:19 +0000 (Sun, 02 Aug 2009) Log Message: ----------- * Displaying a comment at the end of the simulations, that the recording will be displayed Modified Paths: -------------- trunk/src/PyBrainSim.py Modified: trunk/src/PyBrainSim.py =================================================================== --- trunk/src/PyBrainSim.py 2009-08-02 18:35:18 UTC (rev 39) +++ trunk/src/PyBrainSim.py 2009-08-02 18:36:19 UTC (rev 40) @@ -61,7 +61,8 @@ exampleHead.addConnection(exampleConnection) exampleExperiment = Experiment(exampleHead.runSimulation( 1 )) - print exampleExperiment.getRecording() + print("\nSimulations resulted in the following recording:") + print(exampleExperiment.getRecording()) #elif userChoice == 2: # exampleHead = Head() # exampleHead.setSamplingFrequency(32) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-08-02 18:35:29
|
Revision: 39 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=39&view=rev Author: rgoj Date: 2009-08-02 18:35:18 +0000 (Sun, 02 Aug 2009) Log Message: ----------- * Correcting runConnection in ConnectionDummy, so that it also takes an argument, allowing it to be called from Head in the same way as other Connection class objects. Modified Paths: -------------- trunk/src/ConnectionDummy.py Modified: trunk/src/ConnectionDummy.py =================================================================== --- trunk/src/ConnectionDummy.py 2009-08-02 16:29:37 UTC (rev 38) +++ trunk/src/ConnectionDummy.py 2009-08-02 18:35:18 UTC (rev 39) @@ -27,6 +27,6 @@ def printInfo(self): print(self.name + ": A ConnectionDummy object") - def runConnection(self): - Connection.runConnection(self, 0) + def runConnection(self, sourceGeneratorOutput = 0): print("[runConnection] " + self.name + ": Sending output from source to target generator") + Connection.runConnection(self, sourceGeneratorOutput) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-08-02 16:29:45
|
Revision: 38 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=38&view=rev Author: rgoj Date: 2009-08-02 16:29:37 +0000 (Sun, 02 Aug 2009) Log Message: ----------- * Cosmetic changes ** Column width of documentation shortened ** Deleting outputing the value of time to the standard output Modified Paths: -------------- trunk/src/Head.py Modified: trunk/src/Head.py =================================================================== --- trunk/src/Head.py 2009-08-02 16:26:39 UTC (rev 37) +++ trunk/src/Head.py 2009-08-02 16:29:37 UTC (rev 38) @@ -47,9 +47,12 @@ self.connectionList.append(connection) def addRegistrationSite(self, position): - # We should be checking whether the position is within the boundaries of the brain, which need to be defined somewhere somehow. - # The class must somehow provide a means to accessing the size of the brain, the available positions, etc. - # One interesting thing to do would be to implement a method returning a position for a name of a given brain/scalp region... + # We should be checking whether the position is within the boundaries + # of the brain, which need to be defined somewhere somehow. The class + # must somehow provide a means to accessing the size of the brain, the + # available positions, etc. One interesting thing to do would be to + # implement a method returning a position for a name of a given + # brain/scalp region... self.registrationSiteList.append(position) def runHeadModel(self, generatorOutput, recording): @@ -61,12 +64,12 @@ return recording - def runSimulation(self, duration=1): - """Queries all generators and connections, sends the generators' output to the head model and then to the specified registration sites""" + """Queries all generators, sends the generators' output to connections, + to the head model and then to the specified registration sites""" # Preparing a variable to hold the recording for all registration sites - recording = [] + recording = [] for i in range(len(self.registrationSiteList)): recording.append([]) @@ -79,7 +82,6 @@ for timePoint in range(duration * self.samplingFrequency): for i in range(len(self.generatorList)): generatorOutput[i] = (self.generatorList[i]).runGenerator(timePoint/self.samplingFrequency) - print("Time: " + str(timePoint/self.samplingFrequency) + ", Generator: " + str(i) + ", Generator Output: " + str(generatorOutput[i])) for i in range(len(self.connectionList)): self.connectionList[i].runConnection() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-08-02 16:26:46
|
Revision: 37 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=37&view=rev Author: rgoj Date: 2009-08-02 16:26:39 +0000 (Sun, 02 Aug 2009) Log Message: ----------- * Adding the Generator class, which will be the new class that all generator classes should inherit from Added Paths: ----------- trunk/src/Generator.py Added: trunk/src/Generator.py =================================================================== --- trunk/src/Generator.py (rev 0) +++ trunk/src/Generator.py 2009-08-02 16:26:39 UTC (rev 37) @@ -0,0 +1,40 @@ +# PyBrainSim Copyright 2009 Roman Goj +# +# This file is part of PyBrainSim. +# +# PyBrainSim is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation, either version 3 of the License, or (at your option) any later +# version. +# +# PyBrainSim is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# PyBrainSim. If not, see <http://www.gnu.org/licenses/>. + +__metaclass__ = type # New style classes. Is this necessary? + +""" +The Generator class serves as a starting point for creating complex classes +simulating populations of neurons. +""" + +class Generator: + def __init__(self, name): + self.name = name + self.activation = 0 + + def printInfo(self): + print(self.name + ": A Generator object") + + def getName(self): + return self.name + + def receiveInput(self, input): + self.activation += input + + def runGenerator(self, time): + return self.activation + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-08-02 16:26:05
|
Revision: 36 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=36&view=rev Author: rgoj Date: 2009-08-02 16:25:57 +0000 (Sun, 02 Aug 2009) Log Message: ----------- * GeneratorDummy prints out messages to standard output when interesting methods are run Added Paths: ----------- trunk/src/GeneratorDummy.py Added: trunk/src/GeneratorDummy.py =================================================================== --- trunk/src/GeneratorDummy.py (rev 0) +++ trunk/src/GeneratorDummy.py 2009-08-02 16:25:57 UTC (rev 36) @@ -0,0 +1,36 @@ +# PyBrainSim Copyright 2009 Roman Goj +# +# This file is part of PyBrainSim. +# +# PyBrainSim is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation, either version 3 of the License, or (at your option) any later +# version. +# +# PyBrainSim is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# PyBrainSim. If not, see <http://www.gnu.org/licenses/>. + +__metaclass__ = type # New style classes. Is this necessary? + +""" +The GeneratorDummy class is a reimplementation of the parent class +GeneratorDummy, printing out a message whenever any interesting methods are +invoked. +""" + +from Generator import Generator + +class GeneratorDummy(Generator): + def printInfo(self): + print(self.name + ": A GeneratorDummy object") + + def receiveInput(self, input): + print("[receiveInput] " + self.name + ": Received input from connection") + + def runGenerator(self, time): + print("[runGenerator] " + self.name + ": Calculating activation") + return 0 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-08-02 16:25:34
|
Revision: 35 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=35&view=rev Author: rgoj Date: 2009-08-02 16:25:25 +0000 (Sun, 02 Aug 2009) Log Message: ----------- * ConnectionDummy prints out messages to standard output when interesting methods are run Added Paths: ----------- trunk/src/ConnectionDummy.py Added: trunk/src/ConnectionDummy.py =================================================================== --- trunk/src/ConnectionDummy.py (rev 0) +++ trunk/src/ConnectionDummy.py 2009-08-02 16:25:25 UTC (rev 35) @@ -0,0 +1,32 @@ +# PyBrainSim Copyright 2009 Roman Goj +# +# This file is part of PyBrainSim. +# +# PyBrainSim is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation, either version 3 of the License, or (at your option) any later +# version. +# +# PyBrainSim is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# PyBrainSim. If not, see <http://www.gnu.org/licenses/>. + +__metaclass__ = type # New style classes. Is this necessary? + +""" +The ConnectionDummy class is a reimplementation of the parent class Connection, +printing out a message whenever the runConnection method is invoked. +""" + +from Connection import Connection + +class ConnectionDummy(Connection): + def printInfo(self): + print(self.name + ": A ConnectionDummy object") + + def runConnection(self): + Connection.runConnection(self, 0) + print("[runConnection] " + self.name + ": Sending output from source to target generator") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-08-02 16:24:54
|
Revision: 34 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=34&view=rev Author: rgoj Date: 2009-08-02 16:24:44 +0000 (Sun, 02 Aug 2009) Log Message: ----------- * Connection class will be the new method to use when implementing new connections, instead of ConnectionDummy or ConnectionSimple... Added Paths: ----------- trunk/src/Connection.py Added: trunk/src/Connection.py =================================================================== --- trunk/src/Connection.py (rev 0) +++ trunk/src/Connection.py 2009-08-02 16:24:44 UTC (rev 34) @@ -0,0 +1,48 @@ +# PyBrainSim Copyright 2009 Roman Goj +# +# This file is part of PyBrainSim. +# +# PyBrainSim is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation, either version 3 of the License, or (at your option) any later +# version. +# +# PyBrainSim is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# PyBrainSim. If not, see <http://www.gnu.org/licenses/>. + +__metaclass__ = type # New style classes. Is this necessary? + +""" +The Connection class is used for describing communication between two +generators - i.e. inhibitory or excitatory connections between simulated neural +populations. + +This class is only the simplest implementation of these ideas, intended to +serve as an example and a starting point for creating complex derived classes, +ready for real simulation tasks. +""" + +class Connection: + def __init__(self, name, sourceGenerator, targetGenerator): + self.name = name + self.sourceGenerator = sourceGenerator + self.targetGenerator = targetGenerator + + def printInfo(self): + print(self.name + " A Connection object") + + def getName(self): + return self.name + + def getSourceName(self): + return self.sourceGenerator.getName() + + def getTargetName(self): + return self.targetGenerator.getName() + + def runConnection(self, sourceGeneratorOutput): + self.targetGenerator.receiveInput(sourceGeneratorOutput) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-08-02 16:23:25
|
Revision: 33 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=33&view=rev Author: rgoj Date: 2009-08-02 16:23:15 +0000 (Sun, 02 Aug 2009) Log Message: ----------- * Adding an example dummy simulation to the PyBrainSim.py script ** Using GeneratorDummy and ConnectionDummy we print out to standard output information about the currently running method * The other two previous simulations in PyBrainSim are commented out for refactoring of used methods Modified Paths: -------------- trunk/src/PyBrainSim.py Modified: trunk/src/PyBrainSim.py =================================================================== --- trunk/src/PyBrainSim.py 2009-08-02 15:31:17 UTC (rev 32) +++ trunk/src/PyBrainSim.py 2009-08-02 16:23:15 UTC (rev 33) @@ -28,17 +28,20 @@ from Head import Head from Experiment import Experiment + from GeneratorDummy import GeneratorDummy +from ConnectionDummy import ConnectionDummy + from GeneratorSine import GeneratorSine -from ConnectionSimple import ConnectionSimple from GeneratorStimulusActivationZeroing import GeneratorStimulusActivationZeroing from GeneratorStimulusPhaseReset import GeneratorStimulusPhaseReset welcomeMessage = "\n\ Welcome to this early version of PyBrainSim\n\n\ Choose the type of simulation you would like to perform:\n\ - 1. Adding numbers\n\ - 2. Sinusoidal generator\n" + 1. Example dummy simulation\n\ + 2. Adding numbers\n\ + 3. Sinusoidal generator\n" print(welcomeMessage) userChoice = input("Your choice: ") @@ -46,49 +49,64 @@ if userChoice == 1: exampleHead = Head() - exampleHead.setSamplingFrequency(32) + exampleHead.setSamplingFrequency(10) exampleHead.addRegistrationSite([0, 0, 0]) - exampleHead.addRegistrationSite([0, 0, 0]) - exampleGenerator1 = GeneratorDummy() - exampleGenerator2 = GeneratorDummy() + exampleGenerator1 = GeneratorDummy('Gen1') + exampleGenerator2 = GeneratorDummy('Gen2') exampleHead.addGenerator(exampleGenerator1) exampleHead.addGenerator(exampleGenerator2) - exampleConnection = ConnectionSimple(exampleGenerator1, exampleGenerator2) + exampleConnection = ConnectionDummy('Con', exampleGenerator1, exampleGenerator2) exampleHead.addConnection(exampleConnection) - - exampleStimulus = GeneratorStimulusActivationZeroing() - exampleHead.addGenerator(exampleStimulus) - - exampleStimulusToGeneratorConnection = ConnectionSimple(exampleStimulus, exampleGenerator1) - exampleGeneratorToStimulusConnection = ConnectionSimple(exampleGenerator1, exampleStimulus) - exampleHead.addConnection(exampleStimulusToGeneratorConnection) - exampleHead.addConnection(exampleGeneratorToStimulusConnection) - + exampleExperiment = Experiment(exampleHead.runSimulation( 1 )) print exampleExperiment.getRecording() -elif userChoice == 2: - exampleExperiment = Experiment() - exampleExperiment.addStimulusTime( 0.2341 ) - - exampleHead = Head() - exampleHead.setSamplingFrequency( 10 ) - exampleHead.addRegistrationSite([0, 0, 0]) - - exampleGenerator1 = GeneratorSine() - exampleHead.addGenerator(exampleGenerator1) - - exampleStimulus = GeneratorStimulusPhaseReset() - exampleStimulus.setStimulusTimes(exampleExperiment.getStimulusTimes()) - exampleHead.addGenerator(exampleStimulus) - - exampleStimulusToGeneratorConnection = ConnectionSimple(exampleStimulus, exampleGenerator1) - exampleGeneratorToStimulusConnection = ConnectionSimple(exampleGenerator1, exampleStimulus) - exampleHead.addConnection(exampleGeneratorToStimulusConnection) - exampleHead.addConnection(exampleStimulusToGeneratorConnection) - - exampleExperiment.setRecording(exampleHead.runSimulation( 1.1 )) - print exampleExperiment.getRecording() +#elif userChoice == 2: +# exampleHead = Head() +# exampleHead.setSamplingFrequency(32) +# exampleHead.addRegistrationSite([0, 0, 0]) +# exampleHead.addRegistrationSite([0, 0, 0]) +# +# exampleGenerator1 = GeneratorDummy() +# exampleGenerator2 = GeneratorDummy() +# exampleHead.addGenerator(exampleGenerator1) +# exampleHead.addGenerator(exampleGenerator2) +# +# exampleConnection = ConnectionSimple(exampleGenerator1, exampleGenerator2) +# exampleHead.addConnection(exampleConnection) +# +# exampleStimulus = GeneratorStimulusActivationZeroing() +# exampleHead.addGenerator(exampleStimulus) +# +# exampleStimulusToGeneratorConnection = ConnectionSimple(exampleStimulus, exampleGenerator1) +# exampleGeneratorToStimulusConnection = ConnectionSimple(exampleGenerator1, exampleStimulus) +# exampleHead.addConnection(exampleStimulusToGeneratorConnection) +# exampleHead.addConnection(exampleGeneratorToStimulusConnection) +# +# exampleExperiment = Experiment(exampleHead.runSimulation( 1 )) +# print exampleExperiment.getRecording() +#elif userChoice == 2: +# exampleExperiment = Experiment() +# exampleExperiment.addStimulusTime( 0.2341 ) +# +# exampleHead = Head() +# exampleHead.setSamplingFrequency( 10 ) +# exampleHead.addRegistrationSite([0, 0, 0]) +# +# exampleGenerator1 = GeneratorSine() +# exampleHead.addGenerator(exampleGenerator1) +# +# exampleStimulus = GeneratorStimulusPhaseReset() +# exampleStimulus.setStimulusTimes(exampleExperiment.getStimulusTimes()) +# exampleHead.addGenerator(exampleStimulus) +# +# exampleStimulusToGeneratorConnection = ConnectionSimple(exampleStimulus, exampleGenerator1) +# exampleGeneratorToStimulusConnection = ConnectionSimple(exampleGenerator1, exampleStimulus) +# exampleHead.addConnection(exampleGeneratorToStimulusConnection) +# exampleHead.addConnection(exampleStimulusToGeneratorConnection) +# +# exampleExperiment.setRecording(exampleHead.runSimulation( 1.1 )) +# print exampleExperiment.getRecording() else: print("No such option unfortunately...") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-08-02 15:31:26
|
Revision: 32 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=32&view=rev Author: rgoj Date: 2009-08-02 15:31:17 +0000 (Sun, 02 Aug 2009) Log Message: ----------- * Removing ConnectionSimple as first step of larger refactoring Removed Paths: ------------- trunk/src/ConnectionSimple.py Deleted: trunk/src/ConnectionSimple.py =================================================================== --- trunk/src/ConnectionSimple.py 2009-07-31 09:17:10 UTC (rev 31) +++ trunk/src/ConnectionSimple.py 2009-08-02 15:31:17 UTC (rev 32) @@ -1,36 +0,0 @@ -# PyBrainSim -# Copyright 2009 Roman Goj -# -# This file is part of PyBrainSim. -# -# PyBrainSim is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# PyBrainSim is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with PyBrainSim. If not, see <http://www.gnu.org/licenses/>. - -__metaclass__ = type # New style classes. Is this necessary? - -""" -The ConnectionSimple class is used for describing communication between two generators - i.e. inhibitory or excitatory connections between simulated neural populations. - -This class is only the simplest implementation of these ideas, intended to serve as an example and a starting point for creating complex derived classes, ready for real simulation tasks. -""" - -class ConnectionSimple: - def __init__(self, sourceGenerator, targetGenerator): - self.sourceGenerator = sourceGenerator - self.targetGenerator = targetGenerator - - def runConnection(self): - """Sends the output of the source generator to the target generator, without any changes.""" - - print("Running connection...") - self.targetGenerator.receiveInput(self.sourceGenerator.sendOutput()) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-07-31 09:17:25
|
Revision: 31 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=31&view=rev Author: rgoj Date: 2009-07-31 09:17:10 +0000 (Fri, 31 Jul 2009) Log Message: ----------- * Reformat file so that it has correct column width for documentation Modified Paths: -------------- trunk/src/Head.py Modified: trunk/src/Head.py =================================================================== --- trunk/src/Head.py 2009-07-31 09:16:05 UTC (rev 30) +++ trunk/src/Head.py 2009-07-31 09:17:10 UTC (rev 31) @@ -1,28 +1,31 @@ -# PyBrainSim -# Copyright 2009 Roman Goj +# PyBrainSim Copyright 2009 Roman Goj # # This file is part of PyBrainSim. # -# PyBrainSim is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# PyBrainSim is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation, either version 3 of the License, or (at your option) any later +# version. # -# PyBrainSim is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# PyBrainSim is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with PyBrainSim. If not, see <http://www.gnu.org/licenses/>. +# You should have received a copy of the GNU General Public License along with +# PyBrainSim. If not, see <http://www.gnu.org/licenses/>. from __future__ import division __metaclass__ = type # New style classes. Is this necessary? """ -The Head class is the main class in PyBrainSim. It holds a list of generators and connections between these generators, as well as a head model that governs the propagation of the activity of the generation throughout the modeled head, to the specified registration sites. +The Head class is the main class in PyBrainSim. It holds a list of generators +and connections between these generators, as well as a head model that governs +the propagation of the activity of the generation throughout the modeled head, +to the specified registration sites. -This class is only the simplest implementation of these ideas, intended to serve as an example and a starting point for creating complex derived classes, ready for real simulation tasks. +This class is only the simplest implementation of these ideas, intended to +serve as an example and a starting point for creating complex derived classes, +ready for real simulation tasks. """ class Head: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-07-31 09:16:21
|
Revision: 30 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=30&view=rev Author: rgoj Date: 2009-07-31 09:16:05 +0000 (Fri, 31 Jul 2009) Log Message: ----------- * Reformat file so that it has correct column width for documentation Modified Paths: -------------- trunk/src/PyBrainSim.py Modified: trunk/src/PyBrainSim.py =================================================================== --- trunk/src/PyBrainSim.py 2009-07-29 15:11:03 UTC (rev 29) +++ trunk/src/PyBrainSim.py 2009-07-31 09:16:05 UTC (rev 30) @@ -3,23 +3,25 @@ # # This file is part of PyBrainSim. # -# PyBrainSim is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# PyBrainSim is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation, either version 3 of the License, or (at your option) any later +# version. # -# PyBrainSim is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# PyBrainSim is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with PyBrainSim. If not, see <http://www.gnu.org/licenses/>. +# You should have received a copy of the GNU General Public License along with +# PyBrainSim. If not, see <http://www.gnu.org/licenses/>. """ -PyBrainSim is an interactive tool for the simulation and visualization of the electromagnetic activity of the brain, currently under development. +PyBrainSim is an interactive tool for the simulation and visualization of the +electromagnetic activity of the brain, currently under development. -This script can be executed to run an example simulation, using the Head and GeneratorDummy classes. Currently it only generates a list of integer numbers... but work is under way to make it simulate the brain... Have fun! +This script can be executed to run an example simulation, using the Head and +GeneratorDummy classes. Currently it only generates a list of integer +numbers... but work is under way to make it simulate the brain... Have fun! pybrainsim.sourceforge.net """ @@ -29,7 +31,7 @@ from GeneratorDummy import GeneratorDummy from GeneratorSine import GeneratorSine from ConnectionSimple import ConnectionSimple -from GeneratorStimulusActivationZeroing import GeneratorStimulusActivationZeroing +from GeneratorStimulusActivationZeroing import GeneratorStimulusActivationZeroing from GeneratorStimulusPhaseReset import GeneratorStimulusPhaseReset welcomeMessage = "\n\ @@ -47,46 +49,46 @@ exampleHead.setSamplingFrequency(32) exampleHead.addRegistrationSite([0, 0, 0]) exampleHead.addRegistrationSite([0, 0, 0]) - + exampleGenerator1 = GeneratorDummy() exampleGenerator2 = GeneratorDummy() exampleHead.addGenerator(exampleGenerator1) exampleHead.addGenerator(exampleGenerator2) - + exampleConnection = ConnectionSimple(exampleGenerator1, exampleGenerator2) exampleHead.addConnection(exampleConnection) - + exampleStimulus = GeneratorStimulusActivationZeroing() exampleHead.addGenerator(exampleStimulus) - + exampleStimulusToGeneratorConnection = ConnectionSimple(exampleStimulus, exampleGenerator1) exampleGeneratorToStimulusConnection = ConnectionSimple(exampleGenerator1, exampleStimulus) exampleHead.addConnection(exampleStimulusToGeneratorConnection) exampleHead.addConnection(exampleGeneratorToStimulusConnection) - - exampleExperiment = Experiment(exampleHead.runSimulation(1)) + + exampleExperiment = Experiment(exampleHead.runSimulation( 1 )) print exampleExperiment.getRecording() elif userChoice == 2: exampleExperiment = Experiment() - exampleExperiment.addStimulusTime(0.2341) - + exampleExperiment.addStimulusTime( 0.2341 ) + exampleHead = Head() - exampleHead.setSamplingFrequency(10) + exampleHead.setSamplingFrequency( 10 ) exampleHead.addRegistrationSite([0, 0, 0]) - + exampleGenerator1 = GeneratorSine() exampleHead.addGenerator(exampleGenerator1) - + exampleStimulus = GeneratorStimulusPhaseReset() exampleStimulus.setStimulusTimes(exampleExperiment.getStimulusTimes()) exampleHead.addGenerator(exampleStimulus) - + exampleStimulusToGeneratorConnection = ConnectionSimple(exampleStimulus, exampleGenerator1) exampleGeneratorToStimulusConnection = ConnectionSimple(exampleGenerator1, exampleStimulus) exampleHead.addConnection(exampleGeneratorToStimulusConnection) exampleHead.addConnection(exampleStimulusToGeneratorConnection) - - exampleExperiment.setRecording(exampleHead.runSimulation(1.1)) + + exampleExperiment.setRecording(exampleHead.runSimulation( 1.1 )) print exampleExperiment.getRecording() else: print("No such option unfortunately...") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-07-29 15:11:12
|
Revision: 29 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=29&view=rev Author: rgoj Date: 2009-07-29 15:11:03 +0000 (Wed, 29 Jul 2009) Log Message: ----------- * Changing names of classes within files that use them Modified Paths: -------------- trunk/src/ConnectionSimple.py trunk/src/GeneratorNumberIncrementing.py trunk/src/GeneratorSine.py trunk/src/GeneratorStimulusActivationZeroing.py trunk/src/GeneratorStimulusPhaseReset.py trunk/src/PyBrainSim.py Modified: trunk/src/ConnectionSimple.py =================================================================== --- trunk/src/ConnectionSimple.py 2009-07-29 14:56:59 UTC (rev 28) +++ trunk/src/ConnectionSimple.py 2009-07-29 15:11:03 UTC (rev 29) @@ -19,12 +19,12 @@ __metaclass__ = type # New style classes. Is this necessary? """ -The DummyConnection class is used for describing communication between two generators - i.e. inhibitory or excitatory connections between simulated neural populations. +The ConnectionSimple class is used for describing communication between two generators - i.e. inhibitory or excitatory connections between simulated neural populations. This class is only the simplest implementation of these ideas, intended to serve as an example and a starting point for creating complex derived classes, ready for real simulation tasks. """ -class DummyConnection: +class ConnectionSimple: def __init__(self, sourceGenerator, targetGenerator): self.sourceGenerator = sourceGenerator self.targetGenerator = targetGenerator Modified: trunk/src/GeneratorNumberIncrementing.py =================================================================== --- trunk/src/GeneratorNumberIncrementing.py 2009-07-29 14:56:59 UTC (rev 28) +++ trunk/src/GeneratorNumberIncrementing.py 2009-07-29 15:11:03 UTC (rev 29) @@ -19,10 +19,10 @@ __metaclass__ = type # New style classes. Is this necessary? """ -The DummyGenerator class serves as a starting point for creating complex classes simulation populations of neurons. Although currently all it does is adding integers. +The GeneratorNumberIncrementing class serves as a starting point for creating complex classes simulation populations of neurons. Although currently all it does is adding integers. """ -class DummyGenerator: +class GeneratorNumberIncrementing: def __init__(self): self.activation = 0 Modified: trunk/src/GeneratorSine.py =================================================================== --- trunk/src/GeneratorSine.py 2009-07-29 14:56:59 UTC (rev 28) +++ trunk/src/GeneratorSine.py 2009-07-29 15:11:03 UTC (rev 29) @@ -19,12 +19,12 @@ __metaclass__ = type # New style classes. Is this necessary? """ -The SineGenerator class is an example generator that simply generates a single sine. +The GeneratorSine class is an example generator that simply generates a single sine. """ import math -class SineGenerator: +class GeneratorSine: def __init__(self, frequency = 1, phaseShift = 0): self.activation = 0 self.frequency = frequency Modified: trunk/src/GeneratorStimulusActivationZeroing.py =================================================================== --- trunk/src/GeneratorStimulusActivationZeroing.py 2009-07-29 14:56:59 UTC (rev 28) +++ trunk/src/GeneratorStimulusActivationZeroing.py 2009-07-29 15:11:03 UTC (rev 29) @@ -19,14 +19,14 @@ __metaclass__ = type # New style classes. Is this necessary? """ -The ActivationZeroingStimulusGenerator class is a child class of the Generator class. It reimplements the runGenerator method, so that a stimulus can be periodically sent to all connected generators. +The GeneratorStimulusActivationZeroing class is a child class of the Generator class. It reimplements the runGenerator method, so that a stimulus can be periodically sent to all connected generators. -Currently the ActivationZeroingStimulusGenerator class only keeps a counter to remember the number of times it was called. +Currently the GeneratorStimulusActivationZeroing class only keeps a counter to remember the number of times it was called. """ -from DummyGenerator import DummyGenerator +from GeneratorDummy import GeneratorDummy -class ActivationZeroingStimulusGenerator(DummyGenerator): +class GeneratorStimulusActivationZeroing(GeneratorDummy): def __init__(self): self.activation = 0 self.connectedGeneratorOutput = 0 Modified: trunk/src/GeneratorStimulusPhaseReset.py =================================================================== --- trunk/src/GeneratorStimulusPhaseReset.py 2009-07-29 14:56:59 UTC (rev 28) +++ trunk/src/GeneratorStimulusPhaseReset.py 2009-07-29 15:11:03 UTC (rev 29) @@ -21,9 +21,9 @@ """ """ -from DummyGenerator import DummyGenerator +from GeneratorDummy import GeneratorDummy -class PhaseResetStimulusGenerator(DummyGenerator): +class GeneratorStimulusPhaseReset(GeneratorDummy): def __init__(self): self.activation = 0 self.connectedGeneratorPhase = 0 Modified: trunk/src/PyBrainSim.py =================================================================== --- trunk/src/PyBrainSim.py 2009-07-29 14:56:59 UTC (rev 28) +++ trunk/src/PyBrainSim.py 2009-07-29 15:11:03 UTC (rev 29) @@ -19,18 +19,18 @@ """ PyBrainSim is an interactive tool for the simulation and visualization of the electromagnetic activity of the brain, currently under development. -This script can be executed to run an example simulation, using the Head and DummyGenerator classes. Currently it only generates a list of integer numbers... but work is under way to make it simulate the brain... Have fun! +This script can be executed to run an example simulation, using the Head and GeneratorDummy classes. Currently it only generates a list of integer numbers... but work is under way to make it simulate the brain... Have fun! pybrainsim.sourceforge.net """ from Head import Head from Experiment import Experiment -from DummyGenerator import DummyGenerator -from SineGenerator import SineGenerator -from DummyConnection import DummyConnection -from ActivationZeroingStimulusGenerator import ActivationZeroingStimulusGenerator -from PhaseResetStimulusGenerator import PhaseResetStimulusGenerator +from GeneratorDummy import GeneratorDummy +from GeneratorSine import GeneratorSine +from ConnectionSimple import ConnectionSimple +from GeneratorStimulusActivationZeroing import GeneratorStimulusActivationZeroing +from GeneratorStimulusPhaseReset import GeneratorStimulusPhaseReset welcomeMessage = "\n\ Welcome to this early version of PyBrainSim\n\n\ @@ -48,19 +48,19 @@ exampleHead.addRegistrationSite([0, 0, 0]) exampleHead.addRegistrationSite([0, 0, 0]) - exampleGenerator1 = DummyGenerator() - exampleGenerator2 = DummyGenerator() + exampleGenerator1 = GeneratorDummy() + exampleGenerator2 = GeneratorDummy() exampleHead.addGenerator(exampleGenerator1) exampleHead.addGenerator(exampleGenerator2) - exampleConnection = DummyConnection(exampleGenerator1, exampleGenerator2) + exampleConnection = ConnectionSimple(exampleGenerator1, exampleGenerator2) exampleHead.addConnection(exampleConnection) - exampleStimulus = ActivationZeroingStimulusGenerator() + exampleStimulus = GeneratorStimulusActivationZeroing() exampleHead.addGenerator(exampleStimulus) - exampleStimulusToGeneratorConnection = DummyConnection(exampleStimulus, exampleGenerator1) - exampleGeneratorToStimulusConnection = DummyConnection(exampleGenerator1, exampleStimulus) + exampleStimulusToGeneratorConnection = ConnectionSimple(exampleStimulus, exampleGenerator1) + exampleGeneratorToStimulusConnection = ConnectionSimple(exampleGenerator1, exampleStimulus) exampleHead.addConnection(exampleStimulusToGeneratorConnection) exampleHead.addConnection(exampleGeneratorToStimulusConnection) @@ -74,15 +74,15 @@ exampleHead.setSamplingFrequency(10) exampleHead.addRegistrationSite([0, 0, 0]) - exampleGenerator1 = SineGenerator() + exampleGenerator1 = GeneratorSine() exampleHead.addGenerator(exampleGenerator1) - exampleStimulus = PhaseResetStimulusGenerator() + exampleStimulus = GeneratorStimulusPhaseReset() exampleStimulus.setStimulusTimes(exampleExperiment.getStimulusTimes()) exampleHead.addGenerator(exampleStimulus) - exampleStimulusToGeneratorConnection = DummyConnection(exampleStimulus, exampleGenerator1) - exampleGeneratorToStimulusConnection = DummyConnection(exampleGenerator1, exampleStimulus) + exampleStimulusToGeneratorConnection = ConnectionSimple(exampleStimulus, exampleGenerator1) + exampleGeneratorToStimulusConnection = ConnectionSimple(exampleGenerator1, exampleStimulus) exampleHead.addConnection(exampleGeneratorToStimulusConnection) exampleHead.addConnection(exampleStimulusToGeneratorConnection) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-07-29 14:57:07
|
Revision: 28 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=28&view=rev Author: rgoj Date: 2009-07-29 14:56:59 +0000 (Wed, 29 Jul 2009) Log Message: ----------- * Renaming DummyConnection to ConnectionSimple Added Paths: ----------- trunk/src/ConnectionSimple.py Removed Paths: ------------- trunk/src/DummyConnection.py Copied: trunk/src/ConnectionSimple.py (from rev 26, trunk/src/DummyConnection.py) =================================================================== --- trunk/src/ConnectionSimple.py (rev 0) +++ trunk/src/ConnectionSimple.py 2009-07-29 14:56:59 UTC (rev 28) @@ -0,0 +1,36 @@ +# PyBrainSim +# Copyright 2009 Roman Goj +# +# This file is part of PyBrainSim. +# +# PyBrainSim is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# PyBrainSim is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with PyBrainSim. If not, see <http://www.gnu.org/licenses/>. + +__metaclass__ = type # New style classes. Is this necessary? + +""" +The DummyConnection class is used for describing communication between two generators - i.e. inhibitory or excitatory connections between simulated neural populations. + +This class is only the simplest implementation of these ideas, intended to serve as an example and a starting point for creating complex derived classes, ready for real simulation tasks. +""" + +class DummyConnection: + def __init__(self, sourceGenerator, targetGenerator): + self.sourceGenerator = sourceGenerator + self.targetGenerator = targetGenerator + + def runConnection(self): + """Sends the output of the source generator to the target generator, without any changes.""" + + print("Running connection...") + self.targetGenerator.receiveInput(self.sourceGenerator.sendOutput()) Deleted: trunk/src/DummyConnection.py =================================================================== --- trunk/src/DummyConnection.py 2009-07-29 14:43:30 UTC (rev 27) +++ trunk/src/DummyConnection.py 2009-07-29 14:56:59 UTC (rev 28) @@ -1,36 +0,0 @@ -# PyBrainSim -# Copyright 2009 Roman Goj -# -# This file is part of PyBrainSim. -# -# PyBrainSim is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# PyBrainSim is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with PyBrainSim. If not, see <http://www.gnu.org/licenses/>. - -__metaclass__ = type # New style classes. Is this necessary? - -""" -The DummyConnection class is used for describing communication between two generators - i.e. inhibitory or excitatory connections between simulated neural populations. - -This class is only the simplest implementation of these ideas, intended to serve as an example and a starting point for creating complex derived classes, ready for real simulation tasks. -""" - -class DummyConnection: - def __init__(self, sourceGenerator, targetGenerator): - self.sourceGenerator = sourceGenerator - self.targetGenerator = targetGenerator - - def runConnection(self): - """Sends the output of the source generator to the target generator, without any changes.""" - - print("Running connection...") - self.targetGenerator.receiveInput(self.sourceGenerator.sendOutput()) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-07-29 14:43:39
|
Revision: 27 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=27&view=rev Author: rgoj Date: 2009-07-29 14:43:30 +0000 (Wed, 29 Jul 2009) Log Message: ----------- * adding a phase reset stimuli generator Added Paths: ----------- trunk/src/GeneratorStimulusPhaseReset.py Added: trunk/src/GeneratorStimulusPhaseReset.py =================================================================== --- trunk/src/GeneratorStimulusPhaseReset.py (rev 0) +++ trunk/src/GeneratorStimulusPhaseReset.py 2009-07-29 14:43:30 UTC (rev 27) @@ -0,0 +1,49 @@ +# PyBrainSim +# Copyright 2009 Roman Goj +# +# This file is part of PyBrainSim. +# +# PyBrainSim is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# PyBrainSim is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with PyBrainSim. If not, see <http://www.gnu.org/licenses/>. + +__metaclass__ = type # New style classes. Is this necessary? + +""" +""" + +from DummyGenerator import DummyGenerator + +class PhaseResetStimulusGenerator(DummyGenerator): + def __init__(self): + self.activation = 0 + self.connectedGeneratorPhase = 0 + self.stimulusTimes = [] + self.currentStimulus = 0 + + def setStimulusTimes(self, stimulusTimes): + self.stimulusTimes = stimulusTimes + + def receiveInput(self, input): + self.connectedGeneratorPhase = input + print("Received input: " + str(self.connectedGeneratorPhase)) + + def runGenerator(self, time): + if self.currentStimulus < len(self.stimulusTimes): + if self.stimulusTimes[self.currentStimulus] < time: + print("Stimulus now: BEEEEEEEP! ... Time is: " + str(time) + ", Stimulus list is: " + str(self.stimulusTimes) + " Connected generator phase should have been: " + str(self.connectedGeneratorPhase)) + self.activation = -self.connectedGeneratorPhase + self.currentStimulus += 1 + else: + self.activation = 0 + + return 0 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-07-29 14:42:56
|
Revision: 26 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=26&view=rev Author: rgoj Date: 2009-07-29 14:42:44 +0000 (Wed, 29 Jul 2009) Log Message: ----------- * Changing generator names, moving the word "Generator" to the front for better readability Modified Paths: -------------- trunk/src/DummyConnection.py trunk/src/Experiment.py trunk/src/Head.py trunk/src/PyBrainSim.py Added Paths: ----------- trunk/src/GeneratorNumberIncrementing.py trunk/src/GeneratorSine.py trunk/src/GeneratorStimulusActivationZeroing.py Removed Paths: ------------- trunk/src/ActivationZeroingStimulusGenerator.py trunk/src/DummyGenerator.py trunk/src/SineGenerator.py Deleted: trunk/src/ActivationZeroingStimulusGenerator.py =================================================================== --- trunk/src/ActivationZeroingStimulusGenerator.py 2009-07-29 09:22:28 UTC (rev 25) +++ trunk/src/ActivationZeroingStimulusGenerator.py 2009-07-29 14:42:44 UTC (rev 26) @@ -1,46 +0,0 @@ -# PyBrainSim -# Copyright 2009 Roman Goj -# -# This file is part of PyBrainSim. -# -# PyBrainSim is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# PyBrainSim is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with PyBrainSim. If not, see <http://www.gnu.org/licenses/>. - -__metaclass__ = type # New style classes. Is this necessary? - -""" -The ActivationZeroingStimulusGenerator class is a child class of the Generator class. It reimplements the runGenerator method, so that a stimulus can be periodically sent to all connected generators. - -Currently the ActivationZeroingStimulusGenerator class only keeps a counter to remember the number of times it was called. -""" - -from DummyGenerator import DummyGenerator - -class ActivationZeroingStimulusGenerator(DummyGenerator): - def __init__(self): - self.activation = 0 - self.connectedGeneratorOutput = 0 - self.counter = 0 - - def receiveInput(self, input): - self.connectedGeneratorOutput = input - - def runGenerator(self, time): - if self.counter == 10: - self.activation = -self.connectedGeneratorOutput - self.counter = 0 - else: - self.activation = 0 - self.counter += 1 - - return 0 # This is necessary, because the activation of this function is added to the recording in Head.py Modified: trunk/src/DummyConnection.py =================================================================== --- trunk/src/DummyConnection.py 2009-07-29 09:22:28 UTC (rev 25) +++ trunk/src/DummyConnection.py 2009-07-29 14:42:44 UTC (rev 26) @@ -32,4 +32,5 @@ def runConnection(self): """Sends the output of the source generator to the target generator, without any changes.""" + print("Running connection...") self.targetGenerator.receiveInput(self.sourceGenerator.sendOutput()) Deleted: trunk/src/DummyGenerator.py =================================================================== --- trunk/src/DummyGenerator.py 2009-07-29 09:22:28 UTC (rev 25) +++ trunk/src/DummyGenerator.py 2009-07-29 14:42:44 UTC (rev 26) @@ -1,37 +0,0 @@ -# PyBrainSim -# Copyright 2009 Roman Goj -# -# This file is part of PyBrainSim. -# -# PyBrainSim is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# PyBrainSim is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with PyBrainSim. If not, see <http://www.gnu.org/licenses/>. - -__metaclass__ = type # New style classes. Is this necessary? - -""" -The DummyGenerator class serves as a starting point for creating complex classes simulation populations of neurons. Although currently all it does is adding integers. -""" - -class DummyGenerator: - def __init__(self): - self.activation = 0 - - def sendOutput(self): - return self.activation - - def receiveInput(self, input): - self.activation += input - - def runGenerator(self, time): - self.activation = self.activation + 1 - return self.activation Modified: trunk/src/Experiment.py =================================================================== --- trunk/src/Experiment.py 2009-07-29 09:22:28 UTC (rev 25) +++ trunk/src/Experiment.py 2009-07-29 14:42:44 UTC (rev 26) @@ -27,6 +27,9 @@ self.recording = recording self.stimulusTimes = stimulusTimes + def setRecording(self, recording): + self.recording = recording + def getRecording(self): return self.recording Copied: trunk/src/GeneratorNumberIncrementing.py (from rev 20, trunk/src/DummyGenerator.py) =================================================================== --- trunk/src/GeneratorNumberIncrementing.py (rev 0) +++ trunk/src/GeneratorNumberIncrementing.py 2009-07-29 14:42:44 UTC (rev 26) @@ -0,0 +1,37 @@ +# PyBrainSim +# Copyright 2009 Roman Goj +# +# This file is part of PyBrainSim. +# +# PyBrainSim is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# PyBrainSim is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with PyBrainSim. If not, see <http://www.gnu.org/licenses/>. + +__metaclass__ = type # New style classes. Is this necessary? + +""" +The DummyGenerator class serves as a starting point for creating complex classes simulation populations of neurons. Although currently all it does is adding integers. +""" + +class DummyGenerator: + def __init__(self): + self.activation = 0 + + def sendOutput(self): + return self.activation + + def receiveInput(self, input): + self.activation += input + + def runGenerator(self, time): + self.activation = self.activation + 1 + return self.activation Copied: trunk/src/GeneratorSine.py (from rev 22, trunk/src/SineGenerator.py) =================================================================== --- trunk/src/GeneratorSine.py (rev 0) +++ trunk/src/GeneratorSine.py 2009-07-29 14:42:44 UTC (rev 26) @@ -0,0 +1,44 @@ +# PyBrainSim +# Copyright 2009 Roman Goj +# +# This file is part of PyBrainSim. +# +# PyBrainSim is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# PyBrainSim is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with PyBrainSim. If not, see <http://www.gnu.org/licenses/>. + +__metaclass__ = type # New style classes. Is this necessary? + +""" +The SineGenerator class is an example generator that simply generates a single sine. +""" + +import math + +class SineGenerator: + def __init__(self, frequency = 1, phaseShift = 0): + self.activation = 0 + self.frequency = frequency + self.phase = phaseShift + self.phaseShift = phaseShift + + def sendOutput(self): + print("Sending output: " + str(self.phase)) + return self.phase + + def receiveInput(self, newPhaseShift): + self.phaseShift = newPhaseShift + + def runGenerator(self, time): + self.phase = (2 * math.pi * self.frequency * time + 2 * math.pi * self.phaseShift) % (2 * math.pi / self.frequency) / (2 * math.pi) + print("Phase is now: " + str(self.phase)) + return math.sin(self.phase * 2 * math.pi) Property changes on: trunk/src/GeneratorSine.py ___________________________________________________________________ Added: svn:mergeinfo + Copied: trunk/src/GeneratorStimulusActivationZeroing.py (from rev 20, trunk/src/ActivationZeroingStimulusGenerator.py) =================================================================== --- trunk/src/GeneratorStimulusActivationZeroing.py (rev 0) +++ trunk/src/GeneratorStimulusActivationZeroing.py 2009-07-29 14:42:44 UTC (rev 26) @@ -0,0 +1,46 @@ +# PyBrainSim +# Copyright 2009 Roman Goj +# +# This file is part of PyBrainSim. +# +# PyBrainSim is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# PyBrainSim is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with PyBrainSim. If not, see <http://www.gnu.org/licenses/>. + +__metaclass__ = type # New style classes. Is this necessary? + +""" +The ActivationZeroingStimulusGenerator class is a child class of the Generator class. It reimplements the runGenerator method, so that a stimulus can be periodically sent to all connected generators. + +Currently the ActivationZeroingStimulusGenerator class only keeps a counter to remember the number of times it was called. +""" + +from DummyGenerator import DummyGenerator + +class ActivationZeroingStimulusGenerator(DummyGenerator): + def __init__(self): + self.activation = 0 + self.connectedGeneratorOutput = 0 + self.counter = 0 + + def receiveInput(self, input): + self.connectedGeneratorOutput = input + + def runGenerator(self, time): + if self.counter == 10: + self.activation = -self.connectedGeneratorOutput + self.counter = 0 + else: + self.activation = 0 + self.counter += 1 + + return 0 # This is necessary, because the activation of this function is added to the recording in Head.py Modified: trunk/src/Head.py =================================================================== --- trunk/src/Head.py 2009-07-29 09:22:28 UTC (rev 25) +++ trunk/src/Head.py 2009-07-29 14:42:44 UTC (rev 26) @@ -16,6 +16,7 @@ # You should have received a copy of the GNU General Public License # along with PyBrainSim. If not, see <http://www.gnu.org/licenses/>. +from __future__ import division __metaclass__ = type # New style classes. Is this necessary? """ @@ -26,7 +27,7 @@ class Head: def __init__(self): - self.samplingFrequency = 128; + self.samplingFrequency = 10; self.generatorList = [] self.generatorSiteList = [] self.connectionList = [] @@ -74,7 +75,8 @@ # Querying all generators and connections for timePoint in range(duration * self.samplingFrequency): for i in range(len(self.generatorList)): - generatorOutput[i] = (self.generatorList[i]).runGenerator(timePoint) + generatorOutput[i] = (self.generatorList[i]).runGenerator(timePoint/self.samplingFrequency) + print("Time: " + str(timePoint/self.samplingFrequency) + ", Generator: " + str(i) + ", Generator Output: " + str(generatorOutput[i])) for i in range(len(self.connectionList)): self.connectionList[i].runConnection() Modified: trunk/src/PyBrainSim.py =================================================================== --- trunk/src/PyBrainSim.py 2009-07-29 09:22:28 UTC (rev 25) +++ trunk/src/PyBrainSim.py 2009-07-29 14:42:44 UTC (rev 26) @@ -30,6 +30,7 @@ from SineGenerator import SineGenerator from DummyConnection import DummyConnection from ActivationZeroingStimulusGenerator import ActivationZeroingStimulusGenerator +from PhaseResetStimulusGenerator import PhaseResetStimulusGenerator welcomeMessage = "\n\ Welcome to this early version of PyBrainSim\n\n\ @@ -60,28 +61,32 @@ exampleStimulusToGeneratorConnection = DummyConnection(exampleStimulus, exampleGenerator1) exampleGeneratorToStimulusConnection = DummyConnection(exampleGenerator1, exampleStimulus) + exampleHead.addConnection(exampleStimulusToGeneratorConnection) exampleHead.addConnection(exampleGeneratorToStimulusConnection) - exampleHead.addConnection(exampleStimulusToGeneratorConnection) exampleExperiment = Experiment(exampleHead.runSimulation(1)) print exampleExperiment.getRecording() elif userChoice == 2: + exampleExperiment = Experiment() + exampleExperiment.addStimulusTime(0.2341) + exampleHead = Head() - exampleHead.setSamplingFrequency(32) + exampleHead.setSamplingFrequency(10) exampleHead.addRegistrationSite([0, 0, 0]) exampleGenerator1 = SineGenerator() exampleHead.addGenerator(exampleGenerator1) - #exampleStimulus = ActivationZeroingStimulusGenerator() - #exampleHead.addGenerator(exampleStimulus) + exampleStimulus = PhaseResetStimulusGenerator() + exampleStimulus.setStimulusTimes(exampleExperiment.getStimulusTimes()) + exampleHead.addGenerator(exampleStimulus) - #exampleStimulusToGeneratorConnection = DummyConnection(exampleStimulus, exampleGenerator1) - #exampleGeneratorToStimulusConnection = DummyConnection(exampleGenerator1, exampleStimulus) - #exampleHead.addConnection(exampleGeneratorToStimulusConnection) - #exampleHead.addConnection(exampleStimulusToGeneratorConnection) + exampleStimulusToGeneratorConnection = DummyConnection(exampleStimulus, exampleGenerator1) + exampleGeneratorToStimulusConnection = DummyConnection(exampleGenerator1, exampleStimulus) + exampleHead.addConnection(exampleGeneratorToStimulusConnection) + exampleHead.addConnection(exampleStimulusToGeneratorConnection) - exampleExperiment = Experiment(exampleHead.runSimulation(1)) + exampleExperiment.setRecording(exampleHead.runSimulation(1.1)) print exampleExperiment.getRecording() else: print("No such option unfortunately...") Deleted: trunk/src/SineGenerator.py =================================================================== --- trunk/src/SineGenerator.py 2009-07-29 09:22:28 UTC (rev 25) +++ trunk/src/SineGenerator.py 2009-07-29 14:42:44 UTC (rev 26) @@ -1,37 +0,0 @@ -# PyBrainSim -# Copyright 2009 Roman Goj -# -# This file is part of PyBrainSim. -# -# PyBrainSim is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# PyBrainSim is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with PyBrainSim. If not, see <http://www.gnu.org/licenses/>. - -__metaclass__ = type # New style classes. Is this necessary? - -""" -The SineGenerator class is an example generator that simply generates a single sine. -""" - -import math - -class SineGenerator: - def __init__(self, frequency = 10, phaseShift = 0): - self.activation = 0 - self.frequency = frequency - self.phaseShift = phaseShift - - def receiveInput(self, newPhaseShift): - self.phaseShift = newPhaseShift - - def runGenerator(self, time): - return math.sin(2 * math.pi / self.frequency * time + 2 * math.pi * self.phaseShift) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: PyBrainSim - T. i. <no...@so...> - 2009-07-29 09:59:20
|
#43: Write a simple list of stimuli for the Recording class -------------------------+-------------------------------------------------- Reporter: rgoj | Owner: rgoj Type: task | Status: closed Priority: major | Milestone: Sinusoidal generator simulation Component: Simulations | Resolution: fixed Keywords: | -------------------------+-------------------------------------------------- Changes (by rgoj): * status: new => closed * resolution: => fixed -- Ticket URL: <http://sourceforge.net/apps/trac/pybrainsim/ticket/43#comment:1> PyBrainSim <http://sourceforge.net/projects/pybrainsim/> An interactive tool for the simulation and visualization of the electromagnetic activity of the brain. |