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
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;
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;
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;
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
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
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
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;
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;
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
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;
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;
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;
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;
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
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;
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;
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;
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