Nengo.ca

ca.nengo.model.nef.impl
Class NEFEnsembleImpl

java.lang.Object
  extended by ca.nengo.model.impl.AbstractEnsemble
      extended by ca.nengo.model.impl.EnsembleImpl
          extended by ca.nengo.model.plasticity.impl.PlasticEnsembleImpl
              extended by ca.nengo.model.nef.impl.DecodableEnsembleImpl
                  extended by ca.nengo.model.nef.impl.NEFEnsembleImpl
All Implemented Interfaces:
Ensemble, ExpandableNode, DecodableEnsemble, NEFEnsemble, Node, PlasticEnsemble, Probeable, Resettable, SimulationMode.ModeConfigurable, TaskSpawner, VisiblyMutable, java.io.Serializable, java.lang.Cloneable

public class NEFEnsembleImpl
extends DecodableEnsembleImpl
implements NEFEnsemble

Default implementation of NEFEnsemble. TODO: links to NEF documentation TODO: test

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface ca.nengo.util.VisiblyMutable
VisiblyMutable.Event, VisiblyMutable.Listener, VisiblyMutable.NameChangeEvent, VisiblyMutable.NodeRemovedEvent
 
Field Summary
static java.lang.String BIAS_SUFFIX
          Append to bias termination names
static java.lang.String INTERNEURON_SUFFIX
          Append to interneuron names
 
Fields inherited from class ca.nengo.model.nef.impl.DecodableEnsembleImpl
myDecodedOrigins, myDecodedTerminations
 
Fields inherited from class ca.nengo.model.plasticity.impl.PlasticEnsembleImpl
myPlasticEnsembleTerminations
 
Fields inherited from class ca.nengo.model.impl.EnsembleImpl
myExpandableNodes, myExpandedTerminations
 
Fields inherited from interface ca.nengo.model.nef.NEFEnsemble
X
 
Constructor Summary
NEFEnsembleImpl(java.lang.String name, NEFNode[] nodes, float[][] encoders, ApproximatorFactory factory, float[][] evalPoints, float[] radii)
           
 
Method Summary
 BiasOrigin addBiasOrigin(Origin existing, int numInterneurons, java.lang.String name, boolean excitatory)
          Adds a BiasOrigin, which operates in parallel with an existing Origin, such that the effective weights of the two origins together are all of the same sign (as is normally the case with synaptic weights in the brain).
 BiasTermination[] addBiasTerminations(DecodedTermination baseTermination, float interneuronTauPSC, float[][] biasDecoders, float[][] functionDecoders)
          Adds BiasTerminations, which are meant to receive projections from BiasOrigins.
 Origin addDecodedOrigin(DecodedOrigin o)
          Adds the given DecodedOrigin to this ensemble.
 Origin addDecodedOrigin(java.lang.String name, Function[] functions, java.lang.String nodeOrigin)
          Adds an Origin that corresponds to a decoding of the activities of Nodes in this Ensemble.
 Origin addDecodedSignalOrigin(java.lang.String name, TimeSeries targetSignal, TimeSeries[] evalSignals, java.lang.String nodeOrigin)
          Similar to addDecodedOrigin, but uses a target signal and evaluation signals (over time) rather than a target function and evaluation points.
 Termination addDecodedTermination(java.lang.String name, float[][] matrix, float[] tfNumerator, float[] tfDenominator, float passthrough, boolean isModulatory)
          As above but with arbitrary single-input-single-output PSC dynamics.
 Termination addDecodedTermination(java.lang.String name, float[][] matrix, float tauPSC, boolean isModulatory)
          Adds a new Termination into this Ensemble, at which information is to be received in the form of decoded state variables rather than spikes, etc.
 Termination addPESTermination(java.lang.String name, float[][] weights, float tauPSC, boolean modulatory)
           
 Termination addPreLearnTermination(java.lang.String name, float[][] weights, float tauPSC, boolean modulatory)
           
 NEFEnsembleImpl clone()
           
 void fixMode()
          When this method is called, the mode of this node is fixed and cannot be changed by subsequent setMode(...) calls.
protected  float[] getConstantOutput(int nodeIndex, float[][] evalPoints, java.lang.String origin)
           
protected  float[][] getConstantOutputs(float[][] evalPoints, java.lang.String origin)
           
 int getDimension()
           
 DynamicalSystem getDirectModeDynamics()
           
 Integrator getDirectModeIntegrator()
           
 float[][] getEncoders()
           
 NEFEnsembleFactory getEnsembleFactory()
           
 float[][] getEvalPoints()
           
 boolean getModeFixed()
           
 int getNeuronCount()
           
 int getNeurons()
           
 int getNodeCount()
           
 float getRadialInput(float[] state, int node)
           
 float[] getRadii()
           
 boolean getReuseApproximators()
           
protected  float[][] getSignalOutput(int nodeIndex, TimeSeries[] evalSignals, java.lang.String origin)
          Similar to getConstantOutput, but uses a time series as input to each neuron rather than a single point.
protected  float[][][] getSignalOutputs(TimeSeries[] evalSignals, java.lang.String origin)
          Similar to getConstantOutputs, but uses a time series as input to each neuron rather than a single point.
 float[] getStaticNeuronData()
          Used to get static neuron data (data that doesn't change each step) and give it to the GPU.
 boolean getUseGPU()
           
 void killNeurons(float killrate, boolean saveRelays)
          Stops a given percentage of neurons in this population from firing.
 java.util.Properties listStates()
           
 void releaseMemory()
          Releases any memory that can be freed.
 void reset(boolean randomize)
          Resets each Node in this Ensemble.
 void run(float startTime, float endTime)
          Runs each neuron in the Ensemble.
 void setDirectModeDynamics(DynamicalSystem dynamics)
           
 void setDirectModeIntegrator(Integrator integrator)
           
 void setEncoders(float[][] encoders)
           
 void setEnsembleFactory(NEFEnsembleFactory factory)
          Gives the ensemble a reference to the factory used to created it (useful for adding more neurons later)
 void setEvalPoints(float[][] evalPoints)
          Note: by-products of decoding are sometimes cached, so if these are changed it may be necessary to call setReuseApproximators(false) for the change to take effect.
 void setMode(SimulationMode mode)
          This Ensemble does not support SimulationMode.DIRECT.
 void setNeurons(int count)
          TODO: figure out why I have to add these so that it will show up in the Configure menu (nodeCount doens't appear for some reason)
 void setNodeCount(int n)
           
 void setRadii(float[] radii)
           
 void setReuseApproximators(boolean reuse)
           
 void setUseGPU(boolean use)
           
 java.lang.String toScript(java.util.HashMap<java.lang.String,java.lang.Object> scriptData)
           
 
Methods inherited from class ca.nengo.model.nef.impl.DecodableEnsembleImpl
addDecodedOrigin, addDecodedOrigin, addDecodedOrigin, doneOrigins, getApproximatorFactory, getDecodedOrigins, getDecodedTerminations, getHistory, getOrigin, getOrigins, getTermination, getTerminations, removeDecodedOrigin, removeDecodedTermination, setTime, stopProbing
 
Methods inherited from class ca.nengo.model.plasticity.impl.PlasticEnsembleImpl
addTasks, getLearning, getPlasticityInterval, getTasks, isPopulationPlastic, setLearning, setPlasticityInterval, setStates, setTasks
 
Methods inherited from class ca.nengo.model.impl.EnsembleImpl
addTermination, getChildren, removeTermination
 
Methods inherited from class ca.nengo.model.impl.AbstractEnsemble
addChangeListener, collectSpikes, findCommon1DOrigins, fireVisibleChangeEvent, getCollectSpikesRatio, getDocumentation, getMode, getName, getNodes, getSpikePattern, isCollectingSpikes, redefineNodes, removeChangeListener, removeOrigin, setCollectSpikesRatio, setDocumentation, setName, setSpikePattern
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ca.nengo.model.nef.DecodableEnsemble
addDecodedOrigin, addDecodedOrigin, doneOrigins, removeDecodedOrigin, removeDecodedTermination
 
Methods inherited from interface ca.nengo.model.plasticity.PlasticEnsemble
getPlasticityInterval, setPlasticityInterval
 
Methods inherited from interface ca.nengo.model.Ensemble
collectSpikes, getNodes, getSpikePattern, isCollectingSpikes, redefineNodes, stopProbing
 
Methods inherited from interface ca.nengo.model.Node
getChildren, getDocumentation, getName, getOrigin, getOrigins, getTermination, getTerminations, setDocumentation, setName
 
Methods inherited from interface ca.nengo.model.SimulationMode.ModeConfigurable
getMode
 
Methods inherited from interface ca.nengo.util.VisiblyMutable
addChangeListener, removeChangeListener
 
Methods inherited from interface ca.nengo.model.Probeable
getHistory
 

Field Detail

BIAS_SUFFIX

public static java.lang.String BIAS_SUFFIX
Append to bias termination names


INTERNEURON_SUFFIX

public static java.lang.String INTERNEURON_SUFFIX
Append to interneuron names

Constructor Detail

NEFEnsembleImpl

public NEFEnsembleImpl(java.lang.String name,
                       NEFNode[] nodes,
                       float[][] encoders,
                       ApproximatorFactory factory,
                       float[][] evalPoints,
                       float[] radii)
                throws StructuralException
Parameters:
name - Unique name of Ensemble
nodes - Nodes that make up the Ensemble
encoders - List of encoding vectors (one for each node). All must have same length
factory - Source of LinearApproximators to use in decoding output
evalPoints - Vector inputs at which output is found to produce DecodedOrigins
radii - Radius for each dimension
Throws:
StructuralException - if there are a different number of Nodes than encoding vectors or if not all encoders have the same length
Method Detail

getRadii

public float[] getRadii()
Specified by:
getRadii in interface NEFEnsemble
Returns:
Radius of encoded region in each dimension
See Also:
NEFEnsemble.getRadii()

setUseGPU

public void setUseGPU(boolean use)
Parameters:
use - Use GPU?

getUseGPU

public boolean getUseGPU()
Returns:
Using GPU?

setRadii

public void setRadii(float[] radii)
              throws StructuralException
Parameters:
radii - A list of radii of encoded area along each dimension; uniform radius along each dimension can be specified with a list of length 1
Throws:
StructuralException - if getConstantOutputs throws exception

setEvalPoints

public void setEvalPoints(float[][] evalPoints)
Note: by-products of decoding are sometimes cached, so if these are changed it may be necessary to call setReuseApproximators(false) for the change to take effect.

Parameters:
evalPoints - Points in the encoded space at which node outputs are evaluated for establishing new DecodedOrigins.

getEvalPoints

public float[][] getEvalPoints()
Returns:
a copy of the evaluation points

setDirectModeDynamics

public void setDirectModeDynamics(DynamicalSystem dynamics)
Parameters:
dynamics - DynamicalSystem that models internal neuron dynamics at the ensemble level, when the ensemble runs in direct mode. The input and output dimensions must equal the dimension of the ensemble.

getDirectModeDynamics

public DynamicalSystem getDirectModeDynamics()
Returns:
Dynamics that apply in direct mode

getDirectModeIntegrator

public Integrator getDirectModeIntegrator()
Returns:
Integrator used in direct mode

setDirectModeIntegrator

public void setDirectModeIntegrator(Integrator integrator)
Parameters:
integrator - Integrator to use in direct mode

getConstantOutputs

protected float[][] getConstantOutputs(float[][] evalPoints,
                                       java.lang.String origin)
                                throws StructuralException
Parameters:
evalPoints - Vector points at which to find output (each one must have same dimension as encoder)
origin - Name of Origin from which to collect output for each Node
Returns:
Output of each Node at each evaluation point (1st dimension corresponds to Node)
Throws:
StructuralException - If CONSTANT_RATE is not supported by any Node

getConstantOutput

protected float[] getConstantOutput(int nodeIndex,
                                    float[][] evalPoints,
                                    java.lang.String origin)
                             throws StructuralException,
                                    SimulationException
Parameters:
nodeIndex - Index of Node for which to find output at various inputs
evalPoints - Vector points at which to find output (each one must have same dimension as encoder)
origin - Name of Origin from which to collect output
Returns:
Output of indexed Node at each evaluation point
Throws:
StructuralException - If CONSTANT_RATE is not supported by the given Node
SimulationException - If the Node does not have an Origin with the given name

getSignalOutputs

protected float[][][] getSignalOutputs(TimeSeries[] evalSignals,
                                       java.lang.String origin)
                                throws StructuralException
Similar to getConstantOutputs, but uses a time series as input to each neuron rather than a single point.

Parameters:
evalPoints - Signals over which to evaluate outputs. Each signal can have dimension equal to the number of nodes in the population (each dimension is the input to one node), or dimension equal to the dimension of this population (a single input for the whole population).
origin - Name of Origin from which to collect output for each Node
Returns:
Output of each Node over each evaluation signal (1st dimension corresponds to Node, 2nd to signal, 3rd to time)
Throws:
StructuralException - If RATE is not supported by any Node

getSignalOutput

protected float[][] getSignalOutput(int nodeIndex,
                                    TimeSeries[] evalSignals,
                                    java.lang.String origin)
                             throws StructuralException,
                                    SimulationException
Similar to getConstantOutput, but uses a time series as input to each neuron rather than a single point.

Parameters:
nodeIndex - Index of Node for which to find output at various inputs
evalPoints - Signals over which to evaluate outputs. Each signal can have dimension equal to the number of nodes in the population (each dimension is the input to one node), or dimension equal to the dimension of this population (a single input for the whole population).
origin - Name of Origin from which to collect output
Returns:
Output of indexed Node over each evaluation signal.
Throws:
StructuralException - If RATE is not supported by the given Node
SimulationException - If the Node does not have an Origin with the given name

getDimension

public int getDimension()
Specified by:
getDimension in interface ExpandableNode
Specified by:
getDimension in interface NEFEnsemble
Overrides:
getDimension in class EnsembleImpl
Returns:
Output dimension of Terminations onto this Node
See Also:
NEFEnsemble.getDimension()

getEncoders

public float[][] getEncoders()
Specified by:
getEncoders in interface NEFEnsemble
Returns:
List of encoders for each Node (each item is the encoding vector for a Node).
See Also:
NEFEnsemble.getEncoders()

setEncoders

public void setEncoders(float[][] encoders)
Parameters:
encoders - New encoding vectors (row per Node)

getReuseApproximators

public boolean getReuseApproximators()
Returns:
True if LinearApproximators for a Node Origin are re-used for decoding multiple decoded Origins.

setReuseApproximators

public void setReuseApproximators(boolean reuse)
Parameters:
reuse - True if LinearApproximators for a Node Origin are re-used for decoding multiple decoded Origins.

addDecodedOrigin

public Origin addDecodedOrigin(java.lang.String name,
                               Function[] functions,
                               java.lang.String nodeOrigin)
                        throws StructuralException
Description copied from interface: NEFEnsemble
Adds an Origin that corresponds to a decoding of the activities of Nodes in this Ensemble.

Specified by:
addDecodedOrigin in interface NEFEnsemble
Parameters:
name - Name of decoding
functions - Functions that define the decoding (one function for each dimension of output). All functions must have an input dimension equal to the dimension of this NEFEnsemble.
nodeOrigin - Name of the Node-level Origins from which this Ensemble-level Origin is derived (often Neuron.AXON)
Returns:
The added Origin
Throws:
StructuralException - if functions do not all have the same input dimension as the dimension of this ensemble
See Also:
NEFEnsemble.addDecodedOrigin(java.lang.String, Function[], String)

addDecodedSignalOrigin

public Origin addDecodedSignalOrigin(java.lang.String name,
                                     TimeSeries targetSignal,
                                     TimeSeries[] evalSignals,
                                     java.lang.String nodeOrigin)
                              throws StructuralException
Similar to addDecodedOrigin, but uses a target signal and evaluation signals (over time) rather than a target function and evaluation points.

Parameters:
name - Name of origin
targetSignal - signal that the origin should produce
evalSignals - evaluation signals used to calculate decoders
nodeOrigin - origin from which to draw output from each node
Returns:
the new DecodedOrigin created
Throws:
StructuralException

addDecodedOrigin

public Origin addDecodedOrigin(DecodedOrigin o)
Adds the given DecodedOrigin to this ensemble.

Parameters:
o - the origin to be added
Returns:
the new origin

addBiasOrigin

public BiasOrigin addBiasOrigin(Origin existing,
                                int numInterneurons,
                                java.lang.String name,
                                boolean excitatory)
                         throws StructuralException
Description copied from interface: NEFEnsemble
Adds a BiasOrigin, which operates in parallel with an existing Origin, such that the effective weights of the two origins together are all of the same sign (as is normally the case with synaptic weights in the brain). TODO: with a little work this could be pushed up to DecodableEnsemble (have to generalize constant-rate responses)

Specified by:
addBiasOrigin in interface NEFEnsemble
Parameters:
existing - An existing Origin on this NEFEnsemble
numInterneurons - Number of interneurons
name - Name of BiasOrigin (name of associated interneuron ensemble is also derived from this)
excitatory - If true, effective weights will be positive; if false they will be negative (inhibitory)
Returns:
Resulting BiasOrigin
Throws:
StructuralException - if given Origin is not a DecodedOrigin or if there is a construction problem
See Also:
NEFEnsemble.addBiasOrigin(ca.nengo.model.Origin, int, java.lang.String, boolean)

addDecodedTermination

public Termination addDecodedTermination(java.lang.String name,
                                         float[][] matrix,
                                         float tauPSC,
                                         boolean isModulatory)
                                  throws StructuralException
Description copied from interface: NEFEnsemble
Adds a new Termination into this Ensemble, at which information is to be received in the form of decoded state variables rather than spikes, etc.

Specified by:
addDecodedTermination in interface NEFEnsemble
Overrides:
addDecodedTermination in class DecodableEnsembleImpl
Parameters:
name - Unique name for this Termination (in the scope of this Ensemble)
matrix - Transformation matrix which defines a linear map on incoming information, onto the space of vectors that can be represented by this NEFEnsemble. The first dimension is taken as matrix rows, and must have the same length as the Origin that will be connected to this Termination. The second dimension is taken as matrix columns, and must have the same length as the encoders of this NEFEnsemble. TODO: this is transposed?
tauPSC - Time constant of post-synaptic current decay (all Terminations have this property but it may have slightly different interpretations depending other properties of the Termination).
isModulatory - If true, inputs to this Termination do not drive Nodes in the Ensemble directly but may have modulatory influences (eg related to plasticity). If false, the transformation matrix output dimension must match the dimension of this Ensemble.
Returns:
Added Termination
Throws:
StructuralException - if termination name is taken
See Also:
NEFEnsemble.addDecodedTermination(java.lang.String, float[][], float, boolean)

addDecodedTermination

public Termination addDecodedTermination(java.lang.String name,
                                         float[][] matrix,
                                         float[] tfNumerator,
                                         float[] tfDenominator,
                                         float passthrough,
                                         boolean isModulatory)
                                  throws StructuralException
Description copied from interface: NEFEnsemble
As above but with arbitrary single-input-single-output PSC dynamics.

Specified by:
addDecodedTermination in interface NEFEnsemble
Overrides:
addDecodedTermination in class DecodableEnsembleImpl
Parameters:
name - Unique name for this Termination (in the scope of this Ensemble)
matrix - Transformation matrix which defines a linear map on incoming information, onto the space of vectors that can be represented by this NEFEnsemble. The first dimension is taken as matrix rows, and must have the same length as the Origin that will be connected to this Termination. The second dimension is taken as matrix columns, and must have the same length as the encoders of this NEFEnsemble. TODO: this is transposed?
tfNumerator - Coefficients of transfer function numerator (see CanonicalModel.getRealization(...) for details)
tfDenominator - Coefficients of transfer function denominator
passthrough - How much should pass through?
isModulatory - Is the termination modulatory?
Returns:
The added Termination
Throws:
StructuralException - if termination name is taken
See Also:
NEFEnsemble.addDecodedTermination(java.lang.String, float[][], float[], float[], float, boolean)

addPESTermination

public Termination addPESTermination(java.lang.String name,
                                     float[][] weights,
                                     float tauPSC,
                                     boolean modulatory)
                              throws StructuralException
Parameters:
name - Unique name for the Termination (in the scope of this Node)
weights - Each row is used as a 1 by m matrix of weights in a new termination on the nth expandable node
tauPSC - Time constant with which incoming signals are filtered. (All Terminations have this property, but it may have slightly different interpretations per implementation.)
modulatory - If true, inputs to the Termination are not summed with other inputs (they only have modulatory effects, eg on plasticity, which must be defined elsewhere).
Returns:
Termination that was added
Throws:
StructuralException - if weight matrix dimensionality is incorrect
See Also:
ExpandableNode.addTermination(java.lang.String, float[][], float, boolean)

addPreLearnTermination

public Termination addPreLearnTermination(java.lang.String name,
                                          float[][] weights,
                                          float tauPSC,
                                          boolean modulatory)
                                   throws StructuralException
Throws:
StructuralException

addBiasTerminations

public BiasTermination[] addBiasTerminations(DecodedTermination baseTermination,
                                             float interneuronTauPSC,
                                             float[][] biasDecoders,
                                             float[][] functionDecoders)
                                      throws StructuralException
Description copied from interface: NEFEnsemble
Adds BiasTerminations, which are meant to receive projections from BiasOrigins. A pair of BiasTerminations is returned, one to receive a projection directly from a BiasOrigin, and the other to receive a projection indirectly through an ensemble of interneurons that is associated with the BiasOrigin.

Specified by:
addBiasTerminations in interface NEFEnsemble
Parameters:
baseTermination - The Termination that is to be biased (so that projections to it consist of weights of a single sign)
interneuronTauPSC - Time constant of post-synaptic current decay of inhibitory termination from interneurons onto this ensemble
biasDecoders - The decoding weights of the associated BiasOrigin
functionDecoders - The decoding vectors of the BiasOrigin's associated base origin
Returns:
A pair of BiasTerminations: the first is to receive direct input from a BiasOrigin and the second is to receive input from the interneuron ensemble associated with the BiasOrigin (see BiasOrigin.getInterneurons())
Throws:
StructuralException - if can't be added
See Also:
NEFEnsemble.addBiasTerminations(ca.nengo.model.nef.impl.DecodedTermination, float, float[][], float[][])

run

public void run(float startTime,
                float endTime)
         throws SimulationException
Description copied from class: AbstractEnsemble
Runs each neuron in the Ensemble.

Specified by:
run in interface Node
Overrides:
run in class DecodableEnsembleImpl
Parameters:
startTime - simulation time at which running starts (s)
endTime - simulation time at which running ends (s)
Throws:
SimulationException - if a problem is encountered while trying to run
See Also:
Node.run(float, float)

getRadialInput

public float getRadialInput(float[] state,
                            int node)
Parameters:
state - State vector
node - Node number
Returns:
Radial input to the given node

setMode

public void setMode(SimulationMode mode)
Description copied from class: EnsembleImpl
This Ensemble does not support SimulationMode.DIRECT.

Specified by:
setMode in interface SimulationMode.ModeConfigurable
Overrides:
setMode in class EnsembleImpl
Parameters:
mode - SimulationMode in which it is desired that the object runs.
See Also:
SimulationMode.ModeConfigurable.setMode(ca.nengo.model.SimulationMode)

fixMode

public void fixMode()
When this method is called, the mode of this node is fixed and cannot be changed by subsequent setMode(...) calls.


getModeFixed

public boolean getModeFixed()
Returns:
whether or not the mode for this ensemble has been fixed

reset

public void reset(boolean randomize)
Description copied from class: AbstractEnsemble
Resets each Node in this Ensemble.

Specified by:
reset in interface Resettable
Overrides:
reset in class DecodableEnsembleImpl
Parameters:
randomize - True indicates that the object should be reset to a randomly selected initial state (the object must be aware of the distribution from which to draw from). False indicates that the object should be reset to a fixed initial state (which it must also know). Some objects may not support randomization of the initial state, in which case a fixed state will be used in either case.
See Also:
Resettable.reset(boolean)

setEnsembleFactory

public void setEnsembleFactory(NEFEnsembleFactory factory)
Description copied from interface: NEFEnsemble
Gives the ensemble a reference to the factory used to created it (useful for adding more neurons later)

Specified by:
setEnsembleFactory in interface NEFEnsemble
Parameters:
factory - Factory that created the ensemble

getEnsembleFactory

public NEFEnsembleFactory getEnsembleFactory()
Specified by:
getEnsembleFactory in interface NEFEnsemble
Returns:
Factory that created the ensemble

getNodeCount

public int getNodeCount()
Specified by:
getNodeCount in interface NEFEnsemble
Returns:
Current number of neurons

getNeuronCount

public int getNeuronCount()
Returns:
number of neurons (same as getNodeCount)

setNodeCount

public void setNodeCount(int n)
                  throws StructuralException
Specified by:
setNodeCount in interface NEFEnsemble
Parameters:
n - number of desired neurons
Throws:
StructuralException - if we can't add them or there is no factory

listStates

public java.util.Properties listStates()
Specified by:
listStates in interface Probeable
Overrides:
listStates in class DecodableEnsembleImpl
Returns:
List of state variable names, eg "V", and associated descriptions eg "membrane potential (mV)"
See Also:
Probeable.listStates()

toScript

public java.lang.String toScript(java.util.HashMap<java.lang.String,java.lang.Object> scriptData)
                          throws ScriptGenException
Specified by:
toScript in interface Node
Overrides:
toScript in class EnsembleImpl
Parameters:
scriptData - Map of class parent and prefix data for generating python script
Returns:
Python script for generating the node
Throws:
ScriptGenException - if the node cannot be generated in script

clone

public NEFEnsembleImpl clone()
                      throws java.lang.CloneNotSupportedException
Specified by:
clone in interface ExpandableNode
Specified by:
clone in interface Node
Overrides:
clone in class DecodableEnsembleImpl
Returns:
An independent copy of the Node
Throws:
java.lang.CloneNotSupportedException - if clone can't be made

releaseMemory

public void releaseMemory()
Releases any memory that can be freed. Should be called after all origins are created for this ensemble

Specified by:
releaseMemory in interface NEFEnsemble

setNeurons

public void setNeurons(int count)
                throws StructuralException
TODO: figure out why I have to add these so that it will show up in the Configure menu (nodeCount doens't appear for some reason)

Parameters:
count - number of desired neurons
Throws:
StructuralException - if factory doesn't exist or can't add that many

getNeurons

public int getNeurons()
Returns:
number of neurons

getStaticNeuronData

public float[] getStaticNeuronData()
Used to get static neuron data (data that doesn't change each step) and give it to the GPU. Data is returned in an array. neuronData[0] = numNeurons neuronData[1] = tauRC neuronData[2] = tauRef neuronData[3] = tauPSC neuronData[4] = maxTimeStep neuronData[5 ... 4 + numNeurons] = bias for each neuron neuronData[5 + numNeurons ... 4 + 2 * numNeurons] = scale for each neuron

Returns:
[numNeurons, tauRC, taurRef, tauPSC, maxTimeStep, bias*, scale*]

killNeurons

public void killNeurons(float killrate,
                        boolean saveRelays)
Stops a given percentage of neurons in this population from firing.

Parameters:
killrate - the percentage of neurons to stop firing
saveRelays - if true, do nothing if there is only one node in this population

Nengo.ca