Turn off GPU
This commit is contained in:
parent
c4e4b090b6
commit
2604e3889a
3 changed files with 27 additions and 7 deletions
|
@ -1,17 +1,37 @@
|
|||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
height = 10
|
||||
height = 3
|
||||
radius = 2
|
||||
base_radius = 0.5
|
||||
base_length = 1.0
|
||||
base_length = 0.3
|
||||
|
||||
def morph_shape(x, L, H, morph_type="linear"):
|
||||
|
||||
y = np.ones(x.shape[0])
|
||||
if morph_type == "linear":
|
||||
y = (x/L)*H
|
||||
elif morph_type == "logistic":
|
||||
k = 10.0
|
||||
v = 1.0
|
||||
y = H/(1.0 + np.power(np.exp(-k*(x-L/4.0)), v))
|
||||
elif morph_type == "sinusoid":
|
||||
y = np.sin((x/L)*np.pi/2.0)
|
||||
elif morph_type == "hyperbolic_tan":
|
||||
y = np.tanh((x/L)*np.pi/2.0)
|
||||
elif morph_type == "circle":
|
||||
y = np.tanh((x/L)*np.pi/2.0)
|
||||
|
||||
return y
|
||||
|
||||
x_base = np.linspace(0, base_length, 10)
|
||||
y_base = base_radius*np.ones(x_base.shape[0])
|
||||
|
||||
x_lamp = np.linspace(base_length, height, 100)
|
||||
y_lamp = base_radius + ((x_lamp)/height)*(radius-base_radius)
|
||||
|
||||
y_lamp = base_radius + morph_shape(x_lamp-base_length,
|
||||
height-base_length,
|
||||
radius-base_radius,
|
||||
"hyperbolic_tan")
|
||||
x = np.append(x_base, x_lamp)
|
||||
y = np.append(y_base, y_lamp)
|
||||
plt.plot(x, y)
|
||||
|
@ -19,5 +39,5 @@ plt.plot(x, y)
|
|||
axes = plt.gca()
|
||||
axes.set_xlim([0, 1.1*base_length+height])
|
||||
axes.set_ylim([0,1.1*radius])
|
||||
|
||||
plt.axis('equal')
|
||||
plt.show()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue