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

migration to the new cotrol class

parent f6eb34b3
No related branches found
No related tags found
No related merge requests found
......@@ -13,6 +13,7 @@ enabing and disabling widgets for jupyter(lists)
import sys
sys.path.insert(0, '..') #append parent directory
import hp4155a
import module
import matplotlib.pyplot as plt
......@@ -30,9 +31,7 @@ import os
#these are the quick sampling checks
def regular_contact_check():
device = module.HP4155a('GPIB0::17::INSTR')
def regular_contact_check(device):
resistances = {}
smu = [1,2,3,4]
......@@ -42,29 +41,46 @@ def regular_contact_check():
We have the following pairs in order
1-4,1-3,1-2,2-4,2-3,3-4
"""
device.reset()
device.measurement_mode('SAMP')
device.sampling_mode('LIN')
device.number_of_points(1)
device.integration_time('MED')
device.initial_interval(2e-3)
device.filter_status('OFF')
#remove total sampling time
device.auto_sampling_time('ON')
parameters ={
'mode' : 'LIN',
'hold': 0,
'interval':2e-3,
'points': 1,
'filter': 'OFF',
'value':0.01, #voltage value
'comp':0.1 #compliance value
}
device.setup_sampling(parameters)
#disable vmus and vsus
device.disable_vsu(1)
device.disable_vsu(2)
device.disable_vmu(1)
device.disable_vmu(2)
device.auto_sampling_time('ON')
device.integration_time('MED')
device.smu_mode_meas(i,'V') #one smu is measuring
device.smu_mode_meas(j,'COMM') #one smu is ground
smu_v = device.smu_dict()
smu_v.update(
vname = f'V{i}',
iname = f'I{i}',
mode = 'V',
func = 'CONS'
)
device.setup_smu(i,smu_v)
smu_ground = device.smu_dict()
smu_ground.update(
vname =f'V{j}',
iname = f'I{j}',
mode = 'COMM',
func='CONS'
)
device.setup_smu(j,smu_ground)
#one smu is measuring
#one smu is ground
#set voltage and compliance
device.constant_smu_sampling(i,0.01)
device.constant_smu_comp(i,'MAX')
device.setup_smu_sampling(i,parameters)
#smus to remove
smu_disable = smu.copy()
......@@ -72,56 +88,69 @@ def regular_contact_check():
smu_disable.remove(j)
for number in smu_disable:
device.smu_disable_sweep(number)
device.smu_disable(number)
device.user_function(f'R{i}{j}','OHM',f'V{i}/I{i}')
device.display_variable('X','@TIME')
device.display_variable('Y1',f'I{i}')
device.display_variable('Y1',f'R{i}{j}')
device.single_measurement()
while device.operation_completed() == False:
time.sleep(2)
device.autoscaling()
V = device.return_data(f'V{i}')
I = device.return_data(f'I{i}')
R = V[0]/I[0]
R = device.return_values(f'R{i}{j}')[0] #only the first value
print(f"R{i}{j}:{'{:.2e}'.format(R)} Ohm")
resitances[f"{i}-{j}"] = R
#print(f"Contact check of smu{i} and smu{j} failed!")
resistances[f"{i}-{j}"] = R
device.del_user_functions()
del device
return resistances
def EBL():
def EBL(device):
# EBL are SMUs 1-4 and 2-3
device = module.HP4155a('GPIB0::17::INSTR')
resistances = {}
smu = [1,2,3,4]
for i,j in zip(range(1,3),range(4,2,-1)): #loop simultaneously 1-4,2-3 pairs
device.reset()
device.measurement_mode('SAMP')
device.sampling_mode('LIN')
device.number_of_points(1)
device.integration_time('MED')
device.initial_interval(2e-3)
device.filter_status('OFF')
#remove total sampling time
device.auto_sampling_time('ON')
#disable vmus and vsus
device.disable_vsu(1)
device.disable_vsu(2)
device.disable_vmu(1)
device.disable_vmu(2)
parameters ={
'mode' : 'LIN',
'hold': 0,
'interval':2e-3,
'points': 1,
'filter': 'OFF',
'value':0.01, #voltage value
'comp':0.1 #compliance value
}
device.setup_sampling(parameters)
device.auto_sampling_time('ON')
device.integration_time('MED')
device.smu_mode_meas(i,'V') #one smu is measuring
device.smu_mode_meas(j,'COMM') #one smu is ground
smu_v = device.smu_dict()
smu_v.update(
vname = f'V{i}',
iname = f'I{i}',
mode = 'V',
func = 'CONS'
)
device.setup_smu(i,smu_v)
smu_ground = device.smu_dict()
smu_ground.update(
vname =f'V{j}',
iname = f'I{j}',
mode = 'COMM',
func='CONS'
)
device.setup_smu(j,smu_ground)
#one smu is measuring
#one smu is ground
#set voltage and compliance
device.constant_smu_sampling(i,0.01)
device.constant_smu_comp(i,'MAX')
device.setup_smu_sampling(i,parameters)
#smus to remove
smu_disable = smu.copy()
......@@ -129,57 +158,72 @@ def EBL():
smu_disable.remove(j)
for number in smu_disable:
device.smu_disable_sweep(number)
device.smu_disable(number)
device.user_function(f'R{i}{j}','OHM',f'V{i}/I{i}')
device.display_variable('X','@TIME')
device.display_variable('Y1',f'I{i}')
device.display_variable('Y1',f'R{i}{j}')
device.single_measurement()
while device.operation_completed() == False:
time.sleep(2)
device.autoscaling()
V = device.return_data(f'V{i}')
I = device.return_data(f'I{i}')
R = V[0]/I[0]
R = device.return_values(f'R{i}{j}')[0] #only the first value
print(f"R{i}{j}:{'{:.2e}'.format(R)} Ohm")
resitances[f"{i}-{j}"] = R
resistances[f"{i}-{j}"] = R
device.del_user_functions()
del device
return resistances
def OL():
def OL(device):
# OL smu 3-4,1-2
device = module.HP4155a('GPIB0::17::INSTR')
resistances= {}
smu = [1,2,3,4]
for i,j in zip(range(3,0,-2),range(4,1,-2)): #loop simultaneously 3-4 , 1-2 pairs
device.reset()
device.measurement_mode('SAMP')
device.sampling_mode('LIN')
device.number_of_points(1)
device.integration_time('MED')
device.initial_interval(2e-3)
device.filter_status('OFF')
#remove total sampling time
device.auto_sampling_time('ON')
#disable vmus and vsus
device.disable_vsu(1)
device.disable_vsu(2)
device.disable_vmu(1)
device.disable_vmu(2)
parameters ={
'mode' : 'LIN',
'hold': 0,
'interval':2e-3,
'points': 1,
'filter': 'OFF',
'value':0.01, #voltage value
'comp':0.1 #compliance value
}
device.setup_sampling(parameters)
device.auto_sampling_time('ON')
device.integration_time('MED')
device.smu_mode_meas(i,'V') #one smu is measuring
device.smu_mode_meas(j,'COMM') #one smu is ground
smu_v = device.smu_dict()
smu_v.update(
vname = f'V{i}',
iname = f'I{i}',
mode = 'V',
func = 'CONS'
)
device.setup_smu(i,smu_v)
smu_ground = device.smu_dict()
smu_ground.update(
vname =f'V{j}',
iname = f'I{j}',
mode = 'COMM',
func='CONS'
)
device.setup_smu(j,smu_ground)
#one smu is measuring
#one smu is ground
#set voltage and compliance
device.constant_smu_sampling(i,0.01)
device.constant_smu_comp(i,'MAX')
device.setup_smu_sampling(i,parameters)
#smus to remove
smu_disable = smu.copy()
......@@ -187,22 +231,22 @@ def OL():
smu_disable.remove(j)
for number in smu_disable:
device.smu_disable_sweep(number)
device.smu_disable(number)
device.user_function(f'R{i}{j}','OHM',f'V{i}/I{i}')
device.display_variable('X','@TIME')
device.display_variable('Y1',f'I{i}')
device.display_variable('Y1',f'R{i}{j}')
device.single_measurement()
while device.operation_completed() == False:
time.sleep(2)
device.autoscaling()
V = device.return_data(f'V{i}')
I = device.return_data(f'I{i}')
R = V[0]/I[0]
R = device.return_values(f'R{i}{j}')[0] #only the first value
print(f"R{i}{j}:{'{:.2e}'.format(R)} Ohm")
resitances[f"{i}-{j}"] = R
resistances[f"{i}-{j}"] = R
device.del_user_functions()
del device
return resistances
......@@ -549,7 +593,7 @@ def save_contact_check(R,file): #save contact check to file
"""
with open(file,'a') as f:
f.write("\n\nContact Check Results:\n")
f.write("Contact Check Results:\n")
df = pd.DataFrame(R.items(), columns=['SMU pair', 'Resistance (Ohm)'])
f.write(df.to_string())
......
......@@ -37,11 +37,20 @@ DUT = widgets.Text(
#choose a new folder button
new_folder = widgets.Button(description='change folder')
image = widgets.Image(
value=open("schematic.png", "rb").read(),
format='png',
width=300,
height=100,
)
contact_check = widgets.Button(description = 'CONTACT CHECK')
qcc = widgets.Button(description = 'QUICK CONTACT CHECK',layout=widgets.Layout(width='80%'),style={"button_width": "auto"})
qcc_select = widgets.RadioButtons(description = 'QCC type:',options = ['EBL','OL'])
horizontal = widgets.HBox([sample_series,new_folder])
horizontal3= widgets.HBox([DUT,]) #here contact scehmatic
all_text_boxes = widgets.VBox([horizontal,field,horizontal3])
vertical1 = widgets.VBox([sample_series,field,DUT,new_folder,contact_check,qcc,qcc_select])
vertical2 = widgets.VBox([image])
all_text_boxes = widgets.HBox([vertical1,vertical2])
......@@ -63,10 +72,11 @@ integration_time=widgets.Dropdown(
sampling=widgets.Checkbox(description='sampling check')
#align the widgets horizontaly
line0=widgets.HBox([step,integration_time,sampling])
auto_qcc = widgets.Checkbox(
description = 'Auto QCC after Reset',
style = {'description_width': 'initial'},
value = True
)
# THE BUTTONS
#create buttons as it shown in the how_buttons_look
......@@ -75,9 +85,7 @@ reset=widgets.Button(description='RESET')
full=widgets.Button(description='FULL SWEEP')
number = widgets.BoundedIntText(value=1,min=1,max=sys.maxsize,step=1,description='full sweeps:',disabled=False) #number of measuremts for the full sweep
retention_button=widgets.Button(description='RETENTION')
contact_check = widgets.Button(description = 'CONTACT CHECK')
qcc = widgets.Button(description = 'QUICK CONTACT CHECK')
qcc_select = widgets.RadioButtons(description = 'QCC type:',options = ['EBL','OL'])
#parameter boxes
......@@ -140,13 +148,10 @@ duration=widgets.BoundedFloatText(
description='Duration(s):',
)
auto_qcc = widgets.Checkbox(
description = 'Auto QCC after Reset:',
style = {'description_width': 'initial'},
value = True
)
#align a button with a checkbox or integer bounded texts horizontaly
line0=widgets.HBox([step,integration_time,sampling,auto_qcc])
line1 = widgets.HBox([set,Vset,CC_vset])
line2 = widgets.HBox([reset,Vreset,CC_vreset])
line3 = widgets.HBox([full,number])
......@@ -164,9 +169,6 @@ folder=choose_folder()
#display all at the end
display(all_text_boxes)
hbox = widgets.HBox([contact_check,qcc,qcc_select]) #HBox wirth contact checks
display(hbox)
cons_widgets,cons_dict = constant_pulse()
sweep_widgets,sweep_dict = sweep_pulse()
......@@ -182,26 +184,24 @@ tab.titles = titles
display(tab,output)
all_widgets = [ sweep_button,cons_button,sample_series,field,DUT,set,reset,full,new,new_folder,retention_button,contact_check,qcc,qcc_select,Vset,CC_vset,Vreset,CC_vreset,step,integration_time,number,sampling,Vretention,period,duration,auto_qcc]
all_widgets=[sweep_button,cons_button,sample_series,field,DUT,set,reset,full,new_folder,retention_button,contact_check,qcc,qcc_select,Vset,CC_vset,Vreset,CC_vreset,step,integration_time,number,sampling,Vretention,period,duration,auto_qcc]
add_widgets_to_list(cons_dict,all_widgets)
add_widgets_to_list(sweep_dict,all_widgets)
#display the buttons
""" the above is what happens when the programm starts all the rest have to be written into button trigger functions"""
device = hp4155a.HP4155a('GPIB0::17::INSTR')
device.reset()
device.disable_not_smu()
def on_contact_check_clicked(b):
global folder,temp_file
with output:
global first,folder,file,temp_file
clear_output(wait = True)
change_state(all_widgets)
filename=f"{sample_series.value}_{field.value}_{DUT.value}.txt"
file = os.path.join(folder,filename)
R = regular_contact_check()
R = regular_contact_check(device)
save_contact_check(R,temp_file)
......@@ -223,9 +223,9 @@ def on_qcc_clicked(b):
if qcc_select.value == 'EBL':
R = EBL()
R = EBL(device)
else: # OL
R = OL()
R = OL(device)
save_contact_check(R,temp_file)
......
%% Cell type:code id:df99f5a2-80af-4892-8633-33177239e444 tags:
``` python
%run memristor.py
```
%% Output
%% Cell type:code id:38e8523c-17f0-48b4-9501-dd2278ffe8d1 tags:
``` python
print(device.error())
```
%% Output
(0, '"No error"\n')
%% Cell type:code id:076a9132-edc2-4ae5-8a7f-c8a179473952 tags:
%% Cell type:code id:ca8f0bc8-670c-4deb-bedb-8d5d92b978f2 tags:
``` python
```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment