[Pybrainsim-activity] SF.net SVN: pybrainsim:[50] trunk/src/Stimulus.py
Status: Planning
Brought to you by:
rgoj
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. |