fix bug
This commit is contained in:
8
kisli.py
8
kisli.py
@@ -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,9 +183,11 @@ 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)
|
||||
|
||||
@@ -26,8 +26,8 @@ class VectorView:
|
||||
pyplot.title('Single Vector')
|
||||
|
||||
## x-lim and y-lim
|
||||
#pyplot.xlim(-2, 5)
|
||||
#pyplot.ylim(-2, 2.5)
|
||||
pyplot.xlim(-1, 10)
|
||||
pyplot.ylim(-2, 11)
|
||||
|
||||
# Show plot with grid
|
||||
pyplot.grid()
|
||||
|
||||
Reference in New Issue
Block a user