Package ca.nengo.util.impl

Examples of ca.nengo.util.impl.SpikePatternImpl


    TestUtil.assertClose(imported[0][1], filtered.getValues()[0][0], .0001f);
    TestUtil.assertClose(imported[0][2], filtered.getValues()[0][1], .0001f);
  }

  public void testExportSpikePatternFile() throws IOException {
    SpikePatternImpl pattern = new SpikePatternImpl(2);
    pattern.addSpike(0, 1);
    pattern.addSpike(0, 2);
    pattern.addSpike(1, 3);
    pattern.addSpike(1, 4);
    pattern.addSpike(1, 5);

    myExporter.export(pattern, myFile);
    float[][] imported = myExporter.importAsMatrix(myFile);
    TestUtil.assertClose(imported[0][0], 1, .0001f);
    TestUtil.assertClose(imported[0][1], 2, .0001f);
View Full Code Here


  /*
   * Test method for 'ca.nengo.model.impl.SpikePatternImpl.getNumNeurons()'
   */
  public void testGetNumNeurons() {
    SpikePatternImpl sp = new SpikePatternImpl(10);
    assertEquals(10, sp.getNumNeurons());
  }
View Full Code Here

  /*
   * Test method for 'ca.nengo.model.impl.SpikePatternImpl.getSpikeTimes(int)'
   */
  public void testGetSpikeTimes() {
   
    SpikePatternImpl sp = new SpikePatternImpl(2);
   
    for (int i = 0; i < 150; i++) { //important to test more than initial buffer size of 100
      if (i < 50) sp.addSpike(0, (float) i);
      sp.addSpike(1, (float) i);
    }
   
    assertEquals(50, sp.getSpikeTimes(0).length);
    assertEquals(150, sp.getSpikeTimes(1).length);
   
    float[] times = sp.getSpikeTimes(1);
    for (int i = 0; i < times.length; i++) {
      assertTrue(times[i] > (float) i - .0001f);
      assertTrue(times[i] < (float) i + .0001f);
    }
  }
View Full Code Here

    valuesT[1] = MU.makeVector(1.1f, .1f, 2);
    valuesT[2] = MU.makeVector(2.1f, .1f, 3);
    Units[] units = new Units[]{Units.ACU, Units.AVU, Units.M};
    myOriginalSeries = new TimeSeriesImpl(times, MU.transpose(valuesT), units);
   
    SpikePatternImpl pattern = new SpikePatternImpl(10);
    for (int i = 0; i < 10; i++) {
      for (int j = 0; j < i; j++) {
        pattern.addSpike(i, j);
      }
    }
    myOriginalPattern = pattern;
   
    myTolerance = .00001f;
View Full Code Here

   * @param pattern Any SpikePattern
   * @param indices Indices of neurons in original pattern from which to extract spikes
   * @return Spikes from selected neurons in the original pattern
   */
  public static SpikePattern subset(SpikePattern pattern, int[] indices) {
    SpikePatternImpl result = new SpikePatternImpl(indices.length);
   
    for (int i = 0; i < indices.length; i++) {
      float[] spikeTimes = pattern.getSpikeTimes(indices[i]);
      for (int j = 0; j < spikeTimes.length; j++) {
        result.addSpike(i, spikeTimes[j]);
      }
    }
    return result;
  }
View Full Code Here

    series.add(new TimeSeriesImpl(times, MU.transpose(values1), units));
    series.add(new TimeSeriesImpl(times, MU.transpose(values2), units));
    series.add(new TimeSeriesImpl(times, MU.transpose(values3), units));
   
    List<SpikePattern> patterns = new ArrayList<SpikePattern>(10);
    SpikePatternImpl p1 = new SpikePatternImpl(2);
    p1.addSpike(0, 1);
    p1.addSpike(1, 2);
    patterns.add(p1);
    SpikePatternImpl p2 = new SpikePatternImpl(3);
    p2.addSpike(0, 5);
    p2.addSpike(1, 6);
    p2.addSpike(2, 7);
    patterns.add(p2);
   
    Plotter.plot(series, patterns, "multi series");
  }
View Full Code Here

   * @param nodes Nodes that Ensemble contains
   */
  public AbstractEnsemble(String name, Node[] nodes) {
    myName = name;
    myNodes = nodes;
    mySpikePattern = new SpikePatternImpl(nodes.length);
    myCollectSpikesFlag = false;

    init();

    setMode(SimulationMode.DEFAULT);
View Full Code Here

  /**
   * Replaces the set of nodes inside the Ensemble
   */
    public void redefineNodes(Node[] nodes) {
    myNodes=nodes;
    mySpikePattern = new SpikePatternImpl(myNodes.length);
    //setupNodeRunners(numNodeRunners);

    init();
  }
View Full Code Here

   *
   * @see ca.nengo.model.Ensemble#run(float, float)
   */
    public void run(float startTime, float endTime) throws SimulationException {
    if (mySpikePattern == null) {
      mySpikePattern = new SpikePatternImpl(myNodes.length);
    }

    for (int i = 0; i < myNodes.length; i++) {
      myNodes[i].run(startTime, endTime);

View Full Code Here

    for (Termination t : myTerminations.values()) {
      t.reset(randomize);
    }


    mySpikePattern = new SpikePatternImpl(myNodes.length);
  }
View Full Code Here

TOP

Related Classes of ca.nengo.util.impl.SpikePatternImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.