From 61d30e9365933ff2bf21328edf7ccde78d02578c Mon Sep 17 00:00:00 2001 From: Eggert Jung Date: Thu, 16 Feb 2023 19:32:25 +0100 Subject: [PATCH] work on neighbour view --- kisli.py | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/kisli.py b/kisli.py index bb63fdb..bd507d6 100644 --- a/kisli.py +++ b/kisli.py @@ -191,22 +191,29 @@ if args.fromfile: if args.view == "N": - neigh = np.zeros(shape=(9, 10, 2)) + neighview = np.zeros(shape=(30,32)) i = 0 for row in full_matrix: point_specific_matrix=get_mapped(row) - if(channels.map[i][0]+1 <= 10): - neigh[channels.map[i][0]][channels.map[i][1]][0] = point_specific_matrix[channels.map[i][0]+1][channels.map[i][1]] - if(channels.map[i][1]+1 <= 9): - neigh[channels.map[i][0]][channels.map[i][1]][1] = point_specific_matrix[channels.map[i][0]][channels.map[i][1]+1] - i+=1 - neighview = np.zeros(shape=(18,20)) - for x in range(9): - for y in range(10): - neighview[(x*2)+1][y*2] = neigh[x][y][0] - neighview[x*2][(y*2)+1] = neigh[x][y][1] + #coordinates of specific point + y_pos = channels.map[i][1] - 1 + x_pos = channels.map[i][0] - 1 + + if(x_pos+1 < 9): + neighview[(x_pos*3)+2][(y_pos*3)+1] = point_specific_matrix[x_pos+1][y_pos] + + if(x_pos-1 >= 0): + neighview[(x_pos*3)+0][(y_pos*3)+1] = point_specific_matrix[x_pos-1][y_pos] + + if(y_pos+1 < 10): + neighview[(x_pos*3)+1][(y_pos*3)+2] = point_specific_matrix[x_pos][y_pos+1] + + if(y_pos-1 >= 0): + neighview[(x_pos*3)+1][(y_pos*3)+0] = point_specific_matrix[x_pos][y_pos-1] + + i+=1 viewer = liveview.ResistanceView(maximum=4000) viewer.updateView(neighview)