Пример #1
0
 def testStimulatedOscillatorWithoutLateralPotential(self):
     params = legion_parameters();
     params.teta = 0;    # because no neighbors at all
      
     net = legion_network(1, type_conn = conn_type.NONE, parameters = params, ccore = False);
     dynamic = net.simulate(2000, 400, [1]);
      
     assert extract_number_oscillations(dynamic.output) > 1;
Пример #2
0
 def testUstimulatedOscillatorWithoutLateralPotential(self):
     params = legion_parameters();
     params.teta = 0;    # because no neighbors at all
   
     net = legion_network(1, type_conn = conn_type.NONE, parameters = params, ccore = False);
     dynamic = net.simulate(1000, 200, [0]);
      
     assert extract_number_oscillations(dynamic.output, amplitude_threshold = 0.0) == 0;
Пример #3
0
 def templateOscillationExistance(self, num_osc, own_weight, neigh_weight, steps, time, initial_states = None, initial_outputs = None, conn_repr = conn_represent.MATRIX):
     network = hysteresis_network(num_osc, own_weight, neigh_weight, type_conn_represent = conn_repr);
     
     if (initial_states is not None):
         network.states = initial_states;
         
     if (initial_outputs is not None):
         network.outputs = initial_outputs;
     
     (t, x) = network.simulate(steps, time);
     
     oscillations = [];
     for index in range(num_osc):
         number_oscillations = extract_number_oscillations(x, index, 0.9);
         oscillations.append(number_oscillations)
         
         assert number_oscillations > 1;
         
     return oscillations;
Пример #4
0
 def testExtractNumberOscillationsMonotonicUpSlightlyDown(self):
     value = [ [1.0], [1.5], [2.0], [2.5], [3.0], [3.5], [4.0], [4.5], [5.0], [4.5], [4.0] ];
     assert extract_number_oscillations(value, 0, 2.0) == 0;
Пример #5
0
 def testExtractNumberOscillationsMonotonicDown(self):
     value = [[10.0], [9.5], [9.0], [8.5], [8.0], [7.5], [7.0], [6.5],
              [6.0], [5.5], [5.0]]
     assert extract_number_oscillations(value, 0, 8.0) == 0
Пример #6
0
 def testMixStimulatedThreeOscillators(self):
     net = legion_network(3, type_conn = conn_type.LIST_BIDIR, ccore = False);
     dynamic = net.simulate(1000, 2000, [1, 0, 1]);
       
     assert extract_number_oscillations(dynamic.output, 0) > 1; 
     assert extract_number_oscillations(dynamic.output, 2) > 1;
Пример #7
0
 def templateOscillationsWithStructures(type_conn, ccore_flag):
     net = legion_network(4, type_conn = conn_type.LIST_BIDIR, ccore = ccore_flag);
     dynamic = net.simulate(500, 1000, [1, 1, 1, 1]);
       
     for i in range(len(net)):
         assert extract_number_oscillations(dynamic.output, i) > 1;
Пример #8
0
    def testStimulatedOscillatorWithLateralPotential(self):
        net = legion_network(1, type_conn=conn_type.NONE, ccore=False)
        dynamic = net.simulate(2000, 400, [1])

        assert extract_number_oscillations(dynamic.output,
                                           amplitude_threshold=0.0) >= 1
Пример #9
0
 def testExtractNumberOscillationsDownUpDown(self):
     value = [[0.0], [1.0], [0.0]]
     assert extract_number_oscillations(value, 0, 0.5) == 1
Пример #10
0
 def testExtractNumberOscillationsDownUpDown(self):
     value = [ [0.0], [1.0], [0.0] ];
     assert extract_number_oscillations(value, 0, 0.5) == 1;
Пример #11
0
 def testExtractNumberOscillationsFourPeriodsUnderThreshold(self):
     value = [ [0.0], [1.0], [0.0], [1.0], [0.0], [1.0], [0.0], [1.0], [0.0] ];
     assert extract_number_oscillations(value, 0, 1.5) == 0;
Пример #12
0
 def testExtractNumberOscillationsFourPeriods(self):
     value = [ [0.0], [1.0], [0.0], [1.0], [0.0], [1.0], [0.0], [1.0], [0.0] ];
     assert extract_number_oscillations(value, 0, 0.5) == 4;
Пример #13
0
 def testExtractNumberOscillationsOnePeriodWithHalf(self):
     value = [ [0.0], [1.0], [0.0], [1.0] ];
     assert extract_number_oscillations(value, 0, 0.5) == 1;
Пример #14
0
 def testExtractNumberOscillationsMonotonicDownSlightlyUp(self):
     value = [ [10.0], [9.5], [9.0], [8.5], [8.0], [7.5], [7.0], [6.5], [7.0], [7.1], [7.3] ];
     assert extract_number_oscillations(value, 0, 7.5) == 0;
Пример #15
0
 def testExtractNumberOscillationsFourPeriods(self):
     value = [[0.0], [1.0], [0.0], [1.0], [0.0], [1.0], [0.0], [1.0], [0.0]]
     assert extract_number_oscillations(value, 0, 0.5) == 4
Пример #16
0
 def testExtractNumberOscillationsFourPeriodsUnderThreshold(self):
     value = [[0.0], [1.0], [0.0], [1.0], [0.0], [1.0], [0.0], [1.0], [0.0]]
     assert extract_number_oscillations(value, 0, 1.5) == 0
Пример #17
0
 def testStimulatedOscillatorWithLateralPotential(self):
     net = legion_network(1, type_conn = conn_type.NONE);
     dynamic = net.simulate(1000, 200, [1]);
      
     assert extract_number_oscillations(dynamic.output) == 1;
Пример #18
0
    def testStimulatedTwoOscillators(self):
        net = legion_network(2, type_conn=conn_type.LIST_BIDIR)
        dynamic = net.simulate(1000, 2000, [1, 1])

        assert extract_number_oscillations(dynamic.output, 0) > 1
        assert extract_number_oscillations(dynamic.output, 1) > 1
Пример #19
0
 def testStimulatedTwoOscillators(self):
     net = legion_network(2, type_conn = conn_type.LIST_BIDIR);
     dynamic = net.simulate(1000, 2000, [1, 1]);
      
     assert extract_number_oscillations(dynamic.output, 0) > 1;
     assert extract_number_oscillations(dynamic.output, 1) > 1;
Пример #20
0
    def testMixStimulatedThreeOscillators(self):
        net = legion_network(3, type_conn=conn_type.LIST_BIDIR, ccore=False)
        dynamic = net.simulate(1000, 2000, [1, 0, 1])

        assert extract_number_oscillations(dynamic.output, 0) > 1
        assert extract_number_oscillations(dynamic.output, 2) > 1
Пример #21
0
 def templateOscillationsWithStructures(self, type_conn, ccore_flag = False):
     net = legion_network(4, type_conn = conn_type.LIST_BIDIR, ccore = ccore_flag);
     dynamic = net.simulate(500, 1000, [1, 1, 1, 1]);
      
     for i in range(len(net)):
         assert extract_number_oscillations(dynamic.output, i) > 1;
Пример #22
0
 def testStimulatedOscillatorWithLateralPotential(self):
     net = legion_network(1, type_conn = conn_type.NONE);
     dynamic = net.simulate(1000, 200, [1]);
      
     assert extract_number_oscillations(dynamic.output) == 1;
Пример #23
0
   def testListConnectionRepresentation(self):
       net = legion_network(3, type_conn = conn_type.LIST_BIDIR, type_conn_represent = conn_represent.LIST, ccore = False);
       dynamic = net.simulate(1000, 2000, [1, 0, 1]);
 
       assert extract_number_oscillations(dynamic.output, 0) > 1;  
       assert extract_number_oscillations(dynamic.output, 2) > 1;  
Пример #24
0
 def testStimulatedOscillatorWithLateralPotential(self):
     net = legion_network(1, type_conn = conn_type.NONE, ccore = False);
     dynamic = net.simulate(2000, 400, [1]);
      
     assert extract_number_oscillations(dynamic.output, amplitude_threshold = 0.0) >= 1;
Пример #25
0
 def testExtractNumberOscillationsMonotonicDownSlightlyUp(self):
     value = [[10.0], [9.5], [9.0], [8.5], [8.0], [7.5], [7.0], [6.5],
              [7.0], [7.1], [7.3]]
     assert extract_number_oscillations(value, 0, 7.5) == 0
Пример #26
0
   def testListConnectionRepresentation(self):
       net = legion_network(3, type_conn = conn_type.LIST_BIDIR, type_conn_represent = conn_represent.LIST, ccore = False);
       dynamic = net.simulate(1000, 2000, [1, 0, 1]);
 
       assert extract_number_oscillations(dynamic.output, 0) > 1;  
       assert extract_number_oscillations(dynamic.output, 2) > 1;  
Пример #27
0
 def testExtractNumberOscillationsOnePeriodWithHalf(self):
     value = [[0.0], [1.0], [0.0], [1.0]]
     assert extract_number_oscillations(value, 0, 0.5) == 1
Пример #28
0
 def testExtractNumberOscillationsMonotonicUp(self):
     value = [[1.0], [1.5], [2.0], [2.5], [3.0], [3.5], [4.0], [4.5], [5.0],
              [5.5], [6.0]]
     assert extract_number_oscillations(value, 0, 4.0) == 0
Пример #29
0
 def testExtractNumberOscillationsMonotonicDown(self):
     value = [ [10.0], [9.5], [9.0], [8.5], [8.0], [7.5], [7.0], [6.5], [6.0], [5.5], [5.0] ];
     assert extract_number_oscillations(value, 0, 8.0) == 0;