Testing and debug with PSU

This commit is contained in:
Martin Zietz
2021-01-26 17:28:37 +01:00
parent a06357a09f
commit 4908338672
10 changed files with 99 additions and 89 deletions
+11 -28
View File
@@ -2,7 +2,6 @@ from tkinter import *
from tkinter import ttk
import settings as g
import cage_func as func
import random as rand
import numpy as np
NORM_FONT = ()
@@ -67,7 +66,7 @@ class TestFrame(Frame): # ToDo: remove
one.pack(fill=X)
two = Label(self, text="Two", bg="blue")
two.pack()
button = ttk.Button(self, text="Print stuff", command=lambda: print_stuff("Hello"))
button = ttk.Button(self, text="Print stuff", command=lambda: print("Hello"))
button.pack()
@@ -149,17 +148,17 @@ class ManualMode(Frame):
def execute(self):
function_to_call = self.modes[self.input_mode.get()][0] # get function of appropriate mode
vector = np.array([0, 0, 0])
vector = np.array([0, 0, 0], dtype=float)
i = 0
for var in self.entry_vars:
vector[i] = float(var.get())
i = i + 1
print(vector)
function_to_call(vector) # call function
# ToDo: update status display here
@staticmethod
def execute_field(vector):
print("field executing")
print("field executing", vector)
try:
func.set_field_simple(vector*1e-6) # ToDo: change to set_field
except ValueError as e:
@@ -167,7 +166,7 @@ class ManualMode(Frame):
@staticmethod
def execute_current(vector):
print("current executing")
print("current executing:", vector)
try:
func.set_current_vec(vector)
except ValueError as e:
@@ -220,6 +219,11 @@ class StatusDisplay(Frame):
col = col + 1
# rowCounter = rowCounter + self.rowNo # increase row counter to place future stuff below this
# add button for reinitialization
reinit_button = Button(self, text="Reinitialize", command=func.setup_axes,
pady=5, padx=5, font=BIG_BUTTON_FONT)
reinit_button.grid(row=0, column=self.columnNo+1, rowspan=3)
self.update_labels(controller)
def update_labels(self, controller):
@@ -243,25 +247,4 @@ class StatusDisplay(Frame):
self.label_dict["Target Current:"][i].set("%0.3f A" % axis.target_current)
self.label_dict["Inverted:"][i].set(axis.polarity_switched)
i = i + 1
controller.after(2000, lambda: self.update_labels(controller))
# ToDo: remove
def print_stuff(stuff):
print(stuff)
def random_no():
return rand.uniform(0, 20)
class TestValues:
def __init__(self):
self.val1 = 0
self.val2 = 0
self.val3 = 0
def update_values(self):
self.val1 = rand.uniform(0, 20)
self.val2 = rand.uniform(0, 20)
self.val3 = rand.uniform(0, 20)
controller.after(500, lambda: self.update_labels(controller))