Package cnslab.cnsnetwork

Examples of cnslab.cnsnetwork.SimulatorParser


    @Test
    public void  testConstructor ( )
      throws Exception
    ////////////////////////////////////////////////////////////////////////
    {
      new SimulatorParser (
        new Seed ( -3 ),
        toFile ( TEST_MODEL_FILENAME ) );
    }
View Full Code Here


    @Test
    public void  testParse ( )
      throws Exception
    ////////////////////////////////////////////////////////////////////////
    {
      final SimulatorParser  simulatorParser = new SimulatorParser (
        new Seed ( -3 ),
        toFile ( TEST_MODEL_FILENAME ) );
     
      assertNotNull ( simulatorParser.document );
     
      assertNotNull ( simulatorParser.rootElement );
     
      assertNull ( simulatorParser.documentType );
     
      simulatorParser.parseMapCells ( );
     
      assertEquals ( 10, simulatorParser.xEdgeLength );
     
      assertEquals ( 10, simulatorParser.yEdgeLength );
     
      assertEquals ( "ava.nc", simulatorParser.outFile );
     
      assertEquals ( 1, simulatorParser.numOfHosts );
     
      assertEquals ( 1, simulatorParser.aSec );
     
      assertEquals ( 1, simulatorParser.bSec );
     
      assertEquals ( LayerStructure.ABMAP, simulatorParser.mapType );
     
      assertNotNull ( simulatorParser.layerStructure );
     
      assertEquals ( 5, simulatorParser.backgroundFrequency, 0 );
     
      assertEquals ( 1e-9, simulatorParser.backgroundStrength, 0 );
     
      assertTrue (
        ErnstLib.equivalent (
          new Layer ( "AA", "AA", 1, 1, "exc" ),
          simulatorParser.layerStructure.getLayer ( "AA", "AA" ) ) );
     
      assertTrue (
        ErnstLib.equivalent (
          new Layer ( "BB", "BB", 1, 1, "exc" ),
          simulatorParser.layerStructure.getLayer ( "BB", "BB" ) ) );
     
      assertEquals (
        200,
        simulatorParser.layerStructure.totalNumNeurons ( ) );
     
      simulatorParser.parseNeuronDef ( );
     
      final Map<String, Para>  modelParaMap = simulatorParser.modelParaMap;
     
      final Para  excPara = modelParaMap.get ( "exc" );
     
      assertNotNull ( excPara );
     
      final String  excModel = excPara.getModel ( );
     
      assertEquals ( "VSICLIFNeuronV2", excModel );
     
      final VSICLIFNeuronParaV2
        vsiclifNeuronParaV2 = ( VSICLIFNeuronParaV2 ) excPara;
     
      assertEquals (
        -0.070,
        vsiclifNeuronParaV2.VREST,
        0 );
     
      assertEquals (
        100,
        vsiclifNeuronParaV2.K_LTD,
        0 );
     
      assertEquals (
        1 / 0.005,
        vsiclifNeuronParaV2.DECAY [ 0 ],
        0 );
     
      assertEquals (
        1 / 0.025,
        vsiclifNeuronParaV2.DECAY [ 1 ],
        0 );
     
      assertEquals (
        200,
        vsiclifNeuronParaV2.K_LTP,
        0 );
     
      assertEquals (
        0.1,
        vsiclifNeuronParaV2.Alpha_LTD,
        0 );
     
      assertEquals (
        0,
        vsiclifNeuronParaV2.Alpha_LTP,
        0 );
     
      final Map<String, Double>
        doubleDataMap = simulatorParser.doubleDataMap;
     
      assertEquals (
        5e-10,
        doubleDataMap.get ( "str_exc" ).doubleValue ( ),
        0 );
       
      assertEquals (
        0.01,
        doubleDataMap.get ( "del" ).doubleValue ( ),
        0 );
       
      assertEquals (
        -5e-10,
        doubleDataMap.get ( "str_inhib" ).doubleValue ( ),
        0 );
     
      final Map<String, double [ ] [ ]>
        matrixDataMap = simulatorParser.matrixDataMap;
       
      assertTrue (
        ErnstTestLib.equivalent (
          new double [ ] [ ] {
            { 0, 0, 0 },
            { 1, 5, 1 },
            { 0, 0, 0 } },
          matrixDataMap.get ( "conn" ) ) );
     
      simulatorParser.parseExperiment ( );
     
//      final ArrayList<String>  subexpNames = simulatorParser.subexpNames;
//     
//      assertNotNull ( subexpNames );
//     
//      assertEquals (
//        1,
//        subexpNames.size ( ) );
//     
//      assertEquals (
//        "test",
//        subexpNames.get ( 0 ) );
     
      final Experiment  experiment = simulatorParser.experiment;
     
      assertNotNull ( experiment );
     
      final SubExp [ ]  subExpArray = experiment.subExp;
     
      assertNotNull ( subExpArray );
     
      assertEquals (
        1,
        subExpArray.length );
     
      final SubExp  subExp = subExpArray [ 0 ];
     
      assertNotNull ( subExp );
     
      assertEquals (
        "test",
        subExp.name );
     
      assertEquals (
        10.0,
        subExp.trialLength,
        0 );
     
      assertEquals (
        2,
        subExp.repetition );
       
      final Stimulus [ ]  stimuli = subExp.stimuli;
     
      assertNotNull ( stimuli );
     
      assertEquals (
        2,
        stimuli.length );
     
      final Stimulus  stimulus0 = stimuli [ 0 ];
     
      final Stimulus  stimulus1 = stimuli [ 1 ];
     
      assertNotNull ( stimulus0 );
     
      assertNotNull ( stimulus1 );
     
      assertNull ( stimulus0.simulatorParser );
     
      assertNull ( stimulus1.simulatorParser );
     
      // strength
     
      assertEquals (
        1e-10,
        stimulus0.getStrength ( ),
        0 );
     
      assertEquals (
        1e-10,
        stimulus1.getStrength ( ),
        0 );
     
      // type
     
      assertEquals (
        0,
        stimulus0.getType ( ) );
     
      assertEquals (
        0,
        stimulus1.getType ( ) );
     
      // onTime
     
      assertEquals (
        0.0,
        stimulus0.getOnTime ( ),
        0 );
     
      assertEquals (
        0.0,
        stimulus1.getOnTime ( ),
        0 );
     
      // offTime
     
      assertEquals (
        10.0,
        stimulus0.getOffTime ( ),
        0 );
     
      assertEquals (
        10.0,
        stimulus1.getOffTime ( ),
        0 );
     
      // freq
     
      assertEquals (
        40.0,
        stimulus0.getFreq ( ),
        0 );
     
      assertEquals (
        40.0,
        stimulus1.getFreq ( ),
        0 );
     
      // decay
     
      assertEquals (
        0.0,
        stimulus0.getDecay ( ),
        0 );
     
      assertEquals (
        0.0,
        stimulus1.getDecay ( ),
        0 );
     
      // seed
     
      assertNotNull ( stimulus0.seed );
     
      assertNotNull ( stimulus1.seed );
     
      // channel
     
      assertEquals (
        -1,
        stimulus0.getChannel ( ) );
     
      assertEquals (
        -1,
        stimulus1.getChannel ( ) );
     
      // TODO:  For prefix and suffix parsing, see Stimulus.background()
     
      final Recorder  recorder = experiment.recorder;
     
      assertNotNull ( recorder );
     
      assertFalse ( recorder.plot );
     
      assertNull ( recorder.simulatorParser );
     
// TODO:  continue adding asserts here     
     
      simulatorParser.findMinDelay ( );
    }
View Full Code Here

    @Test
    public void  testReferenceCheck ( )
      throws Exception
    ////////////////////////////////////////////////////////////////////////
    {
      final SimulatorParser  simulatorParser = new SimulatorParser (
        new Seed ( -3 ),
        toFile ( TEST_MODEL_FILENAME ) );
     
      simulatorParser.referenceCheck ( );
    }
View Full Code Here

      throws Exception
    ////////////////////////////////////////////////////////////////////////
    {
      assertEquals (
        "",
        new SimulatorParser ( ).validate (
          toFile ( TEST_MODEL_FILENAME ) ) );
    }
View Full Code Here

     
      assertNotNull ( byteArray );
     
//      System.out.println ( new String ( byteArray, "UTF-8" ) );

      final SimulatorParser
        simulatorParser = NetHost.createSimulatorParser (
          impl,
          byteArray,
          TEST_SEED_INT,
          jpvmInfo );
     
      assertNotNull ( simulatorParser );
     
      final Seed  idum = new Seed ( -2 );
     
      final Network  network = new Network (
        simulatorParser.getModelFactory ( ),
        simulatorParser.getDiscreteEventQueue ( ),
        simulatorParser.getModulatedSynapseSeq ( ),
        simulatorParser.layerStructure.neurons,
        simulatorParser.layerStructure.axons,
        jpvmInfo,
        simulatorParser.layerStructure.base,
        simulatorParser.minDelay,
View Full Code Here

    }
   
    private final Stimulus createStimulus ( )
    ////////////////////////////////////////////////////////////////////////
    {
      final SimulatorParser simulatorParser = createSimulatorParser
          ( SIZE , SIZE , 1 , 1 );
      final Stimulus stimulus = new Stimulus (
          MODEL_FACTORY,
          simulatorParser,
          1e-10, // strength
View Full Code Here

     
      final Neuron [ ]  neurons = new Neuron [ ] { neuron0, null };
     
      final Map<Integer, Axon>  axonMap = new HashMap<Integer, Axon> ( );
     
      final SimulatorParser  simulatorParser = new SimulatorParser ( );
     
      final Seed  networkSeed = new Seed ( -3 );
     
      final Stimulus [ ]  stimuli = new Stimulus [ ] { };
     
      final SubExp [ ]  subexperiments = new SubExp [ ] {
        new SubExp (
          1, // repetition
          1.0, // trialLength
          stimuli,
          null ) }; // discreteEventCollection
     
      final Recorder  recorder = new Recorder (
        simulatorParser,
        false ); // plot
     
      final Experiment  experiment = new Experiment (
        subexperiments,
        recorder );
     
      final JpvmInfo  jpvmInfo = createJpvmInfo ( );
     
      final Network  network = new Network (
        simulatorParser.getModelFactory ( ),
        simulatorParser.getDiscreteEventQueue ( ),
        simulatorParser.getModulatedSynapseSeq ( ),
        neurons,
        axonMap,
        jpvmInfo,
        0,    // base
        0,    // minDelay
View Full Code Here

   
    private final SimulatorParser createSimulatorParser( int edgeLengthX,
        int edgeLengthY, int layerMultiplierX, int layerMultiplierY )
    ////////////////////////////////////////////////////////////////////////
    {
      final SimulatorParser simulatorParser = new SimulatorParser();
     
      simulatorParser.layerStructure = createLayerStructure(edgeLengthX,
          edgeLengthY, layerMultiplierX, layerMultiplierY);
     
      simulatorParser.xEdgeLength = edgeLengthX;
View Full Code Here

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

     
      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 Stimulus [ ]  stimuli = new Stimulus [ ] { };
     
      final SubExp [ ]  subexperiments = new SubExp [ ] {
        new SubExp (
          1, // repetition
          1.0, // trialLength
          stimuli,
          null ) }; // discreteEventCollection
     
      final Recorder  recorder = new Recorder (
        simulatorParser,
        false ); // plot
     
      final Experiment  experiment = new Experiment (
        subexperiments,
        recorder );
     
      final Network  network = new Network (
        simulatorParser.getModelFactory ( ),
        simulatorParser.getDiscreteEventQueue ( ),
        simulatorParser.getModulatedSynapseSeq ( ),
        neurons,
        axonMap,
        null, // info
        0,    // base
        0,    // minDelay
View Full Code Here

TOP

Related Classes of cnslab.cnsnetwork.SimulatorParser

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.