Delete development file for rotation field

This commit is contained in:
2023-02-11 21:56:46 +01:00
parent aa9efdba5a
commit 5f161fe09e
-55
View File
@@ -1,55 +0,0 @@
import numpy as np
import matplotlib.pyplot as plt
plot_fontsize = 12
in_rot_vector = [0, 0, 1] # [-]
in_rotcenter = [0, 0, 0] # [uT]
in_rotmag = 10 # [uT]
in_rotrate = 1 # [deg/s]
in_timestep = 1 # [s]
# Normalize rotation vector
if np.linalg.norm(in_rot_vector)==0:
# ui_print("Error: Rotation axis cannot be singular.")
raise ValueError('Zero vector for rotation axis given!')
else:
v = in_rot_vector / np.linalg.norm(in_rot_vector)
# Find perpendiculat vectors
if v[1] == 0 and v[2] == 0:
a = np.cross(v, [0, 1, 0])
else:
a = np.cross(v, [1, 0, 0])
b = np.cross(v, a)
print(v)
print(a)
print(b)
# Some vectors
c = [1, 2, 3]
r = in_rotmag
# Get full rotation array
cycle_time = (360/in_rotrate)/in_timestep
arr_len = int(np.floor(cycle_time/in_timestep))
th = 0 # [rad]
x = np.zeros(arr_len)
y = np.zeros(arr_len)
z = np.zeros(arr_len)
# Calculate vectors
for i in range(arr_len):
th = th+in_rotrate*np.pi/180
x[i] = in_rotcenter[0] + in_rotmag*np.cos(th)*a[0]+r*np.sin(th)*b[0]
y[i] = in_rotcenter[1] + in_rotmag*np.cos(th)*a[1]+r*np.sin(th)*b[1]
z[i] = in_rotcenter[2] + in_rotmag*np.cos(th)*a[2]+r*np.sin(th)*b[2]
ax = plt.figure().add_subplot(projection='3d')
ax.plot(x[0], y[0], z[0], 'o', color='blue')
ax.plot(x, y, z, label='curve in (x, y,z)')
ax.plot(x[arr_len-1], y[arr_len-1], z[arr_len-1], '^', color='red')
ax.set_xlabel(r'$B_x [{\mu}T]$', fontsize=plot_fontsize)
ax.set_ylabel(r'$B_y [{\mu}T]$', fontsize=plot_fontsize)
ax.set_zlabel(r'$B_z [{\mu}T]$', fontsize=plot_fontsize)
plt.show()