pybrainsim-activity Mailing List for PyBrainSim - The Brain Phantom Project (Page 6)
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 17:31:27
|
Revision: 72 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=72&view=rev Author: rgoj Date: 2009-08-03 17:31:21 +0000 (Mon, 03 Aug 2009) Log Message: ----------- * adding getSource and getTarger methods to Connection Modified Paths: -------------- trunk/src/Connection.py Modified: trunk/src/Connection.py =================================================================== --- trunk/src/Connection.py 2009-08-03 17:27:14 UTC (rev 71) +++ trunk/src/Connection.py 2009-08-03 17:31:21 UTC (rev 72) @@ -39,6 +39,12 @@ def getName(self): return self.name + def getSource(self): + return self.sourceGenerator + + def getTarget(self): + return self.targetGenerator + def getSourceName(self): return self.sourceGenerator.getName() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-08-03 17:27:23
|
Revision: 71 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=71&view=rev Author: rgoj Date: 2009-08-03 17:27:14 +0000 (Mon, 03 Aug 2009) Log Message: ----------- * Adding another example simulation with two generators and one stimulus for each generator Modified Paths: -------------- trunk/src/PyBrainSim.py Modified: trunk/src/PyBrainSim.py =================================================================== --- trunk/src/PyBrainSim.py 2009-08-03 17:05:30 UTC (rev 70) +++ trunk/src/PyBrainSim.py 2009-08-03 17:27:14 UTC (rev 71) @@ -43,7 +43,8 @@ Choose the type of simulation you would like to perform:\n\ 1. Example dummy simulation\n\ 2. Incrementing numbers, one generator and a stimulus\n\ - 3. Sinusoidal generator\n" + 3. Incrementing numbers, two generators and a stimulus for one of them\n\ + 4. Sinusoidal generator\n" print(welcomeMessage) userChoice = input("Your choice: ") @@ -74,6 +75,23 @@ exampleExperiment = Experiment(exampleHead.runSimulation( 1 )) print("\nSimulations resulted in the following recording:") print exampleExperiment.getRecording() +elif userChoice == 3: + exampleHead = Head() + exampleHead.setSamplingFrequency(10) + exampleHead.addRegistrationSite([0, 0, 0]) + + exampleStimulus1 = Stimulus('Stim1', exampleHead) + exampleStimulus2 = Stimulus('Stim2', exampleHead) + exampleStimulus1.setStimulusTimes([0.3, 0.6]) + exampleStimulus2.setStimulusTimes([0.5]) + exampleGenerator1 = GeneratorNumberIncrementing('Gen1', exampleHead) + exampleGenerator2 = GeneratorNumberIncrementing('Gen2', exampleHead) + exampleConnection1 = Connection('Con1', exampleHead, exampleStimulus1, exampleGenerator1) + exampleConnection2 = Connection('Con2', exampleHead, exampleStimulus2, exampleGenerator2) + + exampleExperiment = Experiment(exampleHead.runSimulation( 1 )) + print("\nSimulations resulted in the following recording:") + print exampleExperiment.getRecording() #elif userChoice == 2: # exampleExperiment = Experiment() # exampleExperiment.addStimulusTime( 0.2341 ) 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-03 17:14:37
|
#100: The Experiment class should allow for different stimulus times for different stimuli objects -------------------------+-------------------------------------------------- Reporter: rgoj | Owner: rgoj Type: task | Status: new Priority: major | Milestone: Modelling phase resetting Component: Simulations | Keywords: -------------------------+-------------------------------------------------- -- Ticket URL: <http://sourceforge.net/apps/trac/pybrainsim/ticket/100> 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-03 17:05:36
|
Revision: 70 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=70&view=rev Author: rgoj Date: 2009-08-03 17:05:30 +0000 (Mon, 03 Aug 2009) Log Message: ----------- * Re-adding a second example simulation to the PyBrainSim.py script - using one number incrementing generator with a stimulus Modified Paths: -------------- trunk/src/PyBrainSim.py Modified: trunk/src/PyBrainSim.py =================================================================== --- trunk/src/PyBrainSim.py 2009-08-03 17:04:08 UTC (rev 69) +++ trunk/src/PyBrainSim.py 2009-08-03 17:05:30 UTC (rev 70) @@ -29,6 +29,7 @@ from Head import Head from Experiment import Experiment +from Stimulus import Stimulus from StimulusDummy import StimulusDummy from GeneratorDummy import GeneratorDummy from GeneratorNumberIncrementing import GeneratorNumberIncrementing @@ -41,7 +42,7 @@ Welcome to this early version of PyBrainSim\n\n\ Choose the type of simulation you would like to perform:\n\ 1. Example dummy simulation\n\ - 2. Adding numbers\n\ + 2. Incrementing numbers, one generator and a stimulus\n\ 3. Sinusoidal generator\n" print(welcomeMessage) @@ -60,31 +61,20 @@ exampleExperiment = Experiment(exampleHead.runSimulation( 1 )) print("\nSimulations resulted in the following recording:") print(exampleExperiment.getRecording()) +elif userChoice == 2: + exampleHead = Head() + exampleHead.setSamplingFrequency(10) + exampleHead.addRegistrationSite([0, 0, 0]) + + exampleStimulus = Stimulus('Stim', exampleHead) + exampleStimulus.setStimulusTimes([0.3, 0.6]) + exampleGenerator = GeneratorNumberIncrementing('Gen', exampleHead) + exampleConnection = Connection('Con', exampleHead, exampleStimulus, exampleGenerator) + + exampleExperiment = Experiment(exampleHead.runSimulation( 1 )) + print("\nSimulations resulted in the following recording:") + 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 ) # This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-08-03 17:04:16
|
Revision: 69 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=69&view=rev Author: rgoj Date: 2009-08-03 17:04:08 +0000 (Mon, 03 Aug 2009) Log Message: ----------- * Correcting mistake: If the stimulus returns a word as it's activation, this should not be counted into the general activation * Using Numeric.arange to provide the range of time points * Time points now begin at 1/samplingFrequency and the last point is the end time specified when invoking runSimulation Modified Paths: -------------- trunk/src/Head.py Modified: trunk/src/Head.py =================================================================== --- trunk/src/Head.py 2009-08-03 17:00:55 UTC (rev 68) +++ trunk/src/Head.py 2009-08-03 17:04:08 UTC (rev 69) @@ -15,6 +15,7 @@ # PyBrainSim. If not, see <http://www.gnu.org/licenses/>. from __future__ import division +from Numeric import arange __metaclass__ = type # New style classes. Is this necessary? """ @@ -57,8 +58,13 @@ # Filling all registration sites with the generators' output for i in range(len(recording)): recording[i].append(0) - for klupek in range(len(self.generatorList)): - recording[i][-1] += generatorOutput[klupek] + for j in range(len(self.generatorList)): + # The Stimulus class may return a string variable, we can't add + # it to the recording, so we need to look out for it. + if isinstance(generatorOutput[j], str): + recording[i][-1] += 0 + else: + recording[i][-1] += generatorOutput[j] return recording @@ -79,12 +85,14 @@ # Querying all generators and sending generator output through # connections - for timePoint in range(duration * self.samplingFrequency): - print("HEAD, time: " + str(timePoint/self.samplingFrequency)) + timeStep = 1/self.samplingFrequency + timeRange = list(arange(timeStep, duration + timeStep, timeStep)) + for timePoint in timeRange: + print("HEAD, time: " + str(timePoint)) # Recording the output of each generator for i in range(len(self.generatorList)): - generatorOutput[i] = (self.generatorList[i]).runGenerator(timePoint/self.samplingFrequency) + generatorOutput[i] = (self.generatorList[i]).runGenerator(timePoint) # Sending the output of generators through connections for i in range(len(self.connectionList)): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-08-03 17:01:03
|
Revision: 68 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=68&view=rev Author: rgoj Date: 2009-08-03 17:00:55 +0000 (Mon, 03 Aug 2009) Log Message: ----------- * Correcting mistake: a generator must return it's activation from the runGenerator method * Correcting mistake: after the end of stimuli in stimulusList the activation would remain unchanged, thus always stimulating the connected generator * Changing message printed by the runGenerator method Modified Paths: -------------- trunk/src/Stimulus.py Modified: trunk/src/Stimulus.py =================================================================== --- trunk/src/Stimulus.py 2009-08-03 16:55:34 UTC (rev 67) +++ trunk/src/Stimulus.py 2009-08-03 17:00:55 UTC (rev 68) @@ -38,14 +38,14 @@ 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)) + if self.stimulusTimes[self.currentStimulus] <= time: + print("Stimulus now: BEEEEEEEP! ... Time is: " + str(time) + ", Stimulus list is: " + str(self.stimulusTimes)) self.currentStimulus += 1 - self.activation = 'Stimulus' else: - self.activation = None + self.activation = 0 + else: + self.activation = 0 - # The runGenerator method must return a value - return 0 + 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-03 16:55:46
|
Revision: 67 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=67&view=rev Author: rgoj Date: 2009-08-03 16:55:34 +0000 (Mon, 03 Aug 2009) Log Message: ----------- * Correcting a small mistake Modified Paths: -------------- trunk/src/GeneratorNumberIncrementing.py Modified: trunk/src/GeneratorNumberIncrementing.py =================================================================== --- trunk/src/GeneratorNumberIncrementing.py 2009-08-03 12:07:56 UTC (rev 66) +++ trunk/src/GeneratorNumberIncrementing.py 2009-08-03 16:55:34 UTC (rev 67) @@ -29,7 +29,7 @@ print(self.name + ": A GeneratorNumberIncrementing object") def receiveInput(self, input): - if activation == 'Stimulus': + if input == 'Stimulus': self.activation = 0 else: self.activation += input This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-08-03 12:40:27
|
Revision: 57 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=57&view=rev Author: rgoj Date: 2009-08-03 11:20:21 +0000 (Mon, 03 Aug 2009) Log Message: ----------- * Generators now can't be created without a Head class to be attached to, because: ** the __init__ method now needs a Head object as input ** the __init__ method now adds the generator to the specified Head object * This makes the syntax to use Generators (e.g. in PyBrainSim.py) much, much nicer. Modified Paths: -------------- trunk/src/Generator.py Modified: trunk/src/Generator.py =================================================================== --- trunk/src/Generator.py 2009-08-03 11:14:11 UTC (rev 56) +++ trunk/src/Generator.py 2009-08-03 11:20:21 UTC (rev 57) @@ -22,9 +22,10 @@ """ class Generator: - def __init__(self, name): + def __init__(self, name, head): self.name = name self.activation = 0 + head.addGenerator(self) def printInfo(self): print(self.name + ": A Generator object") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-08-03 12:08:03
|
Revision: 66 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=66&view=rev Author: rgoj Date: 2009-08-03 12:07:56 +0000 (Mon, 03 Aug 2009) Log Message: ----------- * Adding missing inheritance from the Generator class Modified Paths: -------------- trunk/src/GeneratorNumberIncrementing.py Modified: trunk/src/GeneratorNumberIncrementing.py =================================================================== --- trunk/src/GeneratorNumberIncrementing.py 2009-08-03 11:59:41 UTC (rev 65) +++ trunk/src/GeneratorNumberIncrementing.py 2009-08-03 12:07:56 UTC (rev 66) @@ -22,7 +22,9 @@ integer addition. """ -class GeneratorNumberIncrementing: +from Generator import Generator + +class GeneratorNumberIncrementing(Generator): def printInfo(self): print(self.name + ": A GeneratorNumberIncrementing object") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-08-03 11:59:48
|
Revision: 65 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=65&view=rev Author: rgoj Date: 2009-08-03 11:59:41 +0000 (Mon, 03 Aug 2009) Log Message: ----------- * Using StimulusDummy instead of Stimulus for the first example. Modified Paths: -------------- trunk/src/PyBrainSim.py Modified: trunk/src/PyBrainSim.py =================================================================== --- trunk/src/PyBrainSim.py 2009-08-03 11:58:42 UTC (rev 64) +++ trunk/src/PyBrainSim.py 2009-08-03 11:59:41 UTC (rev 65) @@ -29,7 +29,7 @@ from Head import Head from Experiment import Experiment -from Stimulus import Stimulus +from StimulusDummy import StimulusDummy from GeneratorDummy import GeneratorDummy from GeneratorNumberIncrementing import GeneratorNumberIncrementing from Connection import Connection @@ -53,7 +53,7 @@ exampleHead.setSamplingFrequency(10) exampleHead.addRegistrationSite([0, 0, 0]) - exampleStimulus = Stimulus('Stim', exampleHead) + exampleStimulus = StimulusDummy('Stim', exampleHead) exampleGenerator = GeneratorDummy('Gen', exampleHead) exampleConnection = ConnectionDummy('Con', exampleHead, exampleStimulus, exampleGenerator) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-08-03 11:58:49
|
Revision: 64 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=64&view=rev Author: rgoj Date: 2009-08-03 11:58:42 +0000 (Mon, 03 Aug 2009) Log Message: ----------- * Changing the message printed by StimulusDummy Modified Paths: -------------- trunk/src/StimulusDummy.py Modified: trunk/src/StimulusDummy.py =================================================================== --- trunk/src/StimulusDummy.py 2009-08-03 11:50:59 UTC (rev 63) +++ trunk/src/StimulusDummy.py 2009-08-03 11:58:42 UTC (rev 64) @@ -28,5 +28,5 @@ print(self.name + ": A StimulusDummy object") def runGenerator(self, time): - print("[runGenerator] " + self.name + ": Sending out the stimulus") + print("[runGenerator] " + self.name + ": Preparing the stimulus") return Stimulus.runGenerator(self, time) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-08-03 11:51:07
|
Revision: 63 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=63&view=rev Author: rgoj Date: 2009-08-03 11:50:59 +0000 (Mon, 03 Aug 2009) Log Message: ----------- * Created a StimulusDummy class to print out messages on screen. Added Paths: ----------- trunk/src/StimulusDummy.py Added: trunk/src/StimulusDummy.py =================================================================== --- trunk/src/StimulusDummy.py (rev 0) +++ trunk/src/StimulusDummy.py 2009-08-03 11:50:59 UTC (rev 63) @@ -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? + +""" +This is a reimplementation of the Stimulus class (child of the Generator class) +that prints messages from inside of the interesting methods. +""" + +from Stimulus import Stimulus + +class StimulusDummy(Stimulus): + def printInfo(self): + print(self.name + ": A StimulusDummy object") + + def runGenerator(self, time): + print("[runGenerator] " + self.name + ": Sending out the stimulus") + return Stimulus.runGenerator(self, time) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-08-03 11:39:16
|
Revision: 62 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=62&view=rev Author: rgoj Date: 2009-08-03 11:39:06 +0000 (Mon, 03 Aug 2009) Log Message: ----------- * Adding a Stimulus object to the first dummy example simulation in PyBrainSim.py Modified Paths: -------------- trunk/src/PyBrainSim.py Modified: trunk/src/PyBrainSim.py =================================================================== --- trunk/src/PyBrainSim.py 2009-08-03 11:37:53 UTC (rev 61) +++ trunk/src/PyBrainSim.py 2009-08-03 11:39:06 UTC (rev 62) @@ -29,14 +29,13 @@ from Head import Head from Experiment import Experiment +from Stimulus import Stimulus from GeneratorDummy import GeneratorDummy from GeneratorNumberIncrementing import GeneratorNumberIncrementing from Connection import Connection from ConnectionDummy import ConnectionDummy #from GeneratorSine import GeneratorSine -#from GeneratorStimulusActivationZeroing import GeneratorStimulusActivationZeroing -#from GeneratorStimulusPhaseReset import GeneratorStimulusPhaseReset welcomeMessage = "\n\ Welcome to this early version of PyBrainSim\n\n\ @@ -54,9 +53,9 @@ exampleHead.setSamplingFrequency(10) exampleHead.addRegistrationSite([0, 0, 0]) - exampleGenerator1 = GeneratorDummy('Gen1', exampleHead) - exampleGenerator2 = GeneratorDummy('Gen2', exampleHead) - exampleConnection = ConnectionDummy('Con', exampleHead, exampleGenerator1, exampleGenerator2) + exampleStimulus = Stimulus('Stim', exampleHead) + exampleGenerator = GeneratorDummy('Gen', exampleHead) + exampleConnection = ConnectionDummy('Con', exampleHead, exampleStimulus, exampleGenerator) exampleExperiment = Experiment(exampleHead.runSimulation( 1 )) print("\nSimulations resulted in the following recording:") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-08-03 11:38:02
|
Revision: 61 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=61&view=rev Author: rgoj Date: 2009-08-03 11:37:53 +0000 (Mon, 03 Aug 2009) Log Message: ----------- * Making Stimulus look more like a generator - running the Generator's init method in the Stimulus init method. Modified Paths: -------------- trunk/src/Stimulus.py Modified: trunk/src/Stimulus.py =================================================================== --- trunk/src/Stimulus.py 2009-08-03 11:27:10 UTC (rev 60) +++ trunk/src/Stimulus.py 2009-08-03 11:37:53 UTC (rev 61) @@ -25,9 +25,13 @@ from Generator import Generator class Stimulus(Generator): - def __init__(self): - self.activation = None + def __init__(self, name, head): + Generator.__init__(self, name, head) self.stimulusTimes = [] + self.currentStimulus = 0 + + def printInfo(self): + print(self.name + ": A Stimulus object") def setStimulusTimes(self, stimulusTimes): self.stimulusTimes = stimulusTimes This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-08-03 11:27:19
|
Revision: 60 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=60&view=rev Author: rgoj Date: 2009-08-03 11:27:10 +0000 (Mon, 03 Aug 2009) Log Message: ----------- * No need for a separate call to addConnection, removing it, because it is now implemented in the init method of the Connection class. Modified Paths: -------------- trunk/src/PyBrainSim.py Modified: trunk/src/PyBrainSim.py =================================================================== --- trunk/src/PyBrainSim.py 2009-08-03 11:24:07 UTC (rev 59) +++ trunk/src/PyBrainSim.py 2009-08-03 11:27:10 UTC (rev 60) @@ -56,9 +56,7 @@ exampleGenerator1 = GeneratorDummy('Gen1', exampleHead) exampleGenerator2 = GeneratorDummy('Gen2', exampleHead) - - exampleConnection = ConnectionDummy('Con', exampleGenerator1, exampleGenerator2) - exampleHead.addConnection(exampleConnection) + exampleConnection = ConnectionDummy('Con', exampleHead, exampleGenerator1, exampleGenerator2) exampleExperiment = Experiment(exampleHead.runSimulation( 1 )) print("\nSimulations resulted in the following recording:") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-08-03 11:24:14
|
Revision: 59 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=59&view=rev Author: rgoj Date: 2009-08-03 11:24:07 +0000 (Mon, 03 Aug 2009) Log Message: ----------- * The init method of the Connection class now adds itself to the specified Head object. Modified Paths: -------------- trunk/src/Connection.py Modified: trunk/src/Connection.py =================================================================== --- trunk/src/Connection.py 2009-08-03 11:21:36 UTC (rev 58) +++ trunk/src/Connection.py 2009-08-03 11:24:07 UTC (rev 59) @@ -27,10 +27,11 @@ """ class Connection: - def __init__(self, name, sourceGenerator, targetGenerator): + def __init__(self, name, head, sourceGenerator, targetGenerator): self.name = name self.sourceGenerator = sourceGenerator self.targetGenerator = targetGenerator + head.addConnection(self) def printInfo(self): print(self.name + " A Connection object") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-08-03 11:21:42
|
Revision: 58 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=58&view=rev Author: rgoj Date: 2009-08-03 11:21:36 +0000 (Mon, 03 Aug 2009) Log Message: ----------- * Generators are now added to the Head object during generator initialization, no need for a separate call to Head.addGenerator(generator) Modified Paths: -------------- trunk/src/PyBrainSim.py Modified: trunk/src/PyBrainSim.py =================================================================== --- trunk/src/PyBrainSim.py 2009-08-03 11:20:21 UTC (rev 57) +++ trunk/src/PyBrainSim.py 2009-08-03 11:21:36 UTC (rev 58) @@ -54,10 +54,8 @@ exampleHead.setSamplingFrequency(10) exampleHead.addRegistrationSite([0, 0, 0]) - exampleGenerator1 = GeneratorDummy('Gen1') - exampleGenerator2 = GeneratorDummy('Gen2') - exampleHead.addGenerator(exampleGenerator1) - exampleHead.addGenerator(exampleGenerator2) + exampleGenerator1 = GeneratorDummy('Gen1', exampleHead) + exampleGenerator2 = GeneratorDummy('Gen2', exampleHead) exampleConnection = ConnectionDummy('Con', exampleGenerator1, exampleGenerator2) exampleHead.addConnection(exampleConnection) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-08-03 11:14:23
|
Revision: 56 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=56&view=rev Author: rgoj Date: 2009-08-03 11:14:11 +0000 (Mon, 03 Aug 2009) Log Message: ----------- * Only existing, rechecked and correct imports are left, the rest is commented out during refactoring. Modified Paths: -------------- trunk/src/PyBrainSim.py Modified: trunk/src/PyBrainSim.py =================================================================== --- trunk/src/PyBrainSim.py 2009-08-03 11:06:58 UTC (rev 55) +++ trunk/src/PyBrainSim.py 2009-08-03 11:14:11 UTC (rev 56) @@ -30,11 +30,13 @@ from Experiment import Experiment from GeneratorDummy import GeneratorDummy +from GeneratorNumberIncrementing import GeneratorNumberIncrementing +from Connection import Connection from ConnectionDummy import ConnectionDummy -from GeneratorSine import GeneratorSine -from GeneratorStimulusActivationZeroing import GeneratorStimulusActivationZeroing -from GeneratorStimulusPhaseReset import GeneratorStimulusPhaseReset +#from GeneratorSine import GeneratorSine +#from GeneratorStimulusActivationZeroing import GeneratorStimulusActivationZeroing +#from GeneratorStimulusPhaseReset import GeneratorStimulusPhaseReset welcomeMessage = "\n\ Welcome to this early version of PyBrainSim\n\n\ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-08-03 11:07:08
|
Revision: 55 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=55&view=rev Author: rgoj Date: 2009-08-03 11:06:58 +0000 (Mon, 03 Aug 2009) Log Message: ----------- * GeneratorNumberIncrementing now reacts to input 'Stimulus' from a Stimulus class object by zeroing it's activation, making instantaneous zeroing of activation possible. Modified Paths: -------------- trunk/src/GeneratorNumberIncrementing.py Modified: trunk/src/GeneratorNumberIncrementing.py =================================================================== --- trunk/src/GeneratorNumberIncrementing.py 2009-08-03 10:56:16 UTC (rev 54) +++ trunk/src/GeneratorNumberIncrementing.py 2009-08-03 11:06:58 UTC (rev 55) @@ -23,14 +23,14 @@ """ class GeneratorNumberIncrementing: - def __init__(self): - self.activation = 0 + def printInfo(self): + print(self.name + ": A GeneratorNumberIncrementing object") - def sendOutput(self): - return self.activation - def receiveInput(self, input): - self.activation += input + if activation == 'Stimulus': + self.activation = 0 + else: + self.activation += input def runGenerator(self, time): self.activation = self.activation + 1 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:56:23
|
Revision: 54 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=54&view=rev Author: rgoj Date: 2009-08-03 10:56:16 +0000 (Mon, 03 Aug 2009) Log Message: ----------- * Prepared a better documentation comment * Corrected column width of comments Modified Paths: -------------- trunk/src/GeneratorNumberIncrementing.py Modified: trunk/src/GeneratorNumberIncrementing.py =================================================================== --- trunk/src/GeneratorNumberIncrementing.py 2009-08-03 10:46:29 UTC (rev 53) +++ trunk/src/GeneratorNumberIncrementing.py 2009-08-03 10:56:16 UTC (rev 54) @@ -1,25 +1,25 @@ -# 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/>. __metaclass__ = type # New style classes. Is this necessary? """ -The GeneratorNumberIncrementing 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 is a reimplementation of the Generator +class. It provides an elementary example of how the methods could be used to do +integer addition. """ class GeneratorNumberIncrementing: 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:46:50
|
Revision: 53 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=53&view=rev Author: rgoj Date: 2009-08-03 10:46:29 +0000 (Mon, 03 Aug 2009) Log Message: ----------- * One empty line too many. Modified Paths: -------------- trunk/src/Stimulus.py Modified: trunk/src/Stimulus.py =================================================================== --- trunk/src/Stimulus.py 2009-08-03 10:42:32 UTC (rev 52) +++ trunk/src/Stimulus.py 2009-08-03 10:46:29 UTC (rev 53) @@ -43,6 +43,5 @@ else: self.activation = None - # The runGenerator method must return a value 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-03 10:42:40
|
Revision: 52 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=52&view=rev Author: rgoj Date: 2009-08-03 10:42:32 +0000 (Mon, 03 Aug 2009) Log Message: ----------- * Removing the obsolete class GeneratorStimulusPhaseReset. Removed Paths: ------------- trunk/src/GeneratorStimulusPhaseReset.py Deleted: trunk/src/GeneratorStimulusPhaseReset.py =================================================================== --- trunk/src/GeneratorStimulusPhaseReset.py 2009-08-03 10:41:45 UTC (rev 51) +++ trunk/src/GeneratorStimulusPhaseReset.py 2009-08-03 10:42:32 UTC (rev 52) @@ -1,49 +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? - -""" -""" - -from GeneratorDummy import GeneratorDummy - -class GeneratorStimulusPhaseReset(GeneratorDummy): - 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-08-03 10:41:54
|
Revision: 51 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=51&view=rev Author: rgoj Date: 2009-08-03 10:41:45 +0000 (Mon, 03 Aug 2009) Log Message: ----------- * The Stimulus class now also implements stimulusTimes from the phase resetting stimulus class, which will now be removed. Modified Paths: -------------- trunk/src/Stimulus.py Modified: trunk/src/Stimulus.py =================================================================== --- trunk/src/Stimulus.py 2009-08-03 10:32:34 UTC (rev 50) +++ trunk/src/Stimulus.py 2009-08-03 10:41:45 UTC (rev 51) @@ -27,15 +27,22 @@ class Stimulus(Generator): def __init__(self): self.activation = None - self.counter = 0 + self.stimulusTimes = [] + + def setStimulusTimes(self, stimulusTimes): + self.stimulusTimes = stimulusTimes def runGenerator(self, time): - if self.counter == 5: - self.activation = 'Stimulus' - self.counter = 0 - else: - self.activation = None - self.counter += 1 + 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.currentStimulus += 1 + + self.activation = 'Stimulus' + else: + self.activation = None + # The runGenerator method must return a value 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-03 10:32:46
|
Revision: 50 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=50&view=rev Author: rgoj Date: 2009-08-03 10:32:34 +0000 (Mon, 03 Aug 2009) Log Message: ----------- * Adding a new stimulus class which should be used from now on for any Stimulus reimplementation. Added Paths: ----------- trunk/src/Stimulus.py Added: trunk/src/Stimulus.py =================================================================== --- trunk/src/Stimulus.py (rev 0) +++ trunk/src/Stimulus.py 2009-08-03 10:32:34 UTC (rev 50) @@ -0,0 +1,41 @@ +# 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 Stimulus class is a child class of the Generatorc lass. It reimplements the +runGenerator method, so that a stimulus can be periodically sent to all +connected generators. +""" + +from Generator import Generator + +class Stimulus(Generator): + def __init__(self): + self.activation = None + self.counter = 0 + + def runGenerator(self, time): + if self.counter == 5: + self.activation = 'Stimulus' + self.counter = 0 + else: + self.activation = None + self.counter += 1 + + # The runGenerator method must return a value + 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-03 10:31:24
|
Revision: 49 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=49&view=rev Author: rgoj Date: 2009-08-03 10:31:15 +0000 (Mon, 03 Aug 2009) Log Message: ----------- * Removing old stimulus class, which won't be used any more. Removed Paths: ------------- trunk/src/GeneratorStimulusActivationZeroing.py Deleted: trunk/src/GeneratorStimulusActivationZeroing.py =================================================================== --- trunk/src/GeneratorStimulusActivationZeroing.py 2009-08-03 10:20:38 UTC (rev 48) +++ trunk/src/GeneratorStimulusActivationZeroing.py 2009-08-03 10:31:15 UTC (rev 49) @@ -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 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 GeneratorStimulusActivationZeroing class only keeps a counter to remember the number of times it was called. -""" - -from GeneratorDummy import GeneratorDummy - -class GeneratorStimulusActivationZeroing(GeneratorDummy): - 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 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |