Package ca.nengo.model.impl

Examples of ca.nengo.model.impl.SpikeOutputImpl


      myNextRateOutput = nextRateOutput;
    }
   
    public InstantaneousOutput run(float[] time, float[] current) {
      if (myMode.equals(SimulationMode.DEFAULT)) {
        return new SpikeOutputImpl(new boolean[]{myNextSpikeOutput}, Units.SPIKES, 0);
      } else {
        return new RealOutputImpl(new float[]{myNextRateOutput}, Units.SPIKES_PER_S, 0);
      }
    }
View Full Code Here


      result = new RealOutputImpl(new float[]{doConstantRateRun(time[0], current[0])}, Units.SPIKES_PER_S, time[time.length-1]);
    } else if (myMode.equals(SimulationMode.PRECISE)) {
      result = new PreciseSpikeOutputImpl(new float[]{doPreciseSpikingRun(time, current)}, Units.SPIKES, time[time.length-1]);
    } else {
      //result = new SpikeOutputImpl(new boolean[]{doSpikingRun(time, current)}, Units.SPIKES, time[time.length-1]);
      result = new SpikeOutputImpl(new boolean[]{doPreciseSpikingRun(time, current)>=0}, Units.SPIKES, time[time.length-1]);
    }

    return result;
  }
View Full Code Here

  }

  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]);
   
View Full Code Here

    si.addTermination("two", new float[]{1f}, 1f, false);
    si.addTermination("three", new float[]{1f}, 1f, true);

    Termination[] t = si.getTerminations();
   
    InstantaneousOutput spike = new SpikeOutputImpl(new boolean[]{true}, Units.SPIKES, 0);
   
    t[0].setValues(spike);
    t[1].setValues(spike);
    t[2].setValues(spike);
   
View Full Code Here

  public void testReset() throws StructuralException, SimulationException {
    ExpandableSynapticIntegrator si = new LinearSynapticIntegrator(.001f, Units.ACU);
    si.addTermination("test", new float[]{1f}, 1f, false);
   
    Termination t = si.getTerminations()[0];
    t.setValues(new SpikeOutputImpl(new boolean[]{true}, Units.SPIKES, 0));   
    for (int i = 0; i < 10; i++) {
      si.run(.001f * ((float) i), .001f * ((float) i+1));     
      t.setValues(new SpikeOutputImpl(new boolean[]{false}, Units.SPIKES, 0));
    }
    TimeSeries1D current = si.run(.010f, .011f);
    assertTrue(current.getValues()[1][0] > .9f);
   
    si.reset(false); //there is no random setting to test
View Full Code Here

                    myVoltage-=1;
                    spike=true;
                }
            }

            result = new SpikeOutputImpl(new boolean[]{spike}, Units.SPIKES, time[time.length-1]);

        } else { //default mode is spiking mode
            boolean spike = false;
            for (int i = 0; i < time.length - 1 && !spike; i++) {
                float timeSpan = time[i+1] - time[i];

                float rate = myRateFunction.map(new float[]{current[i]});
                double probNoSpikes = Math.exp(-rate*timeSpan);
                spike = (PDFTools.random() > probNoSpikes);
            }

            result = new SpikeOutputImpl(new boolean[]{spike}, Units.SPIKES, time[time.length-1]);
        }

        return result;
    }
View Full Code Here

            myLastSpikeTime = myDynamicsOutput.getTimes()[i];
          }
        }
      }

      return new SpikeOutputImpl(new boolean[]{spike}, Units.SPIKES, time[time.length-1]);
    }
  }
View Full Code Here

              spike = true;
              myLastSpikeTime = output.getTimes()[i];
            }
          }
        }
        result = new SpikeOutputImpl(new boolean[]{spike}, Units.SPIKES, time[time.length-1]);
      }
    }

    return result;
  }
View Full Code Here

     * @param generator The SpikeGenerator from which this Origin is to obtain output.
     */
    public SpikeGeneratorOrigin(Node node, SpikeGenerator generator) {
        myNode = node;
        myGenerator = generator;
        myOutput = new SpikeOutputImpl(new boolean[]{false}, Units.SPIKES, 0);
        myName = Neuron.AXON;
    }
View Full Code Here

     */
    public void setMode(SimulationMode mode) {
        if (mode == SimulationMode.CONSTANT_RATE || mode == SimulationMode.RATE){
            myOutput = new RealOutputImpl(new float[]{0.0f}, Units.SPIKES_PER_S, 0);
        } else {
            myOutput = new SpikeOutputImpl(new boolean[]{false}, Units.SPIKES, 0);
        }
    }
View Full Code Here

TOP

Related Classes of ca.nengo.model.impl.SpikeOutputImpl

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.