ca.nengo.model.neuron.impl
Class SpikeGeneratorOrigin

java.lang.Object
  extended by ca.nengo.model.neuron.impl.SpikeGeneratorOrigin
All Implemented Interfaces:
Origin, java.io.Serializable, java.lang.Cloneable

public class SpikeGeneratorOrigin
extends java.lang.Object
implements Origin

An Origin that obtains output from an underlying SpikeGenerator. This is a good Origin to use as the main (axonal) output of a spiking neuron. This Origin may produce SpikeOutput or RealOutput depending on whether it is running in DEFAULT or CONSTANT_RATE SimulationMode.

Author:
Bryan Tripp
See Also:
Serialized Form

Constructor Summary
SpikeGeneratorOrigin(Node node, SpikeGenerator generator)
           
 
Method Summary
 Origin clone()
           
 int getDimensions()
           
 SpikeGenerator getGenerator()
           
 java.lang.String getName()
           
 Node getNode()
           
 InstantaneousOutput getValues()
          Returns spike values or real-valued spike rate values, depending on whether the mode is SimulationMode.DEFAULT or SimulationMode.CONSTANT_RATE.
 void run(float[] times, float[] current)
           
 void setMode(SimulationMode mode)
          Need this to fix bug where the generator's mode is changed, but myOutput is still of the type of the old mode
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpikeGeneratorOrigin

public SpikeGeneratorOrigin(Node node,
                            SpikeGenerator generator)
Parameters:
node - The parent Node
generator - The SpikeGenerator from which this Origin is to obtain output.
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in interface Origin
Returns:
Neuron.AXON
See Also:
Origin.getName()

getDimensions

public int getDimensions()
Specified by:
getDimensions in interface Origin
Returns:
1
See Also:
Origin.getDimensions()

run

public void run(float[] times,
                float[] current)
         throws SimulationException
Parameters:
times - Passed on to the run() or runConstantRate() method of the wrapped SpikeGenerator depending on whether the SimulationMode is DEFAULT or CONSTANT_RATE (in the latter case only the first value is used).
current - Passed on like the times argument.
Throws:
SimulationException - Arising From the underlying SpikeGenerator, or if the given times or values arrays have length 0 when in CONSTANT_RATE mode (the latter because the first entries must be extracted).

getValues

public InstantaneousOutput getValues()
Returns spike values or real-valued spike rate values, depending on whether the mode is SimulationMode.DEFAULT or SimulationMode.CONSTANT_RATE.

Specified by:
getValues in interface Origin
Returns:
Instantaneous output from this Origin.
See Also:
Origin.getValues()

getNode

public Node getNode()
Specified by:
getNode in interface Origin
Returns:
The Node to which the Origin belongs
See Also:
Origin.getNode()

getGenerator

public SpikeGenerator getGenerator()

setMode

public void setMode(SimulationMode mode)
Need this to fix bug where the generator's mode is changed, but myOutput is still of the type of the old mode

See Also:
SimulationMode.ModeConfigurable.setMode(ca.nengo.model.SimulationMode)

clone

public Origin clone()
             throws java.lang.CloneNotSupportedException
Specified by:
clone in interface Origin
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException