Nengo.ca

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.

See Also:
Serialized Form

Constructor Summary
SpikeGeneratorOrigin(Node node, SpikeGenerator generator)
           
 
Method Summary
 SpikeGeneratorOrigin clone()
           
 SpikeGeneratorOrigin clone(Ensemble e)
          Clone method that changes necessary parameters to point to a new parent, for use in cloning ensembles, etc.
 int getDimensions()
           
 SpikeGenerator getGenerator()
           
 java.lang.String getName()
           
 Node getNode()
           
 boolean getRequiredOnCPU()
           
 InstantaneousOutput getValues()
          Returns spike values or real-valued spike rate values, depending on whether the mode is SimulationMode.DEFAULT or SimulationMode.CONSTANT_RATE.
 void reset(boolean randomize)
           
 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
 void setName(java.lang.String name)
           
 void setRequiredOnCPU(boolean val)
           
 void setValues(InstantaneousOutput val)
           
 
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()

setName

public void setName(java.lang.String name)

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()

setValues

public void setValues(InstantaneousOutput val)
Specified by:
setValues in interface Origin

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()
Returns:
Spike generator

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

Parameters:
mode - Target simulation mode
See Also:
SimulationMode.ModeConfigurable.setMode(ca.nengo.model.SimulationMode)

clone

public SpikeGeneratorOrigin clone()
                           throws java.lang.CloneNotSupportedException
Specified by:
clone in interface Origin
Overrides:
clone in class java.lang.Object
Returns:
Valid clone
Throws:
java.lang.CloneNotSupportedException - if clone cannot be made

clone

public SpikeGeneratorOrigin clone(Ensemble e)
                           throws java.lang.CloneNotSupportedException
Description copied from interface: Origin
Clone method that changes necessary parameters to point to a new parent, for use in cloning ensembles, etc.

Specified by:
clone in interface Origin
Parameters:
e - New parent ensemble
Returns:
A clone of the origin for the new parent ensemble
Throws:
java.lang.CloneNotSupportedException - if clone cannot be made

setRequiredOnCPU

public void setRequiredOnCPU(boolean val)
Specified by:
setRequiredOnCPU in interface Origin

getRequiredOnCPU

public boolean getRequiredOnCPU()
Specified by:
getRequiredOnCPU in interface Origin

reset

public void reset(boolean randomize)

Nengo.ca