Skip to content
Snippets Groups Projects
Commit 10449c07 authored by Alexandros Asonitis's avatar Alexandros Asonitis
Browse files

backend destroys everything in the plots

parent 9527bb05
No related branches found
No related tags found
No related merge requests found
from interface import * from interface import *
import control import control
import matplotlib.pyplot as plt
from help import * from help import *
import time import time
from IPython.display import clear_output from IPython.display import clear_output
...@@ -8,6 +7,7 @@ import numpy as np ...@@ -8,6 +7,7 @@ import numpy as np
import datetime import datetime
import pandas as pd import pandas as pd
import matplotlib.pyplot as plt
#connect to device #connect to device
device = control.hp4194() device = control.hp4194()
...@@ -27,8 +27,6 @@ display(hbox1) ...@@ -27,8 +27,6 @@ display(hbox1)
hbox2=widgets.HBox([messparameter,sweep_parameter]) hbox2=widgets.HBox([messparameter,sweep_parameter])
display(hbox2,out) display(hbox2,out)
#add widgets to a list for disabling them #add widgets to a list for disabling them
all_widgets = [measure] all_widgets = [measure]
add_widgets_to_list(sample_dict,all_widgets) add_widgets_to_list(sample_dict,all_widgets)
...@@ -115,10 +113,8 @@ def on_measure_clicked(b): ...@@ -115,10 +113,8 @@ def on_measure_clicked(b):
# frequency index # frequency index
f_index = messparameter_dict['f_point'].value-1 f_index = messparameter_dict['f_point'].value-1
# create the figure # create the figure
fig = plt.figure(layout = "constrained") fig = plt.figure(figsize=(15,9),layout = "constrained")
spec = fig.add_gridspec(ncols=3, nrows=2) spec = fig.add_gridspec(ncols=3, nrows=2)
ax1 = fig.add_subplot(spec[0,0]) ax1 = fig.add_subplot(spec[0,0])
...@@ -161,8 +157,8 @@ def on_measure_clicked(b): ...@@ -161,8 +157,8 @@ def on_measure_clicked(b):
ax6.set_ylabel("Cp (F)") ax6.set_ylabel("Cp (F)")
ax6_twin.set_ylabel("D") ax6_twin.set_ylabel("D")
mng = plt.get_current_fig_manager() figManager = plt.get_current_fig_manager()
mng.window.state('zoomed') figManager.window.state('zoomed')
for bias in biases: for bias in biases:
view["v-value"].value = str(bias) view["v-value"].value = str(bias)
...@@ -284,7 +280,7 @@ def on_measure_clicked(b): ...@@ -284,7 +280,7 @@ def on_measure_clicked(b):
ax6_twin.scatter(freq,D, color = 'y') ax6_twin.scatter(freq,D, color = 'y')
ax6_twin.tick_params(axis='y',labelcolor = 'y') ax6_twin.tick_params(axis='y',labelcolor = 'y')
fig.draw() plt.pause(0.1)
if messparameter_dict["hysterisis"].value == True: if messparameter_dict["hysterisis"].value == True:
reversed_biases = reversed_array(biases) reversed_biases = reversed_array(biases)
for bias in reversed_biases: for bias in reversed_biases:
...@@ -406,9 +402,9 @@ def on_measure_clicked(b): ...@@ -406,9 +402,9 @@ def on_measure_clicked(b):
ax6_twin.scatter(freq,D, color = 'r') ax6_twin.scatter(freq,D, color = 'r')
ax6_twin.tick_params(axis='y',labelcolor = 'r') ax6_twin.tick_params(axis='y',labelcolor = 'r')
fig.draw() plt.pause(0.1)
fig.show() plt.show()
device.write('bias_off') device.write('bias_off')
# save to file # save to file
......
%% Cell type:code id:912606ea-a3b6-43e8-94c5-8f1fe5281375 tags: %% Cell type:code id:912606ea-a3b6-43e8-94c5-8f1fe5281375 tags:
``` python ``` python
%matplotlib tk
%run cv.py %run cv.py
``` ```
%% Output %% Output
%% Cell type:code id:4f6be5c3-0ab8-4f18-88f6-02ce464a99f7 tags:
``` python
```
......
%% Cell type:code id:52e7274d-b638-4da1-acca-94cfc0c86c5a tags: %% Cell type:code id:52e7274d-b638-4da1-acca-94cfc0c86c5a tags:
``` python ``` python
%matplotlib tk %matplotlib qt
``` ```
%% Cell type:code id:0a1db92b-e4d3-49f4-a95f-40d58e575404 tags: %% Cell type:code id:0a1db92b-e4d3-49f4-a95f-40d58e575404 tags:
``` python ``` python
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
# create the figure # create the figure
fig = plt.figure(layout = "constrained") fig = plt.figure(layout = "constrained")
spec = fig.add_gridspec(ncols=3, nrows=2) spec = fig.add_gridspec(ncols=3, nrows=2)
ax1 = fig.add_subplot(spec[0,0]) ax1 = fig.add_subplot(spec[0,0])
ax1_twin = ax1.twinx() ax1_twin = ax1.twinx()
ax1.set_title("Cp/D(f) live") ax1.set_title("Cp/D(f) live")
ax1.set_xlabel("Frequency (Hz)") ax1.set_xlabel("Frequency (Hz)")
ax1.set_ylabel("Cp (F)") ax1.set_ylabel("Cp (F)")
ax1_twin.set_ylabel("D") ax1_twin.set_ylabel("D")
ax2 = fig.add_subplot(spec[0,1]) ax2 = fig.add_subplot(spec[0,1])
ax2_twin = ax2.twinx() ax2_twin = ax2.twinx()
ax2.set_title("Z/Phi(f) live") ax2.set_title("Z/Phi(f) live")
ax2.set_xlabel("Frequency (Hz)") ax2.set_xlabel("Frequency (Hz)")
ax2.set_ylabel("Z (Ohm)") ax2.set_ylabel("Z (Ohm)")
ax2_twin.set_ylabel("Phi (°)") ax2_twin.set_ylabel("Phi (°)")
ax3 = fig.add_subplot(spec[0,2]) ax3 = fig.add_subplot(spec[0,2])
ax3.set_title("ImZ(ReZ(f)) live") ax3.set_title("ImZ(ReZ(f)) live")
ax3.set_xlabel("Re Z (Ohm)") ax3.set_xlabel("Re Z (Ohm)")
ax3.set_ylabel("Im Z (Ohm)") ax3.set_ylabel("Im Z (Ohm)")
ax4 = fig.add_subplot(spec[1,0]) ax4 = fig.add_subplot(spec[1,0])
ax4_twin = ax4.twinx() ax4_twin = ax4.twinx()
ax4.set_title("Cp/D(U)") ax4.set_title("Cp/D(U)")
ax4.set_xlabel("Voltage U (V)") ax4.set_xlabel("Voltage U (V)")
ax4.set_ylabel("Cp (F)") ax4.set_ylabel("Cp (F)")
ax4_twin.set_ylabel("D") ax4_twin.set_ylabel("D")
ax5 = fig.add_subplot(spec[1,1]) ax5 = fig.add_subplot(spec[1,1])
ax5_twin = ax5.twinx() ax5_twin = ax5.twinx()
ax5.set_title("Z/Phi(U)") ax5.set_title("Z/Phi(U)")
ax5.set_xlabel("Voltage U (V)") ax5.set_xlabel("Voltage U (V)")
ax5.set_ylabel("Z (Ohm)") ax5.set_ylabel("Z (Ohm)")
ax5_twin.set_ylabel("Phi (°)") ax5_twin.set_ylabel("Phi (°)")
ax6 = fig.add_subplot(spec[1,2]) ax6 = fig.add_subplot(spec[1,2])
ax6_twin = ax6.twinx() ax6_twin = ax6.twinx()
ax6.set_title("Cp/D(f)") ax6.set_title("Cp/D(f)")
ax6.set_xlabel("Frequency (Hz)") ax6.set_xlabel("Frequency (Hz)")
ax6.set_ylabel("Cp (F)") ax6.set_ylabel("Cp (F)")
ax6_twin.set_ylabel("D") ax6_twin.set_ylabel("D")
mng = plt.get_current_fig_manager()
mng.window.state('zoomed')
fig.show() fig.show()
``` ```
%% Cell type:code id:ff74d7a2-3426-433a-8152-43083bda500a tags: %% Cell type:code id:ff74d7a2-3426-433a-8152-43083bda500a tags:
``` python ``` python
``` ```
......
...@@ -18,10 +18,8 @@ def change_state(widgets_list): ...@@ -18,10 +18,8 @@ def change_state(widgets_list):
def ask_for_calibration(): def ask_for_calibration():
root = tk.Tk() root = tk.Tk()
root.withdraw() root.withdraw()
root.lift() #show window above all other applications root.attributes("-topmost",True)
root.update()
root.attributes("-topmost", True)#window stays above all other applications
answer=tk.messagebox.askyesno(message='Do you want to calibarate?') answer=tk.messagebox.askyesno(message='Do you want to calibarate?')
root.destroy() root.destroy()
......
...@@ -138,7 +138,6 @@ def control_panel(): ...@@ -138,7 +138,6 @@ def control_panel():
control_panel[3,0] = widgets.Label("Actual Voltage",layout=Layout(height='auto', width = width)) control_panel[3,0] = widgets.Label("Actual Voltage",layout=Layout(height='auto', width = width))
control_panel[4,0] = widgets.Text(disabled = True,layout=Layout(height='auto', width = width)) control_panel[4,0] = widgets.Text(disabled = True,layout=Layout(height='auto', width = width))
control_panel[4,1] = widgets.Checkbox(description = 'Clear Graphs',value = True,indent = False,layout=Layout(height='auto', width = width))
measure = control_panel[0,:] measure = control_panel[0,:]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment