Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Pythonlib

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

Multiple plots

fig, axs = plt.subplots(2, 2,figsize=(10,10))


axs[0, 0].plot(Time, Potential)
axs[0, 0].set_title('Time Vs. Potential')
axs[0, 0].set_xlabel('Time')
axs[0, 0].set_ylabel('Potential')
axs[0, 1].plot(Time, Temp, 'tab:orange')
axs[0, 1].set_title('Time Vs. Temp')
axs[0, 1].set_xlabel('Time')
axs[0, 1].set_ylabel('Temperature')
axs[1, 0].plot(Time, KinEng, 'tab:green')
axs[1, 0].set_title('Time Vs. KinEng')
axs[1, 0].set_xlabel('Time')
axs[1, 0].set_ylabel('KinEng')
axs[1, 1].plot(Time, Pressure, 'tab:red')
axs[1, 1].set_title('Time Vs. Pressure')
axs[1, 1].set_xlabel('Time')
axs[1, 1].set_ylabel('Pressure')
plt.show()

Merging plots
fig, (axs1, axs2) = plt.subplots(2, figsize=(10,10))
axs1.plot(Time, Potential, 'tab:blue', label = 'potential')
axs1.legend()
axs1.plot(Time, KinEng, 'tab:green', label = 'kinetic_energy')
axs1.set_xlabel("Time-ps")
axs1.set_ylabel("Potential / Kinetic energy")
axs1.legend()
axs2.plot(Time, Temp, 'tab:orange', label = 'Temperature')
axs2.legend()
axs2.plot(Time, Pressure, 'tab:red', label = 'Pressure')
axs2.set_xlabel("Time-ps")
axs2.set_ylabel("Pressure / Temperature")
axs2.legend()

plt.xlabel('Time (ps)', size = 25)

fig, ax = plt.subplots(figsize=(8,8))
ax = plt.gca()
ax.set_xlim((0, 7))
ax.set_ylim((-0.5, 6))
for i in even:
circle = plt.Circle((i[0], i[1]), 0.5, color='r', alpha=1, fill=False)
ax.add_patch(circle)

plt.title('Hexagonal_grid')
plt.ylabel('y_axis')
plt.xlabel('x_axis')
n = np.linspace(1,len(even)+1,len(even)+1)

x_vals=[]
y_vals=[]
for k in even:
x_vals.append(k[0])
y_vals.append(k[1])

for i, txt in enumerate(n):


ax.annotate(txt, (x_vals[i], y_vals[i]))
import numpy as np
A = [[2,1,4,3],[1,-2,0,3],[3,2,-1,1],[0,4,0,5]]
Y = [5,3,-1,3]

res = np.linalg.inv(A).dot(Y)
print(res)

# U = ExcelWriter('K_s.xlsx')
# for i, j in zip(Ks, enumerate(A)):
# df = pd.DataFrame(i)
# df.to_excel(U, sheet_name='sheet ' + str(j[0]))
# U.save()

# R = ExcelWriter('As.xlsx')
# for i, j, k in zip(A, enumerate(A), EL):
# print(k)
# df = pd.DataFrame(i)
# df.to_excel(R, sheet_name='sheet ' + str(j[0]))
# R.save()

# print(K_global.shape)
# K_mat = pd.DataFrame(K_global)
# K_mat.to_excel(excel_writer = "C:/Users/Vikas/Desktop/Project
files/others/K_vector.xlsx")
# K_mat = pd.read_excel (r'C:/Users/Vikas/Desktop/Project
files/others/K_vector.xlsx')
# K_mat_Row_delete = K_mat.drop(index=Delet)
# column_k_global = K_mat_Row_delete.drop(columns=Delet)
# updated_K = column_k_global.drop("Unnamed: 0",axis=1)
# print(updated_K.shape)

# force_mat = pd.DataFrame(force_vector)
# force_mat.to_excel(excel_writer = "C:/Users/Vikas/Desktop/Project
files/others/F_vector.xlsx")
# force_mat = pd.read_excel (r'C:/Users/Vikas/Desktop/Project
files/others/F_vector.xlsx')
# column_force_matix = force_mat.drop(index=Delet)
# updated_F = column_force_matix.drop("Unnamed: 0",axis=1)
# print(updated_F.shape)

import numpy
import matplotlib
import scipy;
import shapely
print("shapely library version: ", shapely.__version__)
print("scipy library version: ", scipy.__version__)
print("matplotlib library version: ", matplotlib.__version__)
print("numpy library version: ", numpy.__version__)

py.test -v Test_unit_functions.py::test_inside_circ
python -c 'import Test_unit_functions; Test_unit_functions.test_inside_circ()'

py.test -v Test_unit_functions.py::test_Global_to_local_CT
python -c 'import Test_unit_functions;
Test_unit_functions.test_Global_to_local_CT()'
py.test -v Test_unit_functions.py::test_kinematics
python -c 'import Test_unit_functions; Test_unit_functions.test_kinematics()'

py.test -v Test_unit_functions.py::test_uniform_mesh
python -c 'import Test_unit_functions; Test_unit_functions.test_uniform_mesh()'

py.test -v Test_unit_functions.py::test_step_function
python -c 'import Test_unit_functions; Test_unit_functions.test_step_function()'

py.test -v Test_unit_functions.py::test_heaviside_functions
python -c 'import Test_unit_functions;
Test_unit_functions.test_heaviside_functions()'

py.test -v Test_unit_functions.py::test_addAtPos
python -c 'import Test_unit_functions; Test_unit_functions.test_addAtPos()'

py.test -v Test_unit_functions.py::test_node_filtering
python -c 'import Test_unit_functions; Test_unit_functions.test_node_filtering()'

py.test -v Test_unit_functions.py::test_connectivity_matrix
python -c 'import Test_unit_functions;
Test_unit_functions.test_connectivity_matrix()'

py.test -v Test_unit_functions.py::test_asymptotic_functions
python -c 'import Test_unit_functions;
Test_unit_functions.test_asymptotic_functions()'

py.test -v Test_unit_functions.py::test_Gausspoints
python -c 'import Test_unit_functions; Test_unit_functions.test_Gausspoints()'

py.test -v Test_unit_functions.py::test_tip_enrichment_func_N1
python -c 'import Test_unit_functions;
Test_unit_functions.test_tip_enrichment_func_N1()'

py.test -v test_patch.py::test_LE_patch
python -c 'import test_patch; test_patch.test_LE_patch()'

py.test -v test_patch.py::test_displacement_2x2
python -c 'import test_patch; test_patch.test_displacement_2x2()'

py.test -v test_patch.py::test_isotropic_material_prop
python -c 'import test_patch; test_patch.test_isotropic_material_prop()'

py.test -v test_patch.py::test_Jacobian
python -c 'import test_patch; test_patch.test_Jacobian()'

py.test -v Test_unit_functions.py::test_E_filter
python -c ’import Test_unit_functions; Test_unit_functions.test_E_filter()’

fig.savefig(f"{Id}Stress_plot_{No}.png")

Renate Schwender
DE44 8705 2000 4113 0485 98

You might also like