Implemented Observers

Common Parameters

Standard Observer

Standard observer

Basic one. This is the default observer, which opens when you double-click the name of a memory block. Shows all values as a grid of rectangles, where each element corresponds to one colour coded value. All values below MinValue are considered "negative" in following description.

Settings:

Plot Observer

Plot observer Plots data as a curve in time.

Settings:

Matrix Observer

Matrix observer Shows float values as a numbers in a grid

Settings:

Spike Observer

Spike observer

Shows values as spikes in time.

Settings:

Histogram Observer

Histogram observer

Shows histogram of values

Custom Observer Implementation

If a specific observer is needed for your node, you can implement one. The process is very similar to the task implementation except you will be deriving from the MyNodeObserver<> class.

public class MyTestObserver : MyNodeObserver<MyTestingNode>
{
  public MyTestObserver() //parameterless constructor
  {
    m_kernel = MyScheduler.Instance.KernelFactory.Kernel(“VisualizationKernel”);
    m_kernel.SetConstantVariable(“D_COLOR_FIRE”, 0xFFFFFC00);
    m_kernel.SetConstantVariable(“D_COLOR_DEAD”, 0xFFFFDDEE);
    m_kernel.SetConstantVariable(“D_COLOR_UNDEF”, 0xFF426639);
    m_kernel.SetConstantVariable(“D_N_AP_RESET”, 0xFF426639); //some global constants
  }

  protected override void Reset()
  {
    TextureWidth = Target.Output.ColumnHint;
    TextureHeight = Target.NeuronsCount / Target.Output.ColumnHint;
  }

  protected override void Execute()
  {
    m_kernel.SetupExecution(Target.NeuronsCount);

    m_kernel.Run(
      Target.Threshold,
      Target.ActionPotential,
      Target.NeuronLifePotential,
      Target.NeuronLastFired,
      VBODevicePointer,           //pixel memory you are going to write in
      Target.NeuronsCount
    );
  }
}

Practically, you will be implementing a kernel which transforms your node specific data into a set of pixels. Also notice this:

You need to override the Execute() method and the Reset() method. In Execute() you set and run your kernel. In Reset(), you set TextureWidth and TextureHeight parameters.

You should never call Reset() method directly. Instead, call TriggerReset() if you want the texture dimensions to be recalculated. Reset() will then be run automatically in next observer update (it's affected by the Report Interval described in UI).

Pass the VBODevicePointer to the kernel and write your pixel data into it.

Observers are run after the simulation step. Thanks to that, you don't have to e.g. SafeCopyToHost data if it's already there.

An OpenGL context associated with each observer is always located on the last installed GPU, and consequently, memory transfer may be needed every step. For this reason, try to limit data sent to the rendering kernel. Finally, you need to register the observer to your node. Put one additional line into the YourModule/conf/nodes.xml file:

<?xml version=”1.0″ encoding=”utf-8″ ?>
  <Configuration>
    <KnownNodes>
      <Node type=”YourModuleNamespace.Testing.MyNeuronsNode” CanBeAdded=”true” InputEnabled=”true” OutputEnabled=”true” BigIcon=”res\network_big.png” SmallIcon=”res\network.png”>
        <!– Add line like this –>
        <Observer type=”YourModuleNamespace.Testing.MyTestObserver”/>
      </Node>
      …
    </KnownNodes>
    …
  </Configuration>

After successful build, you should be able to add your observer through a menu located in the Node Property panel (see UI).