ca.nengo.model.impl
Class EnsembleImpl
java.lang.Object
ca.nengo.model.impl.AbstractEnsemble
ca.nengo.model.impl.EnsembleImpl
- All Implemented Interfaces:
- Ensemble, ExpandableNode, Node, Probeable, Resettable, SimulationMode.ModeConfigurable, VisiblyMutable, java.io.Serializable, java.lang.Cloneable
- Direct Known Subclasses:
- PlasticEnsembleImpl
public class EnsembleImpl
- extends AbstractEnsemble
- implements ExpandableNode
Default implementation of Ensemble.
Origins or Terminations can be set up on Nodes before they are grouped into an
Ensemble. After Nodes are added to an Ensemble, no Origins or Terminations should
be added to them directly. Terminations can be added with EnsembleImpl.addTermination(...)
If a Termination is added directly to a Node after the Node is added to the
Ensemble, the Termination will not appear in Ensemble.getTerminations()
TODO: test
- See Also:
- Serialized Form
Methods inherited from class ca.nengo.model.impl.AbstractEnsemble |
addChangeListener, collectSpikes, findCommon1DOrigins, fireVisibleChangeEvent, getCollectSpikesRatio, getDocumentation, getHistory, getMode, getName, getNodes, getOrigin, getOrigins, getSpikePattern, isCollectingSpikes, listStates, redefineNodes, removeChangeListener, removeOrigin, run, setCollectSpikesRatio, setDocumentation, setName, setSpikePattern, stopProbing |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
myExpandableNodes
protected ExpandableNode[] myExpandableNodes
myExpandedTerminations
protected java.util.Map<java.lang.String,Termination> myExpandedTerminations
EnsembleImpl
public EnsembleImpl(java.lang.String name,
Node[] nodes)
- Parameters:
name
- Name of Ensemblenodes
- Nodes that make up the Ensemble
EnsembleImpl
public EnsembleImpl(java.lang.String name,
NodeFactory factory,
int n)
throws StructuralException
- Parameters:
name
- Name of Ensemblefactory
- Factory class that will create nodesn
- Number of nodes to create
- Throws:
StructuralException
- if any problem halts construction
getTermination
public Termination getTermination(java.lang.String name)
throws StructuralException
- Specified by:
getTermination
in interface Node
- Overrides:
getTermination
in class AbstractEnsemble
- Parameters:
name
- Name of a Termination onto this Node
- Returns:
- The named Termination if it exists
- Throws:
StructuralException
- if the named Termination does not exist- See Also:
Node.getTermination(java.lang.String)
getTerminations
public Termination[] getTerminations()
- Specified by:
getTerminations
in interface Node
- Overrides:
getTerminations
in class AbstractEnsemble
- Returns:
- Sets of input channels (these have the same dimension as corresponding Origins
to which they are connected).
- See Also:
Node.getTerminations()
setMode
public void setMode(SimulationMode mode)
- This Ensemble does not support SimulationMode.DIRECT.
- Specified by:
setMode
in interface SimulationMode.ModeConfigurable
- Overrides:
setMode
in class AbstractEnsemble
- Parameters:
mode
- SimulationMode in which it is desired that the object runs.- See Also:
SimulationMode.ModeConfigurable.setMode(ca.nengo.model.SimulationMode)
addTermination
public Termination addTermination(java.lang.String name,
float[][] weights,
float tauPSC,
boolean modulatory)
throws StructuralException
- Description copied from interface:
ExpandableNode
- Adds a new Termination onto this Node.
- Specified by:
addTermination
in interface ExpandableNode
- Parameters:
weights
- Each row is used as a 1 by m matrix of weights in a new termination on the nth expandable nodename
- Unique name for the Termination (in the scope of this 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:
- resulting Termination
- Throws:
StructuralException
- if length of weights doesn't equal getDimension(),
or if there are different numbers of weights given in different rows.- See Also:
ExpandableNode.addTermination(java.lang.String, float[][], float, boolean)
removeTermination
public Termination removeTermination(java.lang.String name)
throws StructuralException
- Specified by:
removeTermination
in interface ExpandableNode
- Overrides:
removeTermination
in class AbstractEnsemble
- Parameters:
name
- Name of the Termination to remove from the ensemble
- Returns:
- the removed Termination object
- Throws:
StructuralException
- if Termination does not exist- See Also:
ExpandableNode.removeTermination(java.lang.String)
getDimension
public int getDimension()
- Specified by:
getDimension
in interface ExpandableNode
- Returns:
- Output dimension of Terminations onto this Node
- See Also:
ExpandableNode.getDimension()
clone
public EnsembleImpl clone()
throws java.lang.CloneNotSupportedException
- Specified by:
clone
in interface ExpandableNode
- Specified by:
clone
in interface Node
- Overrides:
clone
in class AbstractEnsemble
- Returns:
- An independent copy of the Node
- Throws:
java.lang.CloneNotSupportedException
- if clone can't be made
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 AbstractEnsemble
- 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)
getChildren
public Node[] getChildren()
- Specified by:
getChildren
in interface Node
toScript
public java.lang.String toScript(java.util.HashMap<java.lang.String,java.lang.Object> scriptData)
throws ScriptGenException
- Specified by:
toScript
in interface Node
- 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