Package ca.nengo.model.neuron.impl

Examples of ca.nengo.model.neuron.impl.LinearSynapticIntegrator


  /*
   * Test method for 'ca.bpt.cn.model.impl.LinearSynapticIntegrator.getTerminations()'
   */
  public void testGetTerminations() throws StructuralException {
    ExpandableSynapticIntegrator si = new LinearSynapticIntegrator(1, Units.ACU);
    assertEquals(0, si.getTerminations().length);
   
    si.addTermination("test1", new float[]{1f, 1f}, 1f, false);
    assertEquals(1, si.getTerminations().length);
    assertEquals("test1", si.getTerminations()[0].getName());
    assertEquals(2, si.getTerminations()[0].getDimensions());
    assertEquals(1f, si.getTerminations()[0].getTau());
   
    si.addTermination("test2", new float[0], 1f, false);
    assertEquals(2, si.getTerminations().length);
   
    si.removeTermination("test2");
    assertEquals(1, si.getTerminations().length);   
   
    try {
      si.addTermination("test1", new float[0], 1f, false);
      fail("Should have thrown exception due to duplicate termination name");
    } catch (StructuralException e) {} //exception is expected
  }
View Full Code Here


  /*
   * Test method for 'ca.bpt.cn.model.impl.LinearSynapticIntegrator.run(float, float)'
   */
  public void testRun() throws StructuralException, SimulationException {
    ExpandableSynapticIntegrator si = new LinearSynapticIntegrator(.001f, Units.ACU);
    si.addTermination("one", new float[]{1f}, 1f, false);
    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);
   
    TimeSeries1D current = si.run(0f, .01f);
    assertEquals(11, current.getTimes().length);
    assertTrue(current.getValues1D()[0] > 1.99f && current.getValues1D()[0] < 2.01f);
    for (int i = 1; i < current.getTimes().length; i++) {
      assertTrue(current.getValues1D()[i] < current.getValues1D()[i-1]); //decaying
    }
View Full Code Here

  /*
   * Test method for 'ca.bpt.cn.model.impl.LinearSynapticIntegrator.reset(boolean)'
   */
  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
    current = si.run(.011f, .012f);
    assertTrue(current.getValues1D()[1] < .01f);
  }
View Full Code Here

   * Plots voltage and recovery variable for a simulation
   */
  public static void main(String[] args) throws StructuralException, SimulationException {
    float I = 4;
   
    LinearSynapticIntegrator integrator = new LinearSynapticIntegrator();
    IzhikevichSpikeGenerator generator = new IzhikevichSpikeGenerator(IzhikevichSpikeGenerator.Preset.REGULAR_SPIKING);
    ExpandableSpikingNeuron neuron = new ExpandableSpikingNeuron(integrator, generator, 1, 0, "neuron");   
    Termination t = neuron.addTermination("input", MU.I(1), .001f, false);
   
    FunctionInput input = new FunctionInput("input", new Function[]{new ConstantFunction(1, I)}, Units.UNK);
View Full Code Here

  private SpikeGenerator myGenerator;
  private SpikingNeuron myNeuron;
 
  protected void setUp() throws Exception {
    super.setUp();
    myIntegrator = new LinearSynapticIntegrator(.001f, Units.ACU);
    myGenerator = new LIFSpikeGenerator(.001f, .01f, .001f);
    myNeuron = new SpikingNeuron(myIntegrator, myGenerator, 1, 0, "test");   
  }
View Full Code Here

TOP

Related Classes of ca.nengo.model.neuron.impl.LinearSynapticIntegrator

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.