[Pybrainsim-activity] SF.net SVN: pybrainsim:[8] trunk/src/Stimulus.py
Status: Planning
Brought to you by:
rgoj
From: <rg...@us...> - 2009-07-24 12:24:44
|
Revision: 8 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=8&view=rev Author: rgoj Date: 2009-07-24 12:24:38 +0000 (Fri, 24 Jul 2009) Log Message: ----------- * Added a Stimulus class inheriting from Generator, that keeps a count of how many times it was called Added Paths: ----------- trunk/src/Stimulus.py Added: trunk/src/Stimulus.py =================================================================== --- trunk/src/Stimulus.py (rev 0) +++ trunk/src/Stimulus.py 2009-07-24 12:24:38 UTC (rev 8) @@ -0,0 +1,38 @@ +# 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 Generator class. It reimplements the runGenerator method, so that a stimulus can be periodically sent to all connected generators. + +Currently the Stimulus class only keeps a counter to remember the number of times it was called. +""" + +class Stimulus(Generator): + def __init__(self): + self.output = 0 + self.counter = 0 + + def runGenerator(self): + if self.counter == 10: + self.counter = 0; + else: + self.counter += 1 + + return self.output This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |