|
|
|
|
@ -138,13 +138,15 @@ def done():
|
|
|
|
|
|
|
|
|
|
def calc_vector(px, py, point_specific_matrix):
|
|
|
|
|
vect = [0, 0]
|
|
|
|
|
print("spcific point = {}, {}".format(px, py))
|
|
|
|
|
for x in range(9):
|
|
|
|
|
for y in range(10):
|
|
|
|
|
if(px != x or py != y):
|
|
|
|
|
diff = [px-x, py-y] #Abstandsvektor
|
|
|
|
|
diff = [x-px, y-py] #Abstandsvektor
|
|
|
|
|
mag = np.sqrt(diff[0]**2 + diff[1]**2) #betrag
|
|
|
|
|
vect[0] += point_specific_matrix[x][y]*diff[0] / mag
|
|
|
|
|
vect[1] += point_specific_matrix[x][y]*diff[1] / mag
|
|
|
|
|
print("{}: vect += {} / {} == {}".format([x,y],diff, mag, vect))
|
|
|
|
|
return vect
|
|
|
|
|
|
|
|
|
|
""" ==============================================================================================================
|
|
|
|
|
@ -181,14 +183,40 @@ if args.fromfile:
|
|
|
|
|
vectormap = np.zeros(shape=(90, 2))
|
|
|
|
|
i = 0
|
|
|
|
|
for row in full_matrix:
|
|
|
|
|
print(i)
|
|
|
|
|
point_specific_matrix=get_mapped(row)
|
|
|
|
|
vectormap[i] = calc_vector(0, 0, point_specific_matrix)
|
|
|
|
|
vectormap[i] = calc_vector(channels.map[i][0], channels.map[i][1], point_specific_matrix)
|
|
|
|
|
i+=1
|
|
|
|
|
print()
|
|
|
|
|
|
|
|
|
|
mapped_vectormap = get_vector_mapped(vectormap)
|
|
|
|
|
mapped_vectormap /= max(mapped_vectormap.min(), mapped_vectormap.max(), key=abs)
|
|
|
|
|
print(mapped_vectormap)
|
|
|
|
|
viewer = liveview.VectorView(mapped_vectormap)
|
|
|
|
|
|
|
|
|
|
if args.view == "N":
|
|
|
|
|
neighview = np.zeros(shape=(30,32))
|
|
|
|
|
|
|
|
|
|
i = 0
|
|
|
|
|
for row in full_matrix:
|
|
|
|
|
point_specific_matrix=get_mapped(row)
|
|
|
|
|
|
|
|
|
|
#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)
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
s = socket.socket() # Establish a TCP/IP socket object
|
|
|
|
|
@ -221,6 +249,7 @@ if args.view == "M":
|
|
|
|
|
viewer = liveview.ResistanceView(maximum=full_matrix.max())
|
|
|
|
|
viewer.updateView(get_mapped(np.mean(full_matrix, axis = 0)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if args.tofile:
|
|
|
|
|
np.savetxt(args.tofile, full_matrix, delimiter="\t")
|
|
|
|
|
|
|
|
|
|
|