def templateBidirListConnectionsTest(self, network): for index in range(0, network.num_osc, 1): if (index > 0): assert network.has_connection(index, index - 1) == True; if (index < (network.num_osc - 1)): assert network.has_connection(index, index + 1) == True;
def templateAllToAllConnectionsTest(self, network): for i in range(0, network.num_osc, 1): for j in range(0, network.num_osc, 1): if (i != j): assert network.has_connection(i, j) == True; else: assert network.has_connection(i, j) == False;
def templateNoneConnectionsTest(self, network): assert network.structure == conn_type.NONE for i in range(0, len(network), 1): for j in range(0, len(network), 1): assert network.has_connection(i, j) == False assert network.has_connection(j, i) == False
def templateNoneConnectionsTest(self, network): assert network.structure == conn_type.NONE; for i in range(0, len(network), 1): for j in range(0, len(network), 1): assert network.has_connection(i, j) == False; assert network.has_connection(j, i) == False;
def templateBidirListConnectionsTest(self, network): for index in range(0, network.num_osc, 1): if (index > 0): assert network.has_connection(index, index - 1) == True if (index < (network.num_osc - 1)): assert network.has_connection(index, index + 1) == True
def templateAllToAllConnectionsTest(self, network): for i in range(0, network.num_osc, 1): for j in range(0, network.num_osc, 1): if (i != j): assert network.has_connection(i, j) == True else: assert network.has_connection(i, j) == False
def templateBidirListConnectionsTest(self, network): assert network.structure == conn_type.LIST_BIDIR; for index in range(0, len(network), 1): if (index > 0): assert network.has_connection(index, index - 1) == True; assert network.has_connection(index - 1, index) == True; if (index < (len(network) - 1)): assert network.has_connection(index, index + 1) == True; assert network.has_connection(index + 1, index) == True;
def templateAllToAllConnectionsTest(self, network): assert network.structure == conn_type.ALL_TO_ALL; for i in range(0, len(network), 1): for j in range(0, len(network), 1): if (i != j): assert network.has_connection(i, j) == True; assert network.has_connection(j, i) == True; else: assert network.has_connection(i, j) == False; assert network.has_connection(j, i) == False;
def templateBidirListConnectionsTest(self, network): assert network.structure == conn_type.LIST_BIDIR for index in range(0, len(network), 1): if (index > 0): assert network.has_connection(index, index - 1) == True assert network.has_connection(index - 1, index) == True if (index < (len(network) - 1)): assert network.has_connection(index, index + 1) == True assert network.has_connection(index + 1, index) == True
def templateAllToAllConnectionsTest(self, network): assert network.structure == conn_type.ALL_TO_ALL for i in range(0, len(network), 1): for j in range(0, len(network), 1): if (i != j): assert network.has_connection(i, j) == True assert network.has_connection(j, i) == True else: assert network.has_connection(i, j) == False assert network.has_connection(j, i) == False
def templateGridFourConnectionsTest(self, network): assert network.structure == conn_type.GRID_FOUR; for index in range(0, len(network), 1): upper_index = index - network.width; lower_index = index + network.width; left_index = index - 1; right_index = index + 1; node_row_index = math.ceil(index / network.width); if (upper_index >= 0): assert network.has_connection(index, upper_index) == True; assert network.has_connection(upper_index, index) == True; if (lower_index < len(network)): assert network.has_connection(index, lower_index) == True; assert network.has_connection(lower_index, index) == True; if ( (left_index >= 0) and (math.ceil(left_index / network.width) == node_row_index) ): assert network.has_connection(index, left_index) == True; assert network.has_connection(left_index, index) == True; if ( (right_index < network._num_osc) and (math.ceil(right_index / network.width) == node_row_index) ): assert network.has_connection(index, right_index) == True; assert network.has_connection(right_index, index) == True;
def templateGridFourConnectionsTest(self, network): assert network.structure == conn_type.GRID_FOUR for index in range(0, len(network), 1): upper_index = index - network.width lower_index = index + network.width left_index = index - 1 right_index = index + 1 node_row_index = math.ceil(index / network.width) if (upper_index >= 0): assert network.has_connection(index, upper_index) == True assert network.has_connection(upper_index, index) == True if (lower_index < len(network)): assert network.has_connection(index, lower_index) == True assert network.has_connection(lower_index, index) == True if ((left_index >= 0) and (math.ceil(left_index / network.width) == node_row_index)): assert network.has_connection(index, left_index) == True assert network.has_connection(left_index, index) == True if ((right_index < network._num_osc) and (math.ceil(right_index / network.width) == node_row_index)): assert network.has_connection(index, right_index) == True assert network.has_connection(right_index, index) == True
def templateGridFourConnectionsTest(self, network): for index in range(0, network.num_osc, 1): upper_index = index - 5; lower_index = index + 5; left_index = index - 1; right_index = index + 1; node_row_index = math.ceil(index / 5); if (upper_index >= 0): assert network.has_connection(index, upper_index) == True; if (lower_index < network.num_osc): assert network.has_connection(index, lower_index) == True; if ( (left_index >= 0) and (math.ceil(left_index / 5) == node_row_index) ): assert network.has_connection(index, left_index) == True; if ( (right_index < network.num_osc) and (math.ceil(right_index / 5) == node_row_index) ): assert network.has_connection(index, right_index) == True;
def templateGridFourConnectionsTest(self, network): for index in range(0, network.num_osc, 1): upper_index = index - 5 lower_index = index + 5 left_index = index - 1 right_index = index + 1 node_row_index = math.ceil(index / 5) if (upper_index >= 0): assert network.has_connection(index, upper_index) == True if (lower_index < network.num_osc): assert network.has_connection(index, lower_index) == True if ((left_index >= 0) and (math.ceil(left_index / 5) == node_row_index)): assert network.has_connection(index, left_index) == True if ((right_index < network.num_osc) and (math.ceil(right_index / 5) == node_row_index)): assert network.has_connection(index, right_index) == True
def templateNoneConnectionsTest(self, network): for i in range(0, network.num_osc, 1): for j in range(0, network.num_osc, 1): assert network.has_connection(i, j) == False;
def templateGridEightConnectionsTest(self, network): assert network.structure == conn_type.GRID_EIGHT for index in range(0, len(network), 1): upper_index = index - network.width lower_index = index + network.width left_index = index - 1 right_index = index + 1 node_row_index = math.ceil(index / network.width) if (upper_index >= 0): assert network.has_connection(index, upper_index) == True assert network.has_connection(upper_index, index) == True if (lower_index < len(network)): assert network.has_connection(index, lower_index) == True assert network.has_connection(lower_index, index) == True if ((left_index >= 0) and (math.ceil(left_index / network.width) == node_row_index)): assert network.has_connection(index, left_index) == True assert network.has_connection(left_index, index) == True if ((right_index < len(network)) and (math.ceil(right_index / network.width) == node_row_index)): assert network.has_connection(index, right_index) == True assert network.has_connection(right_index, index) == True side_size = network.width upper_left_index = index - side_size - 1 upper_right_index = index - side_size + 1 lower_left_index = index + side_size - 1 lower_right_index = index + side_size + 1 node_row_index = math.floor(index / side_size) upper_row_index = node_row_index - 1 lower_row_index = node_row_index + 1 if ((upper_left_index >= 0) and (math.floor(upper_left_index / side_size) == upper_row_index)): assert network.has_connection(index, upper_left_index) == True assert network.has_connection(upper_left_index, index) == True if ((upper_right_index >= 0) and (math.floor( upper_right_index / side_size) == upper_row_index)): assert network.has_connection(index, upper_right_index) == True assert network.has_connection(upper_right_index, index) == True if ((lower_left_index < len(network)) and (math.floor(lower_left_index / side_size) == lower_row_index)): assert network.has_connection(index, lower_left_index) == True assert network.has_connection(lower_left_index, index) == True if ((lower_right_index < len(network)) and (math.floor( lower_right_index / side_size) == lower_row_index)): assert network.has_connection(index, lower_right_index) == True assert network.has_connection(lower_right_index, index) == True
def templateNoneConnectionsTest(self, network): for i in range(0, network.num_osc, 1): for j in range(0, network.num_osc, 1): assert network.has_connection(i, j) == False
def templateGridEightConnectionsTest(self, network): assert network.structure == conn_type.GRID_EIGHT; for index in range(0, len(network), 1): upper_index = index - network.width; lower_index = index + network.width; left_index = index - 1; right_index = index + 1; node_row_index = math.ceil(index / network.width); if (upper_index >= 0): assert network.has_connection(index, upper_index) == True; assert network.has_connection(upper_index, index) == True; if (lower_index < len(network)): assert network.has_connection(index, lower_index) == True; assert network.has_connection(lower_index, index) == True; if ( (left_index >= 0) and (math.ceil(left_index / network.width) == node_row_index) ): assert network.has_connection(index, left_index) == True; assert network.has_connection(left_index, index) == True; if ( (right_index < len(network)) and (math.ceil(right_index / network.width) == node_row_index) ): assert network.has_connection(index, right_index) == True; assert network.has_connection(right_index, index) == True; side_size = network.width; upper_left_index = index - side_size - 1; upper_right_index = index - side_size + 1; lower_left_index = index + side_size - 1; lower_right_index = index + side_size + 1; node_row_index = math.floor(index / side_size); upper_row_index = node_row_index - 1; lower_row_index = node_row_index + 1; if ( (upper_left_index >= 0) and (math.floor(upper_left_index / side_size) == upper_row_index) ): assert network.has_connection(index, upper_left_index) == True; assert network.has_connection(upper_left_index, index) == True; if ( (upper_right_index >= 0) and (math.floor(upper_right_index / side_size) == upper_row_index) ): assert network.has_connection(index, upper_right_index) == True; assert network.has_connection(upper_right_index, index) == True; if ( (lower_left_index < len(network)) and (math.floor(lower_left_index / side_size) == lower_row_index) ): assert network.has_connection(index, lower_left_index) == True; assert network.has_connection(lower_left_index, index) == True; if ( (lower_right_index < len(network)) and (math.floor(lower_right_index / side_size) == lower_row_index) ): assert network.has_connection(index, lower_right_index) == True; assert network.has_connection(lower_right_index, index) == True;