Skip to content
Snippets Groups Projects
Commit d843d66d authored by Klaus Böhnlein's avatar Klaus Böhnlein
Browse files

Update

parent a87937f8
No related branches found
No related tags found
No related merge requests found
...@@ -108,7 +108,7 @@ lambda1 = 0.0 ...@@ -108,7 +108,7 @@ lambda1 = 0.0
gamma = 1.0/4.0 gamma = 1.0/4.0
gamma = 'infinity' gamma = 'infinity'
# gamma = '0' gamma = '0'
print('mu1: ', mu1) print('mu1: ', mu1)
...@@ -174,11 +174,27 @@ xmax = 0.3 ...@@ -174,11 +174,27 @@ xmax = 0.3
xmin = 0.193 xmin = 0.193
xmax = 0.24 xmax = 0.24
xmin=0.05 xmin=0.01
xmiddle = 0.24#0.24242424242424246 #0.24
xmax=0.4 xmax=0.4
numPoints =100 numPoints_1 = 15
X_Values = np.linspace(xmin, xmax, num=numPoints) numPoints_2 = 15
# test
JumpVal = 0.194 #0.19515151515151516
#X_Values before interesting part
tick = (JumpVal-xmin)/numPoints_1
# tick = (JumpVal-xmin)/numPoints_2
print('tick:' ,tick)
X_Values_one = np.linspace(xmin, JumpVal-tick, num=numPoints_1)
X_Values_middle = np.linspace(JumpVal, xmiddle, num=numPoints_2)
X_Values_two = np.linspace(JumpVal, xmax, num=numPoints_1)
X_Values = np.concatenate([X_Values_one,X_Values_middle,X_Values_two])
print('X_values_one:', X_Values_one)
print('X_values_two:', X_Values_two)
print('X_values:', X_Values) print('X_values:', X_Values)
...@@ -186,8 +202,8 @@ Y_Values = [] ...@@ -186,8 +202,8 @@ Y_Values = []
Angle_Values = [] Angle_Values = []
other = False
# other = True
for theta in X_Values: for theta in X_Values:
...@@ -310,6 +326,11 @@ print("(Output) Values of " + yName + ": ", Y_Values) ...@@ -310,6 +326,11 @@ print("(Output) Values of " + yName + ": ", Y_Values)
# print('np.nonzero(X_Values>x_plotValues[1]', np.nonzero(X_Values>x_plotValues[1]) ) # print('np.nonzero(X_Values>x_plotValues[1]', np.nonzero(X_Values>x_plotValues[1]) )
print('X_values:', X_Values)
print('Y_values:', Y_Values)
# ---------------- Create Plot ------------------- # ---------------- Create Plot -------------------
plt.figure() plt.figure()
...@@ -331,39 +352,49 @@ JumpVal = 0.19 ...@@ -331,39 +352,49 @@ JumpVal = 0.19
X_Values = np.array(X_Values) X_Values = np.array(X_Values)
Y_Values = np.array(Y_Values) Y_Values = np.array(Y_Values)
Angle_Values = np.array(Angle_Values) Angle_Values = np.array(Angle_Values)
X_one = X_Values[X_Values<0.19] # X_one = X_Values[X_Values<0.19]
Y_one = Y_Values[X_Values<0.19] # Y_one = Y_Values[X_Values<0.19]
Angle_one=Angle_Values[X_Values<0.19] # Angle_one=Angle_Values[X_Values<0.19]
X_two = X_Values[X_Values>=0.19] # X_two = X_Values[X_Values>=0.19]
Y_two = Y_Values[X_Values>=0.19] # Y_two = Y_Values[X_Values>=0.19]
Angle_two=Angle_Values[X_Values>=0.19] # Angle_two=Angle_Values[X_Values>=0.19]
X_Values = X_two # X_Values = X_two
Y_Values = Y_two # Y_Values = Y_two
Angle_Values = Angle_two # # Angle_Values = Angle_two
print('X_one:', X_Values) # print('X_one:', X_Values)
color=['r','b','g'] color=['r','b','g']
cmap = cm.get_cmap(name='rainbow') cmap = cm.get_cmap(name='rainbow')
Y_arr = np.asarray(Y_Values, dtype=float) Y_arr = np.asarray(Y_Values, dtype=float)
Angle_arr = np.asarray(Angle_Values, dtype=float) Angle_Values = np.asarray(Angle_Values, dtype=float)
# Angle_two = np.asarray(Angle_two, dtype=float)
X_Values = np.asarray(X_Values, dtype=float) X_Values = np.asarray(X_Values, dtype=float)
Y_one = np.asarray(Y_one, dtype=float) # Y_one = np.asarray(Y_one, dtype=float)
Angle_one = np.asarray(Angle_one, dtype=float) # Angle_one = np.asarray(Angle_one, dtype=float)
X_one = np.asarray(X_one, dtype=float) # X_one = np.asarray(X_one, dtype=float)
# print('X_one:', X_one)
# print('Y_one:', Y_one)
# print('Angle_one:', Angle_one)
print('X_Values:', X_Values) print('X_Values:', X_Values)
print('Y_arr:', Y_arr) print('Y_arr:', Y_arr)
print('Angle_arr:', Angle_arr) # print('Angle_two:', Angle_two)
#
# print('X_Values:', X_Values)
# print('Y_arr:', Y_arr)
# print('Angle_two:', Angle_two)
# Or = np.zeros_like(Y_arr) # Or = np.zeros_like(Y_arr)
Or_tmp = np.ones_like(X_Values) # Or_tmp = np.ones_like(X_Values)
# Or = np.concatenate(([X_Values],[Or_tmp]) ,axis=1) # Or = np.concatenate(([X_Values],[Or_tmp]) ,axis=1)
# Or = np.array([X_Values,Or_tmp]) # Or = np.array([X_Values,Or_tmp])
...@@ -381,19 +412,26 @@ print('ones.', np.ones((5,1),dtype=float)) ...@@ -381,19 +412,26 @@ print('ones.', np.ones((5,1),dtype=float))
# Or = np.hstack([np.transpose(X_Values),np.transpose(Or_tmp)]) # Or = np.hstack([np.transpose(X_Values),np.transpose(Or_tmp)])
# Or = np.hstack((X_Values,np.ones((X_Values.shape[0],1), dtype=X_Values.dtype))) # Or = np.hstack((X_Values,np.ones((X_Values.shape[0],1), dtype=X_Values.dtype)))
X_Values= X_Values.reshape(X_Values.shape[0],1) X_Values= X_Values.reshape(X_Values.shape[0],1)
X_one= X_one.reshape(X_one.shape[0],1) # X_one= X_one.reshape(X_one.shape[0],1)
Or_one = np.hstack((X_one,np.zeros((X_one.shape[0],1),dtype=float))) # Or_one = np.hstack((X_one,np.zeros((X_one.shape[0],1),dtype=float)))
Or = np.hstack((X_Values,np.zeros((X_Values.shape[0],1),dtype=float))) Or = np.hstack((X_Values,np.zeros((X_Values.shape[0],1),dtype=float)))
print('Or:', Or) print('Or:', Or)
# print('Or_one:', Or_one)
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
#normalize #normalize
sum_of_rows = Y_arr.sum(axis=1) sum_of_rows = Y_arr.sum(axis=1)
Y_arrN = Y_arr / sum_of_rows[:,np.newaxis] print('sum_of_rows:', sum_of_rows)
# Y_arrN = Y_arr / sum_of_rows[:,np.newaxis]
Y_arrN = Y_arr / np.linalg.norm(Y_arr, ord=2, axis=1, keepdims=True)
# Y_arrN = Y_arr / np.sqrt(np.sum(Y_arr**2)) # Y_arrN = Y_arr / np.sqrt(np.sum(Y_arr**2))
# print('normalized Y_arrN_OLD:', Y_arrN)
print('normalized Y_arrN:', Y_arrN) print('normalized Y_arrN:', Y_arrN)
# sum_of_rows_one = Y_one.sum(axis=1)
# Y_oneN = Y_one / sum_of_rows_one[:,np.newaxis]
# print('normalized Y_one:', Y_oneN)
plt.grid(b=True, which='major') plt.grid(b=True, which='major')
...@@ -403,8 +441,16 @@ print(Or[:,1]) ...@@ -403,8 +441,16 @@ print(Or[:,1])
print(Or[:,0]) print(Or[:,0])
print(Y_arrN[:,0]) print(Y_arrN[:,0])
#
# print('Or_one[:,1]',Or_one[:,1])
# print(Or_one[:,0])
# print(Y_oneN[:,0])
norm = Normalize() norm = Normalize()
norm.autoscale(Angle_arr) norm.autoscale(Angle_Values) #here full array needed?!
# norm.autoscale(Angle_one)
colormap = cm.RdBu colormap = cm.RdBu
...@@ -415,27 +461,42 @@ colormap = cm.RdBu ...@@ -415,27 +461,42 @@ colormap = cm.RdBu
# Plot only every second one # Plot only every second one
skip = (slice(None,None,2)) skip = (slice(None,None,2))
skip = (slice(None,None,2)) # skip = (slice(None,None,2))
widths = np.linspace(0, 2, X_Values.size)
# Q = ax.quiver(Or[:,0][skip], Or[:,1][skip] , Y_arrN[:,0][skip], Y_arrN[:,1][skip], color = colormap(norm(Angle_arr)), angles='xy', scale=5, units='xy', alpha=0.8, # Q = ax.quiver(Or[:,0][skip], Or[:,1][skip] , Y_arrN[:,0][skip], Y_arrN[:,1][skip], color = colormap(norm(Angle_arr)), angles='xy', scale=5, units='xy', alpha=0.8,
# headwidth=2) # headwidth=2)
Q_2 = ax.quiver(Or[:,0][skip], Or[:,1][skip] , Y_arrN[:,0][skip], Y_arrN[:,1][skip], color = colormap(norm(Angle_arr)), angles='xy', scale=5, units='xy', alpha=0.8, # Q_one = ax.quiver(Or_one[:,0][skip], Or_one[:,1][skip] , Y_one[:,0][skip], Y_one[:,1][skip], color = colormap(norm(Angle_Values)), angles='xy', scale=5, units='xy', alpha=0.8,
headwidth=2) # headwidth=2)
Q = ax.quiver(Or[:,0], Or[:,1] , Y_arrN[:,0], Y_arrN[:,1], color = colormap(norm(Angle_arr)), angles='xy', scale=8, units='xy', alpha=0.8, # Q = ax.quiver(Or[:,0], Or[:,1] , Y_arrN[:,0], Y_arrN[:,1], color = colormap(norm(Angle_Values)), angles='xy', scale=15, units='xy', alpha=0.8,
headwidth=2) # headwidth=2)
# f.colorbar(Q,extend='max') # Q = ax.quiver(Or[:,0], Or[:,1] , Y_arrN[:,0], Y_arrN[:,1], color = colormap(norm(Angle_Values)), angles='xy', units='xy', alpha=0.8, scale=10,
# headwidth=2, linewidths=widths, edgecolors='k')
# Q = ax.quiver(Or[:,0], Or[:,1] , Y_arrN[:,0], Y_arrN[:,1], color = colormap(norm(Angle_Values)), angles='xy', units='xy', alpha=0.8, scale=20,
# headwidth=0.01, headlength=5, width=0.01, edgecolors='k')
# Q = ax.quiver(Or[:,0], Or[:,1] , Y_arrN[:,0], Y_arrN[:,1], color = colormap(norm(Angle_Values)), angles='xy', units='xy', alpha=0.8, scale=20, linewidth=0.1, edgecolors='k')
# Q = ax.quiver(Or[:,0], Or[:,1] , Y_arrN[:,0], Y_arrN[:,1], color = colormap(norm(Angle_Values)) , alpha=0.8, scale=20, linewidth=0.05, edgecolors='k', scale_units='width')
# Q = ax.quiver(Or[:,0], Or[:,1] , Y_arrN[:,0], Y_arrN[:,1], color = colormap(norm(Angle_Values)) , alpha=0.8, scale=15, scale_units='x', linewidth=0.3)
Q = ax.quiver(Or[:,0], Or[:,1] , Y_arrN[:,0], Y_arrN[:,1], color = colormap(norm(Angle_Values)) , alpha=1.0, scale=10 , )
# (Y_Values[:,0].max()-Y_Values[:,0].min())
# f.colorbar(Q,extend='max')
# ax.colorbar(Q )
# ax.quiver(Or[:,0], Or[:,1] , Y_arrN[:,0], Y_arrN[:,1], scale=5, units='xy') # ax.quiver(Or[:,0], Or[:,1] , Y_arrN[:,0], Y_arrN[:,1], scale=5, units='xy')
# ax.quiver(Or[:,0], Or[:,1] , Y_arrN[:,0], Y_arrN[:,1], Angle_arr, angles='xy', scale=5, units='xy') # ax.quiver(Or[:,0], Or[:,1] , Y_arrN[:,0], Y_arrN[:,1], Angle_arr, angles='xy', scale=5, units='xy')
# ax.quiver(Or[:,0], Or[:,1] , Y_arrN[:,0], Y_arrN[:,1], color = colormap(norm(Angle_arr)), angles='xy', scale=15, units='xy') # ax.quiver(Or[:,0], Or[:,1] , Y_arrN[:,0], Y_arrN[:,1], color = colormap(norm(Angle_arr)), angles='xy', scale=15, units='xy')
# ax.quiver(Or[:,0], Or[:,1] , Y_arrN[:,0], Y_arrN[:,1], color = colormap(norm(Angle_arr)), angles='xy', scale=5, units='xy', alpha=0.8, # ax.quiver(Or[:,0], Or[:,1] , Y_arrN[:,0], Y_arrN[:,1], color = colormap(norm(Angle_arr)), angles='xy', scale=5, units='xy', alpha=0.8,
# headwidth=2) # headwidth=2)
ax.scatter(Or[:,0], Or[:,1], c='black', s=10)
ax.scatter(Or[:,0], Or[:,1])
# ax.scatter(Or_one[:,0], Or_one[:,1], c='black', s=10)
# ax.set_aspect('equal') # ax.set_aspect('equal')
# ax.set_aspect('auto') # ax.set_aspect('auto')
# ax.axis([0.1,0.4 , -0.1, 0.75]) # ax.axis([0.1,0.4 , -0.1, 0.75])
...@@ -445,74 +506,91 @@ ax.scatter(Or[:,0], Or[:,1], c='black', s=10) ...@@ -445,74 +506,91 @@ ax.scatter(Or[:,0], Or[:,1], c='black', s=10)
# ax.set_ylim((-0.1, Y_arrN[:,1].max())) # ax.set_ylim((-0.1, Y_arrN[:,1].max()))
ax.set_xlim((0.1, X_Values[:,0].max()+0.2)) plt.axvline(JumpVal,ymin=0, ymax= 1, color = 'g',alpha=0.5, linestyle = 'dashed')
ax.set_ylim((-0.1, 0.2 )) plt.axvline(xmiddle,ymin=0, ymax= 1, color = 'g',alpha=0.5, linestyle = 'dashed')
# ax.tick_params(labelleft = False) plt.axvline(0.13606060606060608,ymin=0, ymax= 1, color = 'g',alpha=0.5, linestyle = 'dashed')
plt.show()
# plt.quiver(Or , Y_arrN[:,0], Y_arrN[:,1])
for i, y in enumerate(Y_Values):
maxes = 1.1*np.amax(abs(Y_Values[i]), axis = 0)
tmp = Y_Values[i]
print('tmp:', tmp)
tmp_normalized = tmp / np.sqrt(np.sum(tmp**2))
print('tmp_normalized:', tmp_normalized)
# origin = np.array([[0, 0, 0],[0, 0, 0]]) # origin point
origin = np.array([X_Values[i], 1])
# origin = np.array([0,0])
print('origin:', origin)
plt.scatter(origin[0],origin[1])
# plt.plot(origin, 'ok')
# plt.axis('equal')
# plt.axis('auto')
plt.xlim([-0.1, 0.4])
plt.ylim([0, 4])
# plt.xlim([-maxes[0], maxes[0]])
# plt.ylim([-maxes[1], maxes[1]])
# plt.quiver(*origin, tmp[0], tmp[1], headlength=4)
# plt.axes().arrow(*origin, tmp[0], tmp[1],head_width=0.05, head_length = 0.1, color = color[1])
# plt.arrow(*origin, tmp[0], tmp[1],head_width=0.05, head_length = 0.1, color = color[1])
# plt.arrow(*origin, tmp_normalized[0], tmp_normalized[1], color = color[1])
# plt.arrow(*origin, tmp_normalized[0], tmp_normalized[1], head_width=0.05, head_length = 0.1, color = color[1])
plt.arrow(*origin, tmp_normalized[0], tmp_normalized[1], head_width=0.05, head_length = 0.1, color = cmap(i))
plt.grid(b=True, which='major')
# plt.quiver(*origin, test[0], test[1], color=['r','b','g'], scale=21)
# plt.quiver(*origin, Y_Values[0][:,0], Y_Values[0][:,1], color=['r','b','g'], scale=21)
# plt.quiver(*origin, Y_Values[:,0], V[:,1], color=['r','b','g'], scale=21)
# plt.quiver(*origin, Y_Values[:,0], V[:,1], color=['r','b','g'], scale=21)
# ax.yaxis.set_major_locator(plt.MultipleLocator(np.pi / 2))
# ax.yaxis.set_minor_locator(plt.MultipleLocator(np.pi / 12))
# ax.yaxis.set_major_formatter(plt.FuncFormatter(format_func))
ax.set_xlim((0.1, X_Values[:,0].max()+0.1))
ax.set_ylim((-0.05, 0.1 ))
ax.set_xticks(np.arange(0, 0.45, step=0.05))
# ax.set(aspect=1)
ax.tick_params(labelleft = False)
cbar = f.colorbar(cm.ScalarMappable(norm=norm, cmap=colormap), ax=ax, ticks=[0 ,np.pi/2])
cbar.ax.set_yticklabels(['0', r"$\pi/2$"])
plt.show() plt.show()
# ax.plot(X_Values, Y_Values) # plt.quiver(Or , Y_arrN[:,0], Y_arrN[:,1])
# ax.scatter(X_Values, Y_Values)
# plt.plot(x_plotValues, y_plotValues,'.')
# plt.scatter(X_Values, Y_Values, alpha=0.3)
# plt.scatter(X_Values, Y_Values)
# plt.plot(X_Values, Y_Values,'.')
# plt.plot([X_Values[0],X_Values[-1]], [Y_Values[0],Y_Values[-1]])
# plt.axis([0, 6, 0, 20])
plt.xlabel(xName)
# plt.ylabel(yName)
plt.ylabel('$\kappa$')
# ax.yaxis.set_major_formatter(ticker.FormatStrFormatter('%g $\pi$'))
# ax.yaxis.set_major_locator(ticker.MultipleLocator(base=0.1))
ax.grid(True) plt.scatter(Or[:,0], Or[:,1], c='black', s=10)
if other:
for i, y in enumerate(Y_Values):
maxes = 1.1*np.amax(abs(Y_Values[i]), axis = 0)
tmp = Y_Values[i]
print('tmp:', tmp)
tmp_normalized = tmp / np.sqrt(np.sum(tmp**2))
print('tmp_normalized:', tmp_normalized)
# origin = np.array([[0, 0, 0],[0, 0, 0]]) # origin point
origin = np.array([X_Values[i], 1])
# origin = np.array([0,0])
print('origin:', origin)
# plt.scatter(origin[0],origin[1])
# plt.plot(origin, 'ok')
# plt.axis('equal')
# plt.axis('auto')
plt.xlim([-0.1, 0.4])
plt.ylim([-0.1, 4])
# plt.xlim([-maxes[0], maxes[0]])
# plt.ylim([-maxes[1], maxes[1]])
# plt.quiver(*origin, tmp[0], tmp[1], headlength=4)
# plt.axes().arrow(*origin, tmp[0], tmp[1],head_width=0.05, head_length = 0.1, color = color[1])
# plt.arrow(*origin, tmp[0], tmp[1],head_width=0.05, head_length = 0.1, color = color[1])
# plt.arrow(*origin, tmp_normalized[0], tmp_normalized[1], color = color[1])
# plt.arrow(*origin, tmp_normalized[0], tmp_normalized[1], head_width=0.05, head_length = 0.1, color = color[1])
# plt.arrow(*origin, tmp_normalized[0], tmp_normalized[1], head_width=0.05, head_length = 0.1, color = cmap(i))
# plt.arrow(origin[i,0], origin[i,1], tmp_normalized[0], tmp_normalized[1], head_width=0.05, head_length = 0.1, color = cmap(i))
# plt.arrow(origin[i,0], origin[i,1], tmp_normalized[0], tmp_normalized[1], head_width=0.05, head_length = 0.1, color = cmap(i))
# w = 0.005 * (y - ymin) / (ymax - ymin)
w = 0.005
plt.quiver(Or[i,0], Or[i,1] , Y_arrN[i,0], Y_arrN[i,1], color = colormap(norm(Angle_Values)), angles='xy', units='xy', alpha=0.8,
headwidth=2, width=w, edgecolors='k')
plt.grid(b=True, which='major')
# plt.quiver(*origin, test[0], test[1], color=['r','b','g'], scale=21)
# plt.quiver(*origin, Y_Values[0][:,0], Y_Values[0][:,1], color=['r','b','g'], scale=21)
# plt.quiver(*origin, Y_Values[:,0], V[:,1], color=['r','b','g'], scale=21)
# plt.quiver(*origin, Y_Values[:,0], V[:,1], color=['r','b','g'], scale=21)
plt.show()
# ax.plot(X_Values, Y_Values)
# ax.scatter(X_Values, Y_Values)
# plt.plot(x_plotValues, y_plotValues,'.')
# plt.scatter(X_Values, Y_Values, alpha=0.3)
# plt.scatter(X_Values, Y_Values)
# plt.plot(X_Values, Y_Values,'.')
# plt.plot([X_Values[0],X_Values[-1]], [Y_Values[0],Y_Values[-1]])
# plt.axis([0, 6, 0, 20])
plt.xlabel(xName)
# plt.ylabel(yName)
plt.ylabel('$\kappa$')
# ax.yaxis.set_major_formatter(ticker.FormatStrFormatter('%g $\pi$'))
# ax.yaxis.set_major_locator(ticker.MultipleLocator(base=0.1))
ax.grid(True)
# # if angle PLOT : # # if angle PLOT :
# ax.yaxis.set_major_locator(plt.MultipleLocator(np.pi / 2)) # ax.yaxis.set_major_locator(plt.MultipleLocator(np.pi / 2))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment