Package cnslab.cnsnetwork

Examples of cnslab.cnsnetwork.Neuron


     
// TODO:  discarding first instance due known initialization bug (bug 1)     
     
new SIFNeuron ( sifNeuronPara );
     
      final Neuron  neuron = new SIFNeuron ( sifNeuronPara );
     
      // interface Neuron accessor methods
     
      // SIFNeuron is not a sensory neuron
     
      assertFalse ( neuron.isSensory ( ) );
     
      final double [ ]  currents = neuron.getCurr ( 0 );
     
      assertNotNull ( currents );
     
      // SIFNeuron has 2 currents:  excitatory and inhibitory
     
      assertEquals ( 2, currents.length );     
     
      // LOGGER.debug ( "excitatory current ...:  {}", currents [ 0 ] );
     
      // LOGGER.debug ( "inhibitory current ...:  {}", currents [ 1 ] );
     
      // Initially the currents should be zero
     
      assertEquals ( 0, currents [ 0 ], 0 );
     
      assertEquals ( 0, currents [ 1 ], 0 );
     
      final double  membraneVoltage = neuron.getMemV ( 0 );
     
      // LOGGER.debug ( "membrane voltage .....:  {}", membraneVoltage );
     
      // Initially the membrane voltage should be zero
     
      assertEquals ( 0, membraneVoltage, 0 );
     
      final boolean  record = neuron.getRecord ( );
     
      assertFalse ( record );
     
      final long  targetHost = neuron.getTHost ( );
     
      assertEquals ( 0, targetHost );
     
      final double  timeOfNextFire = neuron.getTimeOfNextFire ( );
     
      // LOGGER.debug ( "time of next fire ....:  {}", timeOfNextFire );
     
      assertEquals ( -1, timeOfNextFire, 0 );
     
      final boolean  realFire = neuron.realFire ( );
     
      assertTrue ( realFire );
    }
View Full Code Here


     
// TODO:  discarding first instance due known initialization bug (bug 1)     
     
new SIFNeuron ( sifNeuronPara );
     
      final Neuron  neuron = new SIFNeuron ( sifNeuronPara );
     
      neuron.init (
        1, // expId
        1, // trialId
        ErnstTestLib.createTestSeed ( ), // idum
        ErnstTestLib.createTestNetwork ( ), // net
        0 ); // id
     
      final double [ ]  currents0 = neuron.getCurr ( 0 );
     
      assertNotNull ( currents0 );
     
      // LOGGER.debug ( "excitatory current ...:  {}", currents0 [ 0 ] );
     
      // LOGGER.debug ( "inhibitory current ...:  {}", currents0 [ 1 ] );
     
      // Initially the currents should be zero
     
      assertEquals ( 0, currents0 [ 0 ], 0 );
     
      assertEquals ( 0, currents0 [ 1 ], 0 );
     
      final double  membraneVoltage0 = neuron.getMemV ( 0 );
     
      // LOGGER.debug ( "membrane voltage .....:  {}", membraneVoltage0 );
     
      assertTrue ( membraneVoltage0 != 0 );
     
      final double  timeOfNextFire0 = neuron.getTimeOfNextFire ( );
     
      // LOGGER.debug ( "time of next fire ....:  {}", timeOfNextFire0 );
     
      assertEquals ( -1, timeOfNextFire0, 0 );
     
      final double  weight = SIFNeuron.maxWeight / 10;
     
      final Synapse  synapse = MODEL_FACTORY.createSynapse (
        0, // to
        ( byte ) 0, // type (0 = excitatory)
        ( float ) weight );
     
      final double  timeOfNextFire1 = neuron.updateInput (
        0, // time
        synapse );
     
      // LOGGER.debug ( "time of next fire ....:  {}", timeOfNextFire1 );
     
      // Excitatory current should drive it to fire
     
      assertTrue ( timeOfNextFire1 > 0 );
     
      final double [ ]  currents1 = neuron.getCurr ( 0 );
     
      assertNotNull ( currents1 );
     
      // LOGGER.debug ( "excitatory current ...:  {}", currents1 [ 0 ] );
     
      // LOGGER.debug ( "inhibitory current ...:  {}", currents1 [ 1 ] );
     
      // Excitatory current should be equal to weight
     
      assertEquals ( weight, currents1 [ 0 ], weight * 1e-6 );
     
      assertEquals ( 0, currents1 [ 1 ], 0 );
     
      final double  membraneVoltage1 = neuron.getMemV ( 0 );
     
      // LOGGER.debug ( "membrane voltage .....:  {}", membraneVoltage1 );
     
      // Excitatory current should increase membrane voltage
     
      assertTrue ( membraneVoltage1 > membraneVoltage0 );
     
      final int  steps = 10;
     
      final double  stepTimeDelta = timeOfNextFire1 / steps;
     
      double  previousMembraneVoltage = membraneVoltage1;
     
      double  previousExcitatoryCurrent = currents1 [ 0 ];
     
      for ( int  i = 1; i <= steps; i++ )
      {
        final double  time = i * stepTimeDelta;
       
        final double  membraneVoltage2 = neuron.getMemV ( time );
       
        // LOGGER.debug ( "membrane voltage .....:  {}", membraneVoltage2 );
       
        final double [ ]  currents2 = neuron.getCurr ( time );
       
        final double  excitatoryCurrent = currents2 [ 0 ];
       
        // LOGGER.debug (
        //   "excitatory current ...:  {}", excitatoryCurrent );
       
        assertTrue ( membraneVoltage2 > previousMembraneVoltage );
       
        previousMembraneVoltage = membraneVoltage2;
       
        assertTrue ( excitatoryCurrent < previousExcitatoryCurrent );
       
        previousExcitatoryCurrent = excitatoryCurrent;
       
        assertEquals ( 0, currents2 [ 1 ], 0 );
      }
     
      neuron.setTimeOfNextFire ( timeOfNextFire1 );
     
      double  timeOfNextFire2 = neuron.updateFire ( );
     
      while ( timeOfNextFire2 > 0 )
      {     
        // LOGGER.debug ( "time of next fire ....:  {}", timeOfNextFire2 );
       
        neuron.setTimeOfNextFire ( timeOfNextFire2 );
       
        timeOfNextFire2 = neuron.updateFire ( );
      }
     
      // LOGGER.debug ( "time of next fire ....:  {}", timeOfNextFire2 );     
    }
View Full Code Here

    private static Network  createNetwork ( )
    ////////////////////////////////////////////////////////////////////////
    {
      final Seed  seed = new Seed ( -3 );
     
      final Neuron  neuron0 = new BKPoissonNeuron (
        seed,
        new BKPoissonNeuronPara ( ) );
     
      neuron0.setRecord ( true );
     
      final Neuron [ ]  neurons = new Neuron [ ] { neuron0, null };
     
      final Map<Integer, Axon>  axonMap = new HashMap<Integer, Axon> ( );
     
View Full Code Here

    public void  testNeuronAccessorMethods ( )
    ////////////////////////////////////////////////////////////////////////
    {
      final MiNiNeuronPara para = ErnstTestLib.createTestMiNiNeuronPara ( );

      final Neuron neuron = new MiNiNeuron ( para );

      neuron.init (
        1, // expId
        1, // trialId
        ErnstTestLib.createTestSeed ( ), // idum
        ErnstTestLib.createTestNetwork ( ), // net
        0 ); // id

      // interface Neuron accessor methods

      // VSICLIFNeuron is not a sensory neuron

      assertFalse ( neuron.isSensory ( ) );

      final double [ ]  currents = neuron.getCurr ( 0 );

      assertNotNull ( currents );

      assertEquals ( para.DECAY_SYNAPSE.length + para.DECAY_SPIKE.length, currents.length );     

      // Initially the currents should be zero.

      for ( int i = 0; i < currents.length; i++ )
      {
        assertEquals ( currents [ i ] 0 , 1e-15 );
      }

      // The membrane voltage should be within the bounds determined
      // by its initial jitter.

      final double  membraneVoltage = neuron.getMemV ( 0 );

      assertTrue ( membraneVoltage > para.ini_mem
        && membraneVoltage < para.ini_mem + para.ini_memVar );

      final boolean  record = neuron.getRecord ( );

      assertFalse ( record );

      final long  targetHost = neuron.getTHost ( );

      assertEquals ( 0, targetHost );

      final double  timeOfNextFire = neuron.getTimeOfNextFire ( );

      assertEquals ( -1, timeOfNextFire, 0 );

      final boolean  realFire = neuron.realFire ( );

      assertFalse ( realFire );
    }
View Full Code Here

    public void  testNeuronLifecycleMethods ( )
    ////////////////////////////////////////////////////////////////////////
    {
      final MiNiNeuronPara para = ErnstTestLib.createTestMiNiNeuronPara ( );

      final Neuron neuron = new MiNiNeuron ( para );

      neuron.init (
        1, // expId
        1, // trialId
        ErnstTestLib.createTestSeed ( ), // idum
        ErnstTestLib.createTestNetwork ( ), // net
        0 ); // id

      final double [ ]  currents0 = neuron.getCurr ( 0 );

      assertNotNull ( currents0 );

      // Initially the currents should be zero

      assertEquals ( 0, currents0 [ 0 ], 0 );

      assertEquals ( 0, currents0 [ 1 ], 0 );

      final double  membraneVoltage0 = neuron.getMemV ( 0 );

      assertTrue ( membraneVoltage0 != 0 );

      final double  timeOfNextFire0 = neuron.getTimeOfNextFire ( );
   
      LOGGER.debug ( "time of next fire ....:  {}", timeOfNextFire0 );
     
      LOGGER.debug ( "real fire? " + neuron.realFire());

      assertEquals ( -1, timeOfNextFire0, 0 );

      final double  weight = 1e-9;  

      final Synapse  synapse = MODEL_FACTORY.createSynapse (
        0,   // to
        ( byte ) 0, // type (0 = excitatory)
        ( float ) weight );

      double  timeOfNextFire = neuron.updateInput (
        0, // time
        synapse );

      neuron.setTimeOfNextFire(timeOfNextFire);

      for (int i = 0; i < 100; i++)
      {
        timeOfNextFire = neuron.updateFire();
     
        LOGGER.debug ( "time of next fire ....:  {}", timeOfNextFire );
       
        LOGGER.debug ( "real fire? " + neuron.realFire());
       
        neuron.setTimeOfNextFire(timeOfNextFire);
      }
    }
View Full Code Here

    ////////////////////////////////////////////////////////////////////////
    {
      final VSICLIFNeuronPara
        vsiclifNeuronPara = ErnstTestLib.createTestVsiclifNeuronPara ( );
 
      final Neuron  neuron = new VSICLIFNeuron ( vsiclifNeuronPara );
     
      neuron.init (
        1, // expId
        1, // trialId
        ErnstTestLib.createTestSeed ( ), // idum
        ErnstTestLib.createTestNetwork ( ), // net
        0 ); // id
     
      // interface Neuron accessor methods
     
      // VSICLIFNeuron is not a sensory neuron
     
      assertFalse ( neuron.isSensory ( ) );
     
      final double [ ]  currents = neuron.getCurr ( 0 );
     
      assertNotNull ( currents );
     
      // VSICLIFNeuron has 2 currents:  excitatory and inhibitory
     
      assertEquals ( 2, currents.length );     
     
//      LOGGER.debug ( "excitatory current ...:  {}", currents [ 0 ] );
//     
//      LOGGER.debug ( "inhibitory current ...:  {}", currents [ 1 ] );
     
      // Initially the currents should be zero
     
      assertEquals ( 0, currents [ 0 ], 0 );
     
      assertEquals ( 0, currents [ 1 ], 0 );
     
//      final double  membraneVoltage = neuron.getMemV ( 0 );
     
//      LOGGER.debug ( "membrane voltage .....:  {}", membraneVoltage );
     
//       Initially the membrane voltage should be the reset voltage
//      Edit: no, it shouldn't.  In the init() method of the VSICLIF neuron,
//      the membrane voltage is initialized to a random value.
//      assertEquals ( vsiclifNeuronPara.VRESET, membraneVoltage, 0 );
     
      final boolean  record = neuron.getRecord ( );
     
      assertFalse ( record );
     
      final long  targetHost = neuron.getTHost ( );
     
      assertEquals ( 0, targetHost );
     
      final double  timeOfNextFire = neuron.getTimeOfNextFire ( );
     
//      LOGGER.debug ( "time of next fire ....:  {}", timeOfNextFire );
     
      assertEquals ( -1, timeOfNextFire, 0 );
     
      final boolean  realFire = neuron.realFire ( );
     
      assertFalse ( realFire );
    }
View Full Code Here

      final VSICLIFNeuron
        vsiclifNeuron = new VSICLIFNeuron ( vsiclifNeuronPara );
     
      // creating interface reference
     
      final Neuron  neuron = vsiclifNeuron;
     
      neuron.init (
        1, // expId
        1, // trialId
        ErnstTestLib.createTestSeed ( ), // idum
        ErnstTestLib.createTestNetwork ( ), // net
        0 ); // id
     
      final double [ ]  currents0 = neuron.getCurr ( 0 );
     
      assertNotNull ( currents0 );
     
//      LOGGER.debug ( "excitatory current ...:  {}", currents0 [ 0 ] );
//     
//      LOGGER.debug ( "inhibitory current ...:  {}", currents0 [ 1 ] );
     
      // Initially the currents should be zero
     
      assertEquals ( 0, currents0 [ 0 ], 0 );
     
      assertEquals ( 0, currents0 [ 1 ], 0 );
     
      final double  membraneVoltage0 = neuron.getMemV ( 0 );
     
//      LOGGER.debug ( "membrane voltage .....:  {}", membraneVoltage0 );
     
      assertTrue ( membraneVoltage0 != 0 );
     
      final double  timeOfNextFire0 = neuron.getTimeOfNextFire ( );
     
//      LOGGER.debug ( "time of next fire ....:  {}", timeOfNextFire0 );
     
      assertEquals ( -1, timeOfNextFire0, 0 );
     
      final double  weight = VSICLIFNeuron.maxWeight / 10;  
     
      final Synapse  synapse = MODEL_FACTORY.createSynapse (
        0,   // to
        ( byte ) 0, // type (0 = excitatory)
        ( float ) weight );
     
      final double  timeOfNextFire1 = neuron.updateInput (
        0, // time
        synapse );
     
//      LOGGER.debug ( "time of next fire ....:  {}", timeOfNextFire1 );
     
      // Excitatory current should drive it to fire
     
      assertTrue ( timeOfNextFire1 > 0 );
     
      final double [ ]  currents1 = neuron.getCurr ( 0 );
     
      assertNotNull ( currents1 );
     
//      LOGGER.debug ( "excitatory current ...:  {}", currents1 [ 0 ] );
//     
//      LOGGER.debug ( "inhibitory current ...:  {}", currents1 [ 1 ] );
     
      // Excitatory current should be equal to weight
     
      assertEquals ( weight, currents1 [ 0 ], weight * 1e-6 );
     
      // Inhibitory current should still be zero
     
      assertEquals ( 0, currents1 [ 1 ], 0 );
     
//      LOGGER.debug (
//        "time of last update ..:  {}",
//        vsiclifNeuron.getTimeOfLastUpdate ( ) );
     
      final double  membraneVoltage1 = neuron.getMemV ( 0 );
     
//      LOGGER.debug ( "membrane voltage .....:  {}", membraneVoltage1 );
     
      // Excitatory current should increase membrane voltage
     
View Full Code Here

      throws Exception
    ////////////////////////////////////////////////////////////////////////
    {
      final Seed  seed = new Seed ( -3 );
     
      final Neuron  neuron0 = new BKPoissonNeuron (
        seed,
        new BKPoissonNeuronPara ( ) );
     
      final Neuron [ ]  neurons = new Neuron [ ] { neuron0 };
     
      final Map<Integer, Axon>  axonMap = new HashMap<Integer, Axon> ( );
     
      final SimulatorParser  simulatorParser = new SimulatorParser ( );
     
      final Seed  networkSeed = new Seed ( -3 );
     
      final Network  network = new Network (
        simulatorParser.getModelFactory ( ),
        simulatorParser.getDiscreteEventQueue ( ),
        simulatorParser.getModulatedSynapseSeq ( ),       
        neurons,
        axonMap,
        0,      // minDelay
        simulatorParser,
        networkSeed );
     
      assertNull ( network.getFireEventSlot ( ) );
     
      network.initNet ( );
     
      assertNotNull ( network.getFireEventSlot ( ) );
     
      assertNull ( network.getFirstFireEvent ( ) );
     
      neuron0.init (
        0, // expId
        0, // trialId
        seed,
        network,
        1234 );
View Full Code Here

      throws Exception
    ////////////////////////////////////////////////////////////////////////
    {
      final Seed  seed = new Seed ( -3 );
     
      final Neuron  neuron0 = new BKPoissonNeuron (
          seed,
          new BKPoissonNeuronPara ( ) );
     
      final Neuron [ ]  neurons = new Neuron [ ] { neuron0 };
     
View Full Code Here

      throws Exception, jpvmException
    ////////////////////////////////////////////////////////////////////////
    {
      final Seed  seed = new Seed ( -3 );
     
      final Neuron  neuron0 = new BKPoissonNeuron (
          seed,
          new BKPoissonNeuronPara ( ) );
     
      final Neuron [ ]  neurons = new Neuron [ ] { neuron0, null };
     
View Full Code Here

TOP

Related Classes of cnslab.cnsnetwork.Neuron

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.