forked from zietzm/Helmholtz_Test_Bench
Minor formatting warnings for tkinter gui fixed
This commit is contained in:
+17
-12
@@ -758,7 +758,7 @@ class ExecuteCSVMode(Frame):
|
||||
if np.linalg.norm(rot_vector) != 1:
|
||||
ui_print("Warning: Rotation axis not normalised. Normalising automatically.")
|
||||
for i in range(len(rot_vector)):
|
||||
self.rot_vector_vars[i].set("{:.3f}".format(v[i]))
|
||||
self.rot_vector_vars[i].set(round(v[i], 3))
|
||||
# Checking magnitude
|
||||
if rot_mag < 0:
|
||||
ui_print("Warning: Magnetic field magnitude cannot be negative. Changing sign automatically.")
|
||||
@@ -769,13 +769,13 @@ class ExecuteCSVMode(Frame):
|
||||
elif rot_mag > rot_mag_max:
|
||||
ui_print("Warning: Magnetic field magnitude too large. Setting default automatically.")
|
||||
rot_mag = rot_mag_default
|
||||
self.rot_mag_vars.set("{:.3f}".format(rot_mag))
|
||||
self.rot_mag_vars.set(round(rot_mag, 3))
|
||||
# Checking center point
|
||||
if np.sqrt(rot_center[0] ** 2 + rot_center[1] ** 2 + rot_center[2] ** 2) > rot_center_geom_mean_max:
|
||||
ui_print("Warning: Rotation center excessive. Setting to zero automatically.")
|
||||
rot_center = rot_center_default
|
||||
for i in range(len(rot_center)):
|
||||
self.rot_center_vars[i].set("{:.3f}".format(rot_center[i]))
|
||||
self.rot_center_vars[i].set(round(rot_center[i], 3))
|
||||
# Check time step
|
||||
if rot_time_step < 0:
|
||||
ui_print("Warning: Time step cannot be negative. Changing sign automatically.")
|
||||
@@ -786,7 +786,7 @@ class ExecuteCSVMode(Frame):
|
||||
elif rot_time_step < rot_time_step_min:
|
||||
ui_print("Warning: Time step too small (<{:.3f}). Setting default automatically.".format(rot_time_step_min))
|
||||
rot_time_step = rot_time_step_default
|
||||
self.rot_time_step_vars.set("{:.3f}".format(rot_time_step))
|
||||
self.rot_time_step_vars.set(round(rot_time_step, 3))
|
||||
# Check cycle number
|
||||
rot_cycle_number = self.rot_cycle_number_vars.get()
|
||||
if rot_cycle_number < 1:
|
||||
@@ -796,14 +796,19 @@ class ExecuteCSVMode(Frame):
|
||||
if not rot_cycle_number.is_integer():
|
||||
ui_print("Warning: cycle number must be an integer. Rounding to nearest integer")
|
||||
rot_cycle_number = round(rot_cycle_number)
|
||||
self.rot_cycle_number_vars.set("{:d}".format(rot_cycle_number))
|
||||
self.rot_cycle_number_vars.set(rot_cycle_number)
|
||||
# Variable rotation rate
|
||||
# Solve integral of r(t) = r_0 + r_1 * t + r_2 * t ^ 2 + r3 * sin(r_4 * t + r_5) from 0 to tau
|
||||
angle = 360 * rot_cycle_number # [deg] Cycle number multiples of full circle
|
||||
func = lambda tau2: r[0] + r[1] * tau2 + r[2] * tau2 ** 2 + r[3] * (np.sin(r[4] * tau2 + r[5]))
|
||||
func_integral = lambda tau: angle - (r[0] * tau + r[1] / 2 * tau ** 2 + r[2] / 3 * tau ** 3
|
||||
- r[3] * (np.cos(r[4] * tau + r[5]) + np.cos(r[5]))
|
||||
+ r[3] * r[4] * (np.sin(r[4] * tau + r[5]) - np.sin(r[5])))
|
||||
|
||||
def func(tau2):
|
||||
return r[0] + r[1] * tau2 + r[2] * tau2 ** 2 + r[3] * (np.sin(r[4] * tau2 + r[5]))
|
||||
|
||||
def func_integral(tau):
|
||||
return angle - (r[0] * tau + r[1] / 2 * tau ** 2 + r[2] / 3 * tau ** 3
|
||||
- r[3] * (np.cos(r[4] * tau + r[5]) + np.cos(r[5]))
|
||||
+ r[3] * r[4] * (np.sin(r[4] * tau + r[5]) - np.sin(r[5])))
|
||||
|
||||
tau_solution = -1
|
||||
i = 0 # iterator and guess variable [s]
|
||||
while tau_solution < 0 or abs(func_integral(tau_solution)) > 0.5:
|
||||
@@ -2180,9 +2185,9 @@ class CalibrateMagnetometerComplete(Frame):
|
||||
self.b_result_vars[row].set("{:.3e}".format(result[0]['b'][row][0]))
|
||||
self.n_result_vars[row].set("{:.3e}".format(result[0]['n'][row][0]))
|
||||
for column in range(3):
|
||||
self.a_mat_result_vars[row][column].set("{:.6f}".format(result[0]['a_mat'][row][column]))
|
||||
self.a_mat_inv_result_vars[row][column].set("{:.6f}".format(result[0]['a_mat_inv'][row][column]))
|
||||
self.q_mat_result_vars[row][column].set("{:.6f}".format(result[0]['q_mat'][row][column]))
|
||||
self.a_mat_result_vars[row][column].set(round(result[0]['a_mat'][row][column], 6))
|
||||
self.a_mat_inv_result_vars[row][column].set(round(result[0]['a_mat_inv'][row][column], 6))
|
||||
self.q_mat_result_vars[row][column].set(round(result[0]['q_mat'][row][column], 6))
|
||||
|
||||
# Populate clipboard string
|
||||
self.clipboard_calibration_results_complete = "A_mat [-]\n"
|
||||
|
||||
Reference in New Issue
Block a user