예제 #1
0
    def testMixStimulatedThreeOscillators(self):
        net = legion_network(3, [1, 0, 1], type_conn=conn_type.LIST_BIDIR)
        (t, x, z) = net.simulate(1000, 2000)

        assert extract_number_oscillations(x, 0) > 1
        assert extract_number_oscillations(x, 1) == 1
        assert extract_number_oscillations(x, 2) > 1
예제 #2
0
    def testListConnectionRepresentation(self):
        net = legion_network(3, [1, 0, 1], type_conn = conn_type.LIST_BIDIR, type_conn_represent = conn_represent.LIST);
        (t, x, z) = net.simulate(1000, 2000);
 
        assert extract_number_oscillations(x, 0) > 1;
        assert extract_number_oscillations(x, 1) == 1;   
        assert extract_number_oscillations(x, 2) > 1;  
예제 #3
0
 def testMixStimulatedThreeOscillators(self):
     net = legion_network(3, [1, 0, 1], type_conn = conn_type.LIST_BIDIR);
     (t, x, z) = net.simulate(1000, 2000);
      
     assert extract_number_oscillations(x, 0) > 1;
     assert extract_number_oscillations(x, 1) == 1;   
     assert extract_number_oscillations(x, 2) > 1;       
예제 #4
0
 def testUnstimulatedTwoOscillators(self):
     params = legion_parameters();
     params.teta_p = 2.5;
      
     net = legion_network(2, [0, 0], type_conn = conn_type.LIST_BIDIR, parameters = params);
     (t, x, z) = net.simulate(1000, 1000);
      
     assert extract_number_oscillations(x, 0) == 1;
     assert extract_number_oscillations(x, 1) == 1;
예제 #5
0
    def testListConnectionRepresentation(self):
        net = legion_network(3, [1, 0, 1],
                             type_conn=conn_type.LIST_BIDIR,
                             type_conn_represent=conn_represent.LIST)
        (t, x, z) = net.simulate(1000, 2000)

        assert extract_number_oscillations(x, 0) > 1
        assert extract_number_oscillations(x, 1) == 1
        assert extract_number_oscillations(x, 2) > 1
예제 #6
0
    def testUnstimulatedTwoOscillators(self):
        params = legion_parameters()
        params.teta_p = 2.5

        net = legion_network(2, [0, 0],
                             type_conn=conn_type.LIST_BIDIR,
                             parameters=params)
        (t, x, z) = net.simulate(1000, 1000)

        assert extract_number_oscillations(x, 0) == 1
        assert extract_number_oscillations(x, 1) == 1
예제 #7
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
예제 #8
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);
     dynamic = net.simulate(1000, 200, [1]);
      
     assert extract_number_oscillations(dynamic.output) > 1;      
예제 #9
0
 def testUstimulatedOscillatorWithoutLateralPotential(self):
     params = legion_parameters();
     params.teta = 0;    # because no neighbors at all
  
     net = legion_network(1, [0], type_conn = conn_type.NONE, parameters = params);
     (t, x, z) = net.simulate(1000, 200);
      
     assert extract_number_oscillations(x) == 1;
예제 #10
0
    def testStimulatedOscillatorWithoutLateralPotential(self):
        params = legion_parameters()
        params.teta = 0
        # because no neighbors at all

        net = legion_network(1, [1],
                             type_conn=conn_type.NONE,
                             parameters=params)
        (t, x, z) = net.simulate(1000, 200)

        assert extract_number_oscillations(x) > 1
예제 #11
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;
예제 #12
0
 def testMixStimulatedThreeOscillators(self):
     net = legion_network(3, type_conn = conn_type.LIST_BIDIR);
     dynamic = net.simulate(1000, 2000, [1, 0, 1]);
      
     assert extract_number_oscillations(dynamic.output, 0) > 1; 
     assert extract_number_oscillations(dynamic.output, 2) > 1;       
예제 #13
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;
예제 #14
0
 def templateOscillationsWithStructures(self, type_conn):
     net = legion_network(4, [1, 1, 1, 1], type_conn = conn_type.LIST_BIDIR);
     (t, x, z) = net.simulate(500, 1000);
      
     for i in range(net.num_osc):
         assert extract_number_oscillations(x, i) > 1;
예제 #15
0
    def testStimulatedOscillatorWithLateralPotential(self):
        net = legion_network(1, [1], type_conn=conn_type.NONE)
        (t, x, z) = net.simulate(1000, 200)

        assert extract_number_oscillations(x) == 1
예제 #16
0
    def testListConnectionRepresentation(self):
        net = legion_network(3, type_conn = conn_type.LIST_BIDIR, type_conn_represent = conn_represent.LIST);
        dynamic = net.simulate(1000, 2000, [1, 0, 1]);
 
        assert extract_number_oscillations(dynamic.output, 0) > 1;  
        assert extract_number_oscillations(dynamic.output, 2) > 1;  
예제 #17
0
 def testStimulatedOscillatorWithLateralPotential(self):
     net = legion_network(1, [1], type_conn = conn_type.NONE);
     (t, x, z) = net.simulate(1000, 200);
      
     assert extract_number_oscillations(x) == 1;
예제 #18
0
 def templateOscillationsWithStructures(self, type_conn):
     net = legion_network(4, type_conn = conn_type.LIST_BIDIR);
     dynamic = net.simulate(500, 1000, [1, 1, 1, 1]);
      
     for i in range(net.num_osc):
         assert extract_number_oscillations(dynamic.output, i) > 1;
예제 #19
0
    def templateOscillationsWithStructures(self, type_conn):
        net = legion_network(4, [1, 1, 1, 1], type_conn=conn_type.LIST_BIDIR)
        (t, x, z) = net.simulate(500, 1000)

        for i in range(net.num_osc):
            assert extract_number_oscillations(x, i) > 1