Package ca.nengo.model

Examples of ca.nengo.model.SpikeOutput


  public void testRun() throws SimulationException, StructuralException {
    PassthroughNode node1 = new PassthroughNode("test", 2);
    node1.getTermination(PassthroughNode.TERMINATION).setValues(
        new SpikeOutputImpl(new boolean[]{true, false}, Units.UNK, 0));
    node1.run(0, .01f);
    SpikeOutput out1 = (SpikeOutput) node1.getOrigin(PassthroughNode.ORIGIN).getValues();
    assertEquals(true, out1.getValues()[0]);
    assertEquals(false, out1.getValues()[1]);
   
    Map<String, float[][]> terminations2 = new HashMap<String, float[][]>(10);
    terminations2.put("a", MU.I(2));
    terminations2.put("b", MU.I(2));
    PassthroughNode node2 = new PassthroughNode("test2", 2, terminations2);
View Full Code Here


  private int countSpikes(float current, float dt, float time) {
    int steps = (int) Math.ceil(time / dt);
    int spikes = 0;
    for (int i = 0; i < steps; i++) {
      SpikeOutput output = (SpikeOutput) run(new float[]{i*dt, (i+1)*dt}, new float[]{current, current});
      if (output.getValues()[0]) {
                spikes += 1;
            }
    }
    return spikes;
  }
View Full Code Here

   
    float I = 5;
    List<Integer> firings1 = new ArrayList<Integer>(10);
    List<Integer> firings2 = new ArrayList<Integer>(10);
    for (int i = 0; i < 1000; i++) {
      SpikeOutput o1 = (SpikeOutput) rs.run(new float[]{i/1000f, (i+1)/1000f}, new float[]{I, I});
      if (o1.getValues()[0]) firings1.add(Integer.valueOf(i));
     
      SpikeOutput o2 = (SpikeOutput) fs.run(new float[]{i/1000f, (i+1)/1000f}, new float[]{I, I});
      if (o2.getValues()[0]) firings2.add(Integer.valueOf(i));
    }
   
    assertEquals(10, firings1.size());
    assertEquals(33, firings2.size());
   
View Full Code Here

TOP

Related Classes of ca.nengo.model.SpikeOutput

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.