diff --git a/hp4194/cv.py b/hp4194/cv.py index e07f4af5272406c2610e7fdc4ed9b3b0177e2150..1ee68e67edfd72b65081bf8574a336e278dfaeed 100644 --- a/hp4194/cv.py +++ b/hp4194/cv.py @@ -2,7 +2,7 @@ from interface import * import control from help import * import time -from IPython.display import clear_output +from IPython.display import clear_output,display import numpy as np import datetime import pandas as pd @@ -157,10 +157,9 @@ def on_measure_clicked(b): ax6.set_ylabel("Cp (F)") ax6_twin.set_ylabel("D") - figManager = plt.get_current_fig_manager() - figManager.window.state('zoomed') - - for bias in biases: + + for i,bias in enumerate(biases): + clear_output(wait = True) view["v-value"].value = str(bias) # voltage index @@ -227,30 +226,31 @@ def on_measure_clicked(b): # do the plots # first the live ones - - #clear the live axes - ax1.clear() - ax1_twin.clear() - ax2.clear() - ax2_twin.clear() - ax3.clear() + if i>1: + curve1.pop(0).remove() + curve1_twin.pop(0).remove() + curve2.pop(0).remove() + curve2_twin.pop(0).remove() + curve3.pop(0).remove() + + # frequency Cp/D plot - ax1.plot(freq,Cp,color = 'b') + curve1 = ax1.plot(freq,Cp,color = 'b') ax1.tick_params(axis = 'y',labelcolor = 'b') - ax1_twin.plot(freq,D, color = 'y') + curve1_twin=ax1_twin.plot(freq,D, color = 'y') ax1_twin.tick_params(axis='y',labelcolor = 'y') # frequecy Z-phi - ax2.plot(freq,Z,color = 'b') + curve2=ax2.plot(freq,Z,color = 'b') ax2.tick_params(axis = 'y',labelcolor = 'b') - ax2_twin.plot(freq,phi, color = 'y') + curve2_twin = ax2_twin.plot(freq,phi, color = 'y') ax2_twin.tick_params(axis='y',labelcolor = 'y') # Rez - Imz - ax3.plot(ReZ,ImZ,color = 'b') + curve3=ax3.plot(ReZ,ImZ,color = 'b') ax3.tick_params(axis = 'y',labelcolor = 'b') # now the rest of the plots @@ -280,10 +280,12 @@ def on_measure_clicked(b): ax6_twin.scatter(freq,D, color = 'y') ax6_twin.tick_params(axis='y',labelcolor = 'y') - plt.pause(0.1) + display(fig) + if messparameter_dict["hysterisis"].value == True: reversed_biases = reversed_array(biases) for bias in reversed_biases: + clear_output(wait = True) view["v-value"].value = str(bias) # voltage index @@ -349,30 +351,29 @@ def on_measure_clicked(b): # do the plots # first the live ones - - #clear the live axes - ax1.clear() - ax1_twin.clear() - ax2.clear() - ax2_twin.clear() - ax3.clear() + + curve1.pop(0).remove() + curve1_twin.pop(0).remove() + curve2.pop(0).remove() + curve2_twin.pop(0).remove() + curve3.pop(0).remove() # frequency Cp/D plot - ax1.plot(freq,Cp,color = 'b') + curve1=ax1.plot(freq,Cp,color = 'b') ax1.tick_params(axis = 'y',labelcolor = 'b') - ax1_twin.plot(freq,D, color = 'y') + curve1_twin = ax1_twin.plot(freq,D, color = 'y') ax1_twin.tick_params(axis='y',labelcolor = 'y') # frequecy Z-phi - ax2.plot(freq,Z,color = 'b') + curve2=ax2.plot(freq,Z,color = 'b') ax2.tick_params(axis = 'y',labelcolor = 'b') - ax2_twin.plot(freq,phi, color = 'y') + curve2_twin=ax2_twin.plot(freq,phi, color = 'y') ax2_twin.tick_params(axis='y',labelcolor = 'y') # Rez - Imz - ax3.plot(ReZ,ImZ,color = 'b') + curve3=ax3.plot(ReZ,ImZ,color = 'b') ax3.tick_params(axis = 'y',labelcolor = 'b') # now the rest of the plots @@ -401,10 +402,8 @@ def on_measure_clicked(b): ax6_twin.scatter(freq,D, color = 'r') ax6_twin.tick_params(axis='y',labelcolor = 'r') - - plt.pause(0.1) + display(fig) - plt.show() device.write('bias_off') # save to file diff --git a/hp4194/cv_interace.ipynb b/hp4194/cv_interace.ipynb index 11002699df2d9763e311e1e0e4e9339661ab7c7b..3e260ca7dd4736deb372abf9b9f7172d0b43a0dd 100644 --- a/hp4194/cv_interace.ipynb +++ b/hp4194/cv_interace.ipynb @@ -50,7 +50,6 @@ } ], "source": [ - "%matplotlib tk\n", "%run cv.py" ] }, @@ -79,7 +78,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.13.0" + "version": "3.12.0" } }, "nbformat": 4,