mosaic.sim.neuron.netinputs
Class TemporalCodedInput

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--mosaic.sim.kernel.AbstractModelComponent
                          |
                          +--mosaic.sim.kernel.BasicModel
                                |
                                +--mosaic.sim.neuron.netinputs.TemporalCodedInput
All Implemented Interfaces:
java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, mosaic.sim.kernel.ModelComponent, java.beans.PropertyChangeListener, java.io.Serializable, mosaic.sim.kernel.simevent.SimEventListener, mosaic.sim.kernel.simevent.TimeEventListener, mosaic.sim.kernel.variable.VariableChangeListener, VectorInputCoder

public class TemporalCodedInput
extends mosaic.sim.kernel.BasicModel
implements VectorInputCoder

This class implements a spike source using temporal coding. It is a converter between analog values at its input and spike events at its output. The coding is done as follows: The number of inputs (i.e. the length of the input vector) is equal to the number of outputs (inner NeuronOutput classes). The analog vector submitted to the class via the method enterVector() is converted to exactly one spike per output. The higher the analog input number, the earlier the spike on the associated output will be fired. Therefore the output associated to the analog input with the highest value will fire immediately, the other outputs will fire later, determined by "d * (maxValue - vector[i])". This class can optionally use a reference output that fires at the latest time, thus representing the analog input value "0" and marking the end of the spike series emitted by this class.

See Also:
Serialized Form

Inner Class Summary
protected  class TemporalCodedInput.Output
          This inner class implements the spike outputs of the TemporalCodedInput class.
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent, javax.swing.JComponent.ActionStandin, javax.swing.JComponent.IntVector, javax.swing.JComponent.KeyboardState
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.AWTTreeLock
 
Field Summary
protected  double lastStartTime
          In this variable, the last (absolute) time of starting an input event is stored (the simulation time when enterVector was called).
protected  double[] lastVector
          In this variable, the last input vector that was entered using this object is stored.
protected  double lastZeroTime
          In this variable, the end of the last input cycle (the absolute simulation time marking the input value 0) is stored.
protected  double multiplicator
          This value is uses for computing the delay between the first spike event and following spikes depending on the difference in the input values.
protected  java.util.ArrayList outputs
          The list of outputs that used for emitting spike events.
protected  TemporalCodedInput.Output reference
          The reference output, used optionally.
 
Fields inherited from class mosaic.sim.kernel.BasicModel
listenerVariables, priority, simEventComponents
 
Fields inherited from class mosaic.sim.kernel.AbstractModelComponent
application, components, enabled, label, parentModelComponent, sCESupport
 
Fields inherited from class javax.swing.JComponent
_bounds, accessibleContext, actionMap, ACTIONMAP_CREATED, alignmentX, alignmentY, ANCESTOR_INPUTMAP_CREATED, ANCESTOR_USING_BUFFER, ancestorInputMap, ancestorNotifier, autoscroller, border, changeSupport, clientProperties, CREATED_DOUBLE_BUFFER, flags, FOCUS_INPUTMAP_CREATED, focusInputMap, HAS_FOCUS, htmlKey, htmlView, inputVerifier, IS_DOUBLE_BUFFERED, IS_OPAQUE, IS_PAINTING_TILE, IS_PRINTING, IS_PRINTING_ALL, KEY_EVENTS_ENABLED, KEYBOARD_BINDINGS_KEY, listenerList, maximumSize, minimumSize, NEXT_FOCUS, paintImmediatelyClip, paintingChild, preferredSize, readObjectCallbacks, REQUEST_FOCUS_DISABLED, tmpRect, TOOL_TIP_TEXT_KEY, ui, uiClassID, UNDEFINED_CONDITION, verifyInputWhenFocusTarget, vetoableChangeSupport, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW, WHEN_IN_FOCUSED_WINDOW_BINDINGS, WIF_INPUTMAP_CREATED, windowInputMap
 
Fields inherited from class java.awt.Container
component, containerListener, containerSerializedDataVersion, dbg, dispatcher, layoutMgr, listeningBoundsChildren, listeningChildren, maxSize, ncomponents, printing, printingThreads, serialVersionUID
 
Fields inherited from class java.awt.Component
actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, privateKey, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowListenerK, x, y
 
Fields inherited from interface mosaic.sim.kernel.ModelComponent
INF, INFINITY, NEGATIVE_INFINITY, NEGINF, NEGINFINITY, POSITIVE_INFINITY
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
TemporalCodedInput(int num, double multiplicator, boolean useReferenceOutput)
          Creates a new TemporalCodedInput object and initializes the outputs.
 
Method Summary
 void enterVector(double[] vector)
          Enters a new analog input vector into the simulation.
 double getLastStartTime()
          Returns the time when the last event was started.
 double[] getLastVector()
          Returns the last input vector.
 double getLastZeroTime()
          Return the time when the last event should end (or has ended).
 double getMultiplicator()
          Returns the multiplicator.
 NeuronOutput getOutput(int index)
          Implementation of VectorInput.getOutput.
 NeuronOutput getReferenceOutput()
          Returns the reference output.
 
Methods inherited from class mosaic.sim.kernel.BasicModel
addListenerVariable, addSimEventComponent, addTimeEventComponent, getListenerVariables, getNthListenerVariable, getPriority, processSimEvent, propertyChange, removeListenerVariable, removeSimEventComponent, removeTimeEventComponent, setPriority, variableChange
 
Methods inherited from class mosaic.sim.kernel.AbstractModelComponent
addModelComponent, addModelComponentEventListener, addModelComponentEventListener, addNotify, containsModelComponent, disable, enable, findParentModelComponent, fireModelComponentAdded, fireModelComponentChanged, fireModelComponentChanged, fireModelComponentDisabled, fireModelComponentEnabled, fireModelComponentGotContinuous, fireModelComponentGotDiscrete, fireModelComponentRemoved, getInfo, getLabel, getMinimumSize, getModelComponents, getParentModelComponent, getPreferredSize, getSimApplication, getTime, initialize, isDisabled, isEnabled, paintComponent, printDebugOutput, printDebugOutput, printDebugOutput, printDebugOutput, printErrorOutput, printErrorOutput, printLogOutput, printLogOutput, removeModelComponent, removeModelComponentEventListener, removeModelComponentEventListener, removeNotify, reset, setEnabled, setLabel, setParentModelComponent, setSimApplication
 
Methods inherited from class javax.swing.JComponent
_paintImmediately, , addAncestorListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, adjustPaintFlags, alwaysOnTop, checkIfChildObscuredBySibling, clearFocusOwners, componentInputMapChanged, computeVisibleRect, computeVisibleRect, compWriteObjectNotify, contains, createToolTip, enableSerialization, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperties, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getCreatedDoubleBuffer, getDebugGraphicsOptions, getFlag, getGraphics, getHeight, getInputMap, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paintWithBuffer, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyBindings, processKeyBindingsForAllComponents, processKeyEvent, processMouseMotionEvent, putClientProperty, readObject, rectangleIsObscured, rectangleIsObscuredBySibling, registerKeyboardAction, registerKeyboardAction, registerWithKeyboardManager, registerWithKeyboardManager, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setCreatedDoubleBuffer, setDebugGraphicsOptions, setDoubleBuffered, setFlag, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPaintingChild, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, shouldDebugGraphics, superProcessMouseMotionEvent, unregisterKeyboardAction, unregisterWithKeyboardManager, unregisterWithKeyboardManager, update, updateUI, writeObject
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, adjustListeningChildren, applyOrientation, checkGD, countComponents, createChildHierarchyEvents, createHierarchyEvents, deliverEvent, dispatchEventImpl, dispatchEventToSelf, doLayout, eventEnabled, findComponentAt, findComponentAt, findComponentAt, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getLayout, getMouseEventTarget, getWindow, initIDs, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPaint, lightweightPrint, list, list, locate, minimumSize, nextFocus, numListening, paintComponents, paintHeavyweightComponents, postProcessKeyEvent, postsOldMouseEvents, preferredSize, preProcessKeyEvent, printComponents, printHeavyweightComponents, processContainerEvent, processEvent, proxyEnableEvents, proxyRequestFocus, remove, remove, removeAll, removeContainerListener, setFocusOwner, setLayout, transferFocus, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, areInputMethodsEnabled, bounds, checkImage, checkImage, checkWindowClosingException, coalesceEvents, constructComponentName, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getAccessibleIndexInParent, getAccessibleStateSet, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getToolkit, getToolkitImpl, getTreeLock, getWindowForObject, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabledImpl, isLightweight, isRecursivelyVisible, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resetGC, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

outputs

protected java.util.ArrayList outputs
The list of outputs that used for emitting spike events. The number of outputs is equal to the length of the input vector.

reference

protected TemporalCodedInput.Output reference
The reference output, used optionally.

multiplicator

protected double multiplicator
This value is uses for computing the delay between the first spike event and following spikes depending on the difference in the input values. It is just a multiplicator.

lastVector

protected double[] lastVector
In this variable, the last input vector that was entered using this object is stored.
See Also:
enterVector(double[])

lastStartTime

protected double lastStartTime
In this variable, the last (absolute) time of starting an input event is stored (the simulation time when enterVector was called).
See Also:
enterVector(double[])

lastZeroTime

protected double lastZeroTime
In this variable, the end of the last input cycle (the absolute simulation time marking the input value 0) is stored. If a reference input is used, then this is the time that the input has fired or will fire.
See Also:
enterVector(double[])
Constructor Detail

TemporalCodedInput

public TemporalCodedInput(int num,
                          double multiplicator,
                          boolean useReferenceOutput)
Creates a new TemporalCodedInput object and initializes the outputs.
Parameters:
num - The number of outputs, it must be equal to the length of the analog input vectors that will be given to enterVector().
multiplicator - Sets the proportionality factor d.
useReferenceOutput - When set to true, the class uses a reference output representing the analog input value "0".
Method Detail

enterVector

public void enterVector(double[] vector)
                 throws CodingException
Enters a new analog input vector into the simulation. This method computes the firing times of the spike events (one per output) and schedules them for firing.
Specified by:
enterVector in interface VectorInputCoder
Parameters:
vector - The input vector to be used, the length must be equal to "num" given to the constructor.

getOutput

public NeuronOutput getOutput(int index)
Implementation of VectorInput.getOutput.
Specified by:
getOutput in interface VectorInputCoder
Following copied from interface: mosaic.sim.neuron.netinputs.VectorInputCoder
Parameters:
index - The number of the output to return.

getReferenceOutput

public NeuronOutput getReferenceOutput()
Returns the reference output.

getLastVector

public double[] getLastVector()
Returns the last input vector.

getMultiplicator

public double getMultiplicator()
Returns the multiplicator.

getLastStartTime

public double getLastStartTime()
Returns the time when the last event was started.

getLastZeroTime

public double getLastZeroTime()
Return the time when the last event should end (or has ended).