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

continued with adu

parent 146e73be
Branches
No related tags found
No related merge requests found
%% Cell type:code id:6defdb49-06c2-469d-beb5-bc2e147e3f79 tags:
``` python
%run ADU.py
```
%% Output
%% Cell type:code id:161fa296-6fec-4456-93a3-88c8de25d63f tags:
%% Cell type:code id:9ca55782-244e-4308-868e-8a6bba5897ab tags:
``` python
print(device.error())
change_state(all_widgets)
```
%% Output
+0,"No error"
%% Cell type:code id:b7d94e11-0971-49af-885d-be300f88dbd3 tags:
%% Cell type:code id:303f03c1-9447-484e-9bc8-07f00db4607a tags:
``` python
```
......
......@@ -62,25 +62,46 @@ print()
button = widgets.Button(description ='Start Measurement')
output = widgets.Output()
display(button,output)
all_widgets =[button,transfer_check,integration_transfer,output_check,integration_output,gatediode_check,integration_gatediode,test_contacts]
for i in range(2):
for j in range(1,3):
all_widgets.append(information_grid[i,j])
add_widgets_to_list(Vds_transfer,all_widgets)
add_widgets_to_list(Vgs_transfer,all_widgets)
add_widgets_to_list(Vds_output,all_widgets)
add_widgets_to_list(Vgs_output,all_widgets)
add_widgets_to_list(Vgs_gatediode,all_widgets)
display(button,output)
device = hp4155a.HP4155a('GPIB0::17::INSTR')
def on_start_clicked(b):
with output:
clear_output()
#disable all widgets
disable_widgets(all_widgets)
Setup(device) #setup the device
#start measurements
if test_contacts.value == True:
Test(device)
answer = ask_to_continue()
if answer == False:
enable_widgets(all_widgets)
return
if transfer_check.value == True:
#check the values
vgs_ok = check_values(Vgs_transfer['start'],Vgs_transfer['step'],Vgs_transfer['stop'],'primary')
vds_ok=check_values(Vds_transfer['start'],Vds_transfer['step'],Vds_transfer['stop'],'secondary')
print(vgs_ok,vds_ok)
if vgs_ok == True and vds_ok == True:
#calculate number of points for var2(VDS)
points = number_of_points(Vds_transfer['start'].value,Vds_transfer['step'].value,Vds_transfer['stop'].value)
#check values(later)
points = number_of_points(Vds_transfer['start'],Vds_transfer['step'],Vds_transfer['stop'])
#configure smus
smu1 = device.smu_dict()
......@@ -89,13 +110,26 @@ def on_start_clicked(b):
smu2 = device.smu_dict()
smu2.update(vname ='VDS',iname ='ID',mode='V',func='VAR2')
var2=device.var2_dict()
var2.update(start=Vds_transfer['start'].value,step=Vds_transfer['step'].value,points=points,comp=Vds_transfer['comp'].value,pcomp=Vds_transfer['pcomp'].value)
var2.update(
start=Vds_transfer['start'].value,
step=Vds_transfer['step'].value,
points=points,
comp=Vds_transfer['comp'].value,
pcomp=Vds_transfer['pcomp'].value
)
smu2.update(VAR2=var2)
smu3 = device.smu_dict()
smu3.update(vname='VGS',iname ='IG',mode='V',func='VAR1')
var1=device.var1_dict()
var1.update(mode=Vgs_transfer['hyst'].value,start=Vgs_transfer['start'].value,stop=Vgs_transfer['stop'].value,step=Vgs_transfer['step'].value,comp =Vgs_transfer['comp'].value,pcomp=Vgs_transfer['pcomp'].value)
var1.update(
mode=Vgs_transfer['hyst'].value,
start=Vgs_transfer['start'].value,
stop=Vgs_transfer['stop'].value,
step=Vgs_transfer['step'].value,
comp =Vgs_transfer['comp'].value,
pcomp=Vgs_transfer['pcomp'].value
)
smu3.update(VAR1=var1)
smu4 = device.smu_dict()
......@@ -109,9 +143,12 @@ def on_start_clicked(b):
#save results(later)
if output_check.value == True:
vds_ok = check_values(Vds_output['start'],Vds_output['step'],Vds_output['stop'],'primary')
vgs_ok = check_values(Vgs_output['start'],Vgs_output['step'],Vgs_output['stop'],'secondary')
if vds_ok== True and vgs_ok == True:
#calculate number of points for var2(VGS)
points = number_of_points(Vgs_output['start'].value,Vgs_output['step'].value,Vgs_output['stop'].value)
#check values(later)
points = number_of_points(Vgs_output['start'],Vgs_output['step'],Vgs_output['stop'])
#configure smus
smu1 = device.smu_dict()
......@@ -129,9 +166,22 @@ def on_start_clicked(b):
#set var1(Vds) and var2(Vfs)
var2=device.var2_dict()
var2.update(start=Vgs_output['start'].value,step=Vgs_output['step'].value,points=points,comp=Vgs_output['comp'].value,pcomp=Vgs_output['pcomp'].value)
var2.update(
start=Vgs_output['start'].value,
step=Vgs_output['step'].value,
points=points,
comp=Vgs_output['comp'].value,
pcomp=Vgs_output['pcomp'].value
)
var1=device.var1_dict()
var1.update(mode=Vds_output['hyst'].value,start=Vds_output['start'].value,stop=Vds_output['stop'].value,step=Vds_output['step'].value,comp =Vds_output['comp'].value,pcomp=Vds_output['pcomp'].value)
var1.update(
mode=Vds_output['hyst'].value,
start=Vds_output['start'].value,
stop=Vds_output['stop'].value,
step=Vds_output['step'].value,
comp =Vds_output['comp'].value,
pcomp=Vds_output['pcomp'].value
)
smu2.update(VAR1=var1)
smu3.update(VAR2=var2)
......
import matplotlib.pyplot as plt
import numpy as np
import tkinter as tk
from tkinter import filedialog
import tkinter.messagebox
def plot_transfer(x,y1,y2,curves):
x = np.array_split(x,curves)
......@@ -77,8 +81,78 @@ def plot_gatediode(x,y):
def number_of_points(start,step,stop):
diff = stop - start
ratio = diff/step
diff = stop.value - start.value
ratio = diff/step.value
points = int(ratio+1)
if points>128:
points = 128
return points
def check_values(start,step,stop,function):
valid = True
root = tk.Tk()
root.withdraw()
root.lift() #show window above all other applications
root.attributes("-topmost", True)#window stays above all other applications
if function =='primary':
if abs(step.value) > abs(stop.value-start.value) or step==0:#invalid parameter setting
valid = False
tkinter.messagebox.showerror(message="Invalid parameter setting!")
if start.value<stop.value and step.value<0: #change polarity
step.value =(-1)*step.value
elif start.value>stop.value and step.value>0:
step.value = (-1)*step.value
else:
pass
if function == 'secondary':
if start.value == stop.value:
pass
elif abs(step.value) > abs(stop.value-start.value) or step==0:#invalid parameter setting
valid = False
tkinter.messagebox.showerror(message="Invalid parameter setting!")
if start.value<stop.value and step.value<0: #change polarity
step.value =(-1)*step.value
elif start.value>stop.value and step.value>0:
step.value = (-1)*step.value
root.destroy()
return valid
def ask_to_continue():
root = tk.Tk()
root.withdraw()
root.lift() #show window above all other applications
root.attributes("-topmost", True)#window stays above all other applications
answer = tk.messagebox.askokcancel(message="Test of the contacts completed. Continue?")
root.destroy()
return answer
def add_widgets_to_list(source_dictionary,target_list):
for widget in source_dictionary.values():
target_list.append(widget)
def change_state(widgets_list):
for widget in widgets_list:
widget.disabled = not widget.disabled
def enable_widgets(widgets_list):
for widget in widgets_list:
widget.disabled = False
def disable_widgets(widgets_list):
for widget in widgets_list:
widget.disabled = True
\ No newline at end of file
......@@ -31,7 +31,7 @@ def primary(name,start,step,stop,comp):
#second line
primary_grid[1,0]=widgets.BoundedFloatText(value=start,min=-100,max=100,step=1,layout=Layout(height='auto', width='auto'))
primary_grid[1,1]=widgets.BoundedFloatText(value=step,min=-100,max=100,step=1,layout=Layout(height='auto', width='auto'))
primary_grid[1,1]=widgets.BoundedFloatText(value=step,min=-200,max=200,step=1,layout=Layout(height='auto', width='auto'))
primary_grid[1,2]=widgets.BoundedFloatText(value=stop,min=-100,max=100,step=1,layout=Layout(height='auto', width='auto'))
#third line
......@@ -69,7 +69,7 @@ def secondary(name,start,step,stop,comp):
#second line
secondary_grid[1,0]=widgets.BoundedFloatText(value=start,min=-100,max=100,step=1,layout=Layout(height='auto', width='auto'))
secondary_grid[1,1]=widgets.BoundedFloatText(value=step,min=-100,max=100,step=1,layout=Layout(height='auto', width='auto'))
secondary_grid[1,1]=widgets.BoundedFloatText(value=step,min=-200,max=200,step=1,layout=Layout(height='auto', width='auto'))
secondary_grid[1,2]=widgets.BoundedFloatText(value=stop,min=-100,max=100,step=1,layout=Layout(height='auto', width='auto'))
#third line
......
......@@ -58,7 +58,8 @@ def Test(device):
device.display_variable('Y2','IGmm')
device.single_measurement()
device.wait()
while device.operation_completed()==False:
pass
device.autoscaling()
......@@ -86,7 +87,8 @@ def Transfer(smu1,smu2,smu3,smu4,integration,device):
device.display_variable('Y2','Gm')
device.single_measurement()
device.wait()
while device.operation_completed()==False:
pass
device.autoscaling()
......@@ -120,7 +122,8 @@ def Output(smu1,smu2,smu3,smu4,integration,device):
device.display_variable('Y2','IGmm')
device.single_measurement()
device.wait()
while device.operation_completed()==False:
pass
device.autoscaling()
......@@ -153,7 +156,8 @@ def Gatediode(smu1,smu3,sm4,integration,device):
device.display_variable('Y2','IGmm')
device.single_measurement()
device.wait()
while device.operation_completed()==False:
pass
device.autoscaling()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment