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

Double Gate Devices New Features (part 1)

parent ab49d84d
Branches
No related tags found
No related merge requests found
import sys
sys.path.insert(0, './lib')
sys.path.insert(0, '..') #append parent directory
from interface import *
from help import *
from measurements import *
import configparser
# Create the grids
#create the information grid
style = {'description_width': 'initial'}
sample,smu = information_box_new()
###end of sampling information#######################################
# move checkboxes outside of the tabs
transfer_check,integration_transfer,transfer_gates = header('Transfer Curve',"MEDium")
output_check,integration_output,output_gates = header('Output Curve',"SHORt")
gatediode_check,integration_gatediode,_=header('Gatediode',"MEDium")
checkboxes = widgets.HBox([transfer_check,output_check,gatediode_check])
display(checkboxes)
#transfer
Vds_transfer_widgets,Vds_transfer = secondary('VDS',0.05,0.95,1,1e-2)
Vtg_transfer_widgets,Vtg_transfer = primary('VTG',-5,0.01,5,1e-3)
Vbg_transfer_widgets,Vbg_transfer = synchronous('VBG',-15,0.1,15,1e-3)
replot_transfer_widgets,replot_transfer = replot()
transfer_box = widgets.VBox([integration_transfer,transfer_gates,Vds_transfer_widgets,Vtg_transfer_widgets,Vbg_transfer_widgets,replot_transfer_widgets])
#output
Vds_output_widgets,Vds_output = primary('VDS',0,0.01,5,1e-2)
Vtg_output_widgets,Vtg_output = secondary('VTG',-5,2,5,1e-3)
Vbg_output_widgets,Vbg_output = additional_secondary('VBG',-15,5,15,1e-3)
replot_output_widgets,replot_output = replot()
output_box = widgets.VBox([integration_output,output_gates,Vds_output_widgets,Vtg_output_widgets,Vbg_output_widgets,replot_output_widgets])
#GateDiodde
terminal = widgets.Dropdown(
options = ['VTG','VBG'],
description = 'Selected Gate:',
value ='VTG',
style= {'description_width': 'initial'}
)
Vg_gatediode_widgets,Vg_gatediode=primary('VG',-5,0.05,5,1e-3)
replot_gatediode_widgets,replot_gatediode = replot()
gatediode_box = widgets.VBox([integration_gatediode,terminal,Vg_gatediode_widgets,replot_gatediode_widgets])
#the tab widget
children = [transfer_box,output_box,gatediode_box]
titles = ["Transfer","Output","Gatediode"]
tab = widgets.Tab()
tab.children = children
tab.titles = titles
display(tab)
button = widgets.Button(description ='Start Measurement')
output = widgets.Output()
export_ini_button = widgets.Button(description = 'Export as ini')
import_ini_button = widgets.Button(description='Import from ini')
replot_button = widgets.Button(description = 'Replot',disabled = True)
all_widgets =[transfer_gates,output_gates,button,transfer_check,integration_transfer,output_check,integration_output,gatediode_check,integration_gatediode,terminal,export_ini_button,import_ini_button]
replot_widgets = [replot_transfer,replot_output,replot_gatediode,replot_button]
add_widgets_to_list(sample,all_widgets)
add_widgets_to_list(smu,all_widgets)
add_widgets_to_list(Vds_transfer,all_widgets)
add_widgets_to_list(Vtg_transfer,all_widgets)
add_widgets_to_list(Vbg_transfer,all_widgets)
add_widgets_to_list(Vds_output,all_widgets)
add_widgets_to_list(Vtg_output,all_widgets)
add_widgets_to_list(Vbg_output,all_widgets)
add_widgets_to_list(Vg_gatediode,all_widgets)
line = widgets.HBox([button,import_ini_button,export_ini_button,replot_button])
display(line,output)
device = hp4155a.HP4155a('GPIB0::17::INSTR')
df_transfer =pd.DataFrame()
df_output =pd.DataFrame()
df_gatediode = pd.DataFrame()
points_transfer = 0
points_output = 0
points_gatediode = 0
def on_start_clicked(b):
with output:
global df_transfer,df_output,df_gatediode,points_transfer,points_output
clear_output()
replot_button.disabled = True
#disable all widgets
disable_widgets(all_widgets)
#reset replotting columns
replot_transfer['x_variable'].options = []
replot_transfer['y_variable'].options = []
replot_output['x_variable'].options= []
replot_output['y_variable'].options = []
replot_gatediode['x_variable'].options = []
replot_gatediode['y_variable'].options = []
Setup(device) #setup the device
if transfer_check.value == True:
match transfer_gates.value:
case 'VTG' if check_values(Vtg_transfer,'primary') and check_values(Vds_transfer,'secondary'):
df_transfer,points_transfer = Transfer_VTG(Vtg_transfer,Vds_transfer,integration_transfer.value,sample,device)
replot_transfer['x_variable'].options = df_transfer.columns.tolist()
replot_transfer['y_variable'].options = df_transfer.columns.tolist()
replot_transfer['x_variable'].value = 'VTG/V'
replot_transfer['y_variable'].value = 'IDmm/uA/um'
case 'VBG' if check_values(Vbg_transfer,'primary') and check_values(Vds_transfer,'secondary'):
df_transfer,points_transfer = Transfer_VBG(Vbg_transfer,Vds_transfer,integration_transfer.value,sample,device)
replot_transfer['x_variable'].options = df_transfer.columns.tolist()
replot_transfer['y_variable'].options = df_transfer.columns.tolist()
replot_transfer['x_variable'].value = 'VBG/V'
replot_transfer['y_variable'].value = 'IDmm/uA/um'
case 'BOTH' if check_values(Vbg_transfer,'synchronous') and check_values(Vds_transfer,'secondary') and check_values(Vtg_transfer,'primary'):
df_transfer,points_transfer = Transfer_BOTH(Vtg_transfer,Vbg_transfer,Vds_transfer,integration_transfer.value,sample,device)
replot_transfer['x_variable'].options = df_transfer.columns.tolist()
replot_transfer['y_variable'].options = df_transfer.columns.tolist()
replot_transfer['x_variable'].value = 'VBG/V'
replot_transfer['y_variable'].value = 'IDmm/uA/um'
case _ :
information_box("Transfer Measurement skipped due to invalid parameters")
df_transfer = pd.DataFrame()
points_transfer = 0
if output_check.value == True:
match output_gates.value:
case 'VTG' if check_values(Vds_output,'primary') and check_values(Vtg_output,'secondary'):
df_output,points_output = Output_VTG(Vds_output,Vtg_output,integration_output.value,sample,device)
replot_output['x_variable'].options = df_output.columns.tolist()
replot_output['y_variable'].options = df_output.columns.tolist()
replot_output['x_variable'].value = 'VDS/V'
replot_output['y_variable'].value = 'IDmm/uA/um'
case 'VBG' if check_values(Vds_output,'primary') and check_values(Vbg_output,'secondary'):
df_output,points_output = Output_VBG(Vds_output,Vbg_output,integration_output.value,sample,device)
replot_output['x_variable'].options = df_output.columns.tolist()
replot_output['y_variable'].options = df_output.columns.tolist()
replot_output['x_variable'].value = 'VDS/V'
replot_output['y_variable'].value = 'IDmm/uA/um'
case 'BOTH' if check_values(Vds_output,'primary') and check_values(Vtg_output,'secondary') and check_values(Vbg_output,'secondary'):
df_output,points_output = Output_BOTH(Vds_output,Vtg_output,Vbg_output,integration_output.value,sample,device)
replot_output['x_variable'].options = df_output.columns.tolist()
replot_output['y_variable'].options = df_output.columns.tolist()
replot_output['x_variable'].value = 'VDS/V'
replot_output['y_variable'].value = 'IDmm/uA/um'
case _ :
information_box("Output Measurement skipped due to invalid parameters")
df_output = pd.DataFrame()
points_output = 0
if gatediode_check.value == True:
match terminal.value:
case 'VTG' if check_values(Vg_gatediode,'primary'):
df_gatediode = Gatediode_VTG(Vg_gatediode,integration_gatediode.value,sample,device)
replot_gatediode['x_variable'].options = df_gatediode.columns.tolist()
replot_gatediode['y_variable'].options = df_gatediode.columns.tolist()
replot_gatediode['x_variable'].value = 'VTG/V'
replot_gatediode['y_variable'].value = 'ITGmm/uA/um'
case 'VBG' if check_values(Vg_gatediode,'primary'):
df_gatediode = Gatediode_VBG(Vg_gatediode,integration_gatediode.value,sample,device)
replot_gatediode['x_variable'].options = df_gatediode.columns.tolist()
replot_gatediode['y_variable'].options = df_gatediode.columns.tolist()
replot_gatediode['x_variable'].value = 'VBG/V'
replot_gatediode['y_variable'].value = 'IBGmm/uA/um'
case _ :
information_box("Gatediode Measurement skipped due to invalid parameters")
df_gatediode = pd.DataFrame()
information_box("Measurement finished!")
enable_widgets(all_widgets)
replot_button.disabled = False
def on_export_ini_clicked(b):
with output:
disable_widgets(all_widgets)
config = configparser.ConfigParser()
default_filename = 'ADU_double_gate.ini'
file = save_as_ini(default_filename)
with open(file,'w') as configfile:
config.add_section('ALL VALUES ARE IN SI-UNITS!')
config.add_section('IT IS RECOMMENDED TO CHANGE THE INI FILE FROM THE INTERFACE AND DO NOT CHANGE ANY VALUES MANUALLY')
# Transfer curve
config.add_section('Transfer')
config.set('Transfer','Integration',integration_transfer.value)
config.add_section("Vtg_transfer")
for parameter,widget in Vtg_transfer.items():
config.set('Vtg_transfer',parameter,str(widget.value))
config.add_section("Vbg_transfer")
for parameter,widget in Vbg_transfer.items():
config.set('Vbg_transfer',parameter,str(widget.value))
config.add_section('Vds_transfer')
for parameter,widget in Vds_transfer.items():
config.set('Vds_transfer',parameter,str(widget.value))
#output
config.add_section('Output')
config.set('Output','Integration',integration_output.value)
config.add_section("Vtg_output")
for parameter,widget in Vtg_output.items():
config.set('Vtg_output',parameter,str(widget.value))
config.add_section("Vbg_output")
for parameter,widget in Vbg_output.items():
config.set('Vbg_output',parameter,str(widget.value))
config.add_section('Vds_output')
for parameter,widget in Vds_output.items():
config.set('Vds_output',parameter,str(widget.value))
# Gatediode
config.add_section('Gatediode')
config.set('Gatediode','Integration',integration_gatediode.value)
config.add_section("Vg_gatediode")
for parameter,widget in Vg_gatediode.items():
config.set('Vg_gatediode',parameter,str(widget.value))
config.write(configfile)
enable_widgets(all_widgets)
def on_import_ini_clicked(b):
with output:
disable_widgets(all_widgets)
#load values to the interface
config = configparser.ConfigParser()
file = load_ini()
#read the values from each section
try:
config.read(file)
#transfer curve
integration_transfer.value = config.get('Transfer', "integration")
for parameter,widget in Vtg_transfer.items():
widget.value = config.get('Vtg_transfer',parameter)
for parameter,widget in Vds_transfer.items():
widget.value = config.get('Vds_transfer',parameter)
for parameter,widget in Vbg_transfer.items():
widget.value = config.get('Vbg_transfer',parameter)
#output curve
integration_output.value = config.get('Output','integration')
for parameter,widget in Vtg_output.items():
widget.value = config.get('Vtg_output',parameter)
for parameter,widget in Vds_output.items():
widget.value = config.get('Vds_output',parameter)
for parameter,widget in Vbg_output.items():
widget.value = config.get('Vbg_output',parameter)
# gatediode
integration_gatediode.value = config.get('Gatediode','integration')
for parameter,widget in Vg_gatediode.items():
widget.value = config.get('Vg_gatediode',parameter)
information_box("all parameters loaded succesfully")
except Exception as error:
if type(error).__name__ =='NoSectionError':
information_box(f"{error}.Explanation: Section(header) [section] does not exist. Create a new ini file or compare it with functional ini files!")
elif type(error).__name__=='NoOptionError':
information_box(f'{error}.Explanation: The variable name before the equal sign is not recognized. Create a new ini file or compare it with functional ini files!')
elif type(error).__name__ == 'TraitError':
information_box(f'{error}.Explanation: Invalid Parameter Setting. Check if you set an invalid value!')
elif type(error).__name__ =="DuplicateOptionError":
information_box(f"{error}. Explaination: The section contains the setted parameter more than once!")
else:
information_box(f"A {type(error).__name__} has occurred. Create A new ini file")
enable_widgets(all_widgets)
def on_replot_button_clicked(b):
with output:
global df_transfer,df_output,df_gatediode,points_transfer,points_output
clear_output()
disable_widgets(all_widgets)
replot_button.disabled = True
# plot transfer
replot_results(replot_transfer,df_transfer,points_transfer,'Transfer Results')
#plot output
replot_results(replot_output,df_output,points_output,'Output Results')
# plot gatediode
replot_results(replot_gatediode,df_gatediode,1,'Gatediode Results')
enable_widgets(all_widgets)
replot_button.disabled = False
button.on_click(on_start_clicked)
import_ini_button.on_click(on_import_ini_clicked)
export_ini_button.on_click(on_export_ini_clicked)
replot_button.on_click(on_replot_button_clicked)
%% Cell type:code id:51b012d0-95b0-41c2-81bb-2205f3c53be2 tags:
``` python
%run double_gate_ADU.py
```
%% Output
%% Cell type:code id:329c0c76-4194-4805-ab3f-fe9f55f79eea tags:
``` python
```
import matplotlib.pyplot as plt
import numpy as np
import time
from datetime import datetime
import tkinter as tk
from tkinter import filedialog
import tkinter.messagebox
import copy
import pandas as pd
#Get dataframe from results
def get_dataframe_from_results(dictionary):
# creating a shallow copy
dictionary_copy = copy.copy(dictionary)
for old_key in dictionary_copy.keys():
if old_key[0]=='I':
new_key = old_key+"/A"
else: #V
new_key = old_key + "/V"
dictionary[new_key] = dictionary.pop(old_key)
df = pd.DataFrame(dictionary)
return df
def number_of_points(dict):
try:
diff = dict['stop'].value - dict['start'].value
ratio = abs(diff/dict['step'].value)
points = int(ratio+1)
except ZeroDivisionError:
points = 1
#the programm crashed because for secondary step we had no problem setting start = stop and then it was dividing by zero
if points>128:
points = 128
return points
def check_values(dictionary,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(dictionary['step'].value) > abs(dictionary['stop'].value-dictionary['start'].value) or dictionary['step'].value==0:#invalid parameter setting
valid = False
tkinter.messagebox.showerror(message="Invalid parameter setting!")
if dictionary['start'].value<dictionary['step'].value and dictionary['step'].value<0: #change polarity
dictionary['step'].value =(-1)*dictionary['step'].value
elif dictionary['start'].value>dictionary['stop'].value and dictionary['step'].value>0:
dictionary['step'].value = (-1)*dictionary['step'].value
else:
pass
if function == 'secondary':
if dictionary['start'].value == dictionary['stop'].value:
pass
elif abs(dictionary['step'].value) > abs(dictionary['stop'].value-dictionary['start'].value) or dictionary['step'].value==0:#invalid parameter setting
valid = False
tkinter.messagebox.showerror(message="Invalid parameter setting!")
if dictionary['start'].value<dictionary['step'].value and dictionary['step'].value<0: #change polarity
dictionary['step'].value =(-1)*dictionary['step'].value
elif dictionary['start'].value>dictionary['stop'].value and dictionary['step'].value>0:
dictionary['step'].value = (-1)*dictionary['step'].value
if function == 'synchronous':
pass
if valid == True:
#check compliance
comp = dictionary['comp'].value
start = dictionary['start'].value
stop = dictionary['stop'].value
if abs(comp)*max(abs(start),abs(stop))>2:
dictionary["comp"].value=np.sign(comp)*2/max(abs(start),abs(stop))
root.destroy()
return valid
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
def information_box(information):
#open dialog and hide the main window
root = tk.Tk()
root.withdraw()
root.lift() #show window above all other applications
root.attributes("-topmost", True)#window stays above all other applications
#display meaagebox
tkinter.messagebox.showinfo(message=information)
root.destroy()
#normalization factor to is for both normalizations 10**6/width mA/mm = uA/um = 10**(-6)A/um (returned from the tool)
def normalization_factor(width):
factor = 10**6/width
return factor
def save_as_ini(default_filename):
root = tk.Tk()
root.withdraw()
root.lift() #show window above all other applications
root.attributes("-topmost", True)#window stays above all other applications
file = filedialog.asksaveasfilename(defaultextension=".ini", filetypes=[("Ini files","*.ini")],title = "save as ini",initialfile =default_filename)
#check if the file path is correct(.txt)
while file.endswith(".ini") == False:
#open again filedialog with error message box
tk.messagebox.showerror(message='invalid filename!')
file = filedialog.asksaveasfilename(defaultextension=".ini", filetypes=[("Ini files","*.ini")],title = "save as ini",initialfile =default_filename)
root.destroy()
return file
def load_ini():
root = tk.Tk()
root.withdraw()
root.lift() #show window above all other applications
root.attributes("-topmost", True)#window stays above all other applications
file = filedialog.askopenfilename(filetypes=[("Ini files","*.ini")],title ='Select ini file')
while file.endswith(".ini") == False:
#open again filedialog with error message box
tk.messagebox.showerror(message='invalid filename!')
file = filedialog.askopenfilename(filetypes=[("Ini files","*.ini")],title = "Select ini file")
root.destroy()
return file
# function to return ratio and offset for synchronous sweep measurement
def calculate_line(VTG,VBG):
ratio = (VBG['stop'].value-VBG['start'].value)/(VTG['stop'].value-VTG['start'].value)
offset = VBG['start'].value-ratio*VTG['start'].value
return ratio,offset
# replot results
def replot_results(replot_dict,df,points,title):
try:
if len(df.columns.tolist())!=0 and replot_dict['check'].value==True: # Measurement is done
fig,ax = plt.subplots(figsize=(10,6))
#Retrieve the columns
x_col = replot_dict['x_variable'].value
y_col = replot_dict['y_variable'].value
#Scale and Absolute Values
if replot_dict['x_scale'].value=='linear':
x = np.array_split(df[x_col],points)
else:
x = np.array_split(df[x_col].abs(),points)
ax.set_xscale('log')
if replot_dict['y_scale'].value=='linear':
y = np.array_split(df[y_col],points)
else:
y = np.array_split(df[y_col].abs(),points)
ax.set_yscale('log')
# check auto limits
if replot_dict['x_auto'].value== False and replot_dict['x_max'].value > replot_dict['x_min'].value:
ax.set_xlim([replot_dict['x_min'].value,replot_dict['x_max'].value])
if replot_dict['y_auto'].value== False and replot_dict['y_max'].value > replot_dict['y_min'].value:
ax.set_ylim([replot_dict['y_min'].value,replot_dict['y_max'].value])
# Now set the label
ax.set_xlabel(x_col)
ax.set_ylabel(y_col)
#And Plot
for i in range(points):
ax.plot(x[i],y[i])
fig.suptitle(title, fontweight ="bold")
display(fig)
except:
information_box("reploting failed please try again")
\ No newline at end of file
import ipywidgets as widgets
from ipywidgets import GridspecLayout,Layout
from IPython.display import clear_output
import sys
import os
width = "50%"
height = 'auto'
style = {'description_width': 'initial'}
floatbox_width = "80%"
def header(name,integration):
style = {'description_width': 'initial'}
options_integration=["SHORt","MEDium","LONG"]
check=widgets.Checkbox(
description = name,
value = True,
indent = False
)
integration= widgets.Dropdown(
options=options_integration,
value=integration,description='Integration Time',
style =style,
layout=Layout(height='auto', width="30%")
)
select =widgets.Dropdown(
options = ['VTG','VBG',"BOTH"],
description = 'Sweeping Gates:',
value ='BOTH',
style= {'description_width': 'initial'}
)
return check, integration ,select
def primary(name,start,step,stop,comp):
primary_grid = GridspecLayout(4,4)
primary_grid[:,3]=widgets.Label(name,layout=Layout(height='auto', width='auto'))
primary_grid[:,3].style.font_weight = 'bold'
#first line
primary_grid[0,0]=widgets.Label("Start(V)",layout=Layout(height='auto', width='auto'))
primary_grid[0,1]=widgets.Label("Step(V)",layout=Layout(height='auto', width='auto'))
primary_grid[0,2]=widgets.Label("Stop(V)",layout=Layout(height='auto', width='auto'))
#second line
primary_grid[1,0]=widgets.BoundedFloatText(value=start,min=-100,max=100,step=1,layout=Layout(height='auto', width=floatbox_width))
primary_grid[1,1]=widgets.BoundedFloatText(value=step,min=-200,max=200,step=1,layout=Layout(height='auto', width=floatbox_width))
primary_grid[1,2]=widgets.BoundedFloatText(value=stop,min=-100,max=100,step=1,layout=Layout(height='auto', width=floatbox_width))
#third line
primary_grid[2,0]=widgets.Label("Compliance(A)",layout=Layout(height='auto', width='auto'))
primary_grid[2,1] =widgets.Label("Power Compliance(W)(0=OFF)",layout=Layout(height='auto', width='auto'))#mind the gap
primary_grid[2,2] =widgets.Label("Hysterisis",layout=Layout(height='auto', width='auto'))#mind the gap
#fourth line
primary_grid[3,0]=widgets.BoundedFloatText(value=comp,min=-0.1,max=0.1,step=0.01,layout=Layout(height='auto', width=floatbox_width))
primary_grid[3,1]=widgets.BoundedFloatText(value=0,min=0,max=2,step=0.1,layout=Layout(height='auto', width=floatbox_width))#mind the gap
primary_grid[3,2]=widgets.Dropdown(options=['SINGle','DOUBle'],value='SINGle',layout=Layout(height='auto', width=floatbox_width))#mind the gap
parameters = {
'start': primary_grid[1,0],
'step': primary_grid[1,1],
'stop': primary_grid[1,2],
'comp': primary_grid[3,0],
'hyst':primary_grid[3,2],
'pcomp':primary_grid[3,1]
}
return primary_grid,parameters
def secondary(name,start,step,stop,comp):
secondary_grid = GridspecLayout(4,4)
secondary_grid[:,3]=widgets.Label(name,layout=Layout(height='auto', width='auto'))
secondary_grid[:,3].style.font_weight = 'bold'
#first line
secondary_grid[0,0]=widgets.Label("Start(V)",layout=Layout(height='auto', width='auto'))
secondary_grid[0,1]=widgets.Label("Step(V)",layout=Layout(height='auto', width='auto'))
secondary_grid[0,2]=widgets.Label("Stop(V)",layout=Layout(height='auto', width='auto'))
#second line
secondary_grid[1,0]=widgets.BoundedFloatText(value=start,min=-100,max=100,step=1,layout=Layout(height='auto', width=floatbox_width))
secondary_grid[1,1]=widgets.BoundedFloatText(value=step,min=-200,max=200,step=1,layout=Layout(height='auto', width=floatbox_width))
secondary_grid[1,2]=widgets.BoundedFloatText(value=stop,min=-100,max=100,step=1,layout=Layout(height='auto', width=floatbox_width))
#third line
secondary_grid[2,0]=widgets.Label("Compliance(A)",layout=Layout(height='auto', width='auto'))
secondary_grid[2,2] =widgets.Label("Power Compliance(W)(0=OFF)",layout=Layout(height='auto', width='auto'))#mind the gap
#fourth line
secondary_grid[3,0]=widgets.BoundedFloatText(value=comp,min=-0.1,max=0.1,step=0.01,layout=Layout(height='auto', width=floatbox_width))
secondary_grid[3,2]=widgets.BoundedFloatText(value=0,min=0,max=2,step=0.1,layout=Layout(height='auto', width=floatbox_width))#mind the gap
parameters = {
'start': secondary_grid[1,0],
'step': secondary_grid[1,1],
'stop':secondary_grid[1,2],
'comp':secondary_grid[3,0],
'pcomp':secondary_grid[3,2]
}
return secondary_grid,parameters
def information_box_new():
width = '90%'
sample_information=widgets.Label("Sample Information",layout=Layout(height=height, width='50%'))
sample_information.style.font_weight='bold'
information_grid=GridspecLayout(3,2)
for i in range(3):
for j in range(2):
if i ==2 and j == 1:
information_grid[i,j]=widgets.Checkbox(value = True,indent = False)
elif i == 2 and j == 0:
information_grid[i,j]=widgets.BoundedFloatText(
value=100,
min=1e-3,
max=sys.float_info.max,step=1,
layout=Layout(height=height, width=width)
)
else:
information_grid[i,j]=widgets.Text(layout=Layout(height=height, width=width))
information_grid[0,0].description = "Processing-Nr:"
information_grid[1,0].description = "Sample:"
information_grid[2,0].description = "Device Width(um):"
information_grid[0,1].description = "Field(XYY):"
information_grid[1,1].description = "Device:"
information_grid[2,1].description ='Save Plots'
for i in range(3):
for j in range(2):
information_grid[i,j].style = style
config = widgets.Label("SMU Configuration",layout=Layout(height='auto', width='auto'))
top_gate = widgets.Dropdown(options=[1,2,3,4],value=1,layout=Layout(height='auto', width='auto'),description = 'Top Gate:',style = style)
drain = widgets.Dropdown(options=[1,2,3,4],value=2,layout=Layout(height='auto', width='auto'),description = 'Drain:',style = style)
back_gate = widgets.Dropdown(options=[1,2,3,4],value=3,layout=Layout(height='auto', width='auto'),description = 'Back Gate:',style = style)
source = widgets.Dropdown(options=[1,2,3,4],value=4,layout=Layout(height='auto', width='auto'),description = 'Source(Ground):',style = style)
vbox2 = widgets.VBox([config,top_gate,drain,back_gate,source])
vbox1=widgets.VBox([sample_information,information_grid])
display(widgets.HBox([vbox1,vbox2]))
information = {
'processing_number': information_grid[0,0],
'sample' : information_grid[1,0],
'field': information_grid[0,1],
'device':information_grid[1,1],
'width': information_grid[2,0],
'save_fig':information_grid[2,1]
}
smu_assign ={
'TG':top_gate,
'D':drain,
'S':source,
'BG':back_gate
}
return information,smu_assign
def synchronous(name,start,step,stop,comp):
synchronous_grid = GridspecLayout(4,4)
synchronous_grid[:,3]=widgets.Label(name,layout=Layout(height='auto', width='auto'))
synchronous_grid[:,3].style.font_weight = 'bold'
#first line
synchronous_grid[0,0]=widgets.Label("Start(V)",layout=Layout(height='auto', width='auto'))
synchronous_grid[0,1]=widgets.Label("Step(V)(Only 1 Gate)",layout=Layout(height='auto', width='auto'),style = style)
synchronous_grid[0,2]=widgets.Label("Stop(V)",layout=Layout(height='auto', width='auto'))
#second line
synchronous_grid[1,0]=widgets.BoundedFloatText(value=start,min=-100,max=100,step=1,layout=Layout(height='auto', width=floatbox_width))
synchronous_grid[1,1]=widgets.BoundedFloatText(value=step,min=-200,max=200,step=1,layout=Layout(height='auto', width=floatbox_width))
synchronous_grid[1,2]=widgets.BoundedFloatText(value=stop,min=-100,max=100,step=1,layout=Layout(height='auto', width=floatbox_width))
#third line
synchronous_grid[2,0]=widgets.Label("Compliance(A)",layout=Layout(height='auto', width='auto'))
synchronous_grid[2,1] =widgets.Label("Power Compliance(W)(0=OFF)",layout=Layout(height='auto', width='auto'),style = style)#mind the gap
synchronous_grid[2,2] =widgets.Label("Hysterisis(Only 1 gate)",layout=Layout(height='auto', width='auto'),style = style)#mind the gap
#fourth line
synchronous_grid[3,0]=widgets.BoundedFloatText(value=comp,min=-0.1,max=0.1,step=0.01,layout=Layout(height='auto', width=floatbox_width))
synchronous_grid[3,1]=widgets.BoundedFloatText(value=0,min=0,max=2,step=0.1,layout=Layout(height='auto', width=floatbox_width))#mind the gap
synchronous_grid[3,2]=widgets.Dropdown(options=['SINGle','DOUBle'],value='SINGle',layout=Layout(height='auto', width=floatbox_width))#mind the gap
parameters = {
'start': synchronous_grid[1,0],
'stop': synchronous_grid[1,2],
'comp': synchronous_grid[3,0],
'pcomp':synchronous_grid[3,1],
'step': synchronous_grid[1,1],
'hyst': synchronous_grid[3,2]
}
return synchronous_grid,parameters
def additional_secondary(name,start,step,stop,comp):
secondary_grid = GridspecLayout(4,4)
secondary_grid[:,3]=widgets.Label(name,layout=Layout(height='auto', width='auto'))
secondary_grid[:,3].style.font_weight = 'bold'
#first line
secondary_grid[0,0]=widgets.Label("Start(V)",layout=Layout(height='auto', width='auto'))
secondary_grid[0,1]=widgets.Label("Step(V)",layout=Layout(height='auto', width='auto'))
secondary_grid[0,2]=widgets.Label("Stop(V)",layout=Layout(height='auto', width='auto'))
#second line
secondary_grid[1,0]=widgets.BoundedFloatText(value=start,min=-100,max=100,step=1,layout=Layout(height='auto', width=floatbox_width))
secondary_grid[1,1]=widgets.BoundedFloatText(value=step,min=-200,max=200,step=1,layout=Layout(height='auto', width=floatbox_width))
secondary_grid[1,2]=widgets.BoundedFloatText(value=stop,min=-100,max=100,step=1,layout=Layout(height='auto', width=floatbox_width))
#third line
secondary_grid[2,0]=widgets.Label("Compliance(A)",layout=Layout(height='auto', width='auto'))
secondary_grid[2,2] =widgets.Label("Power Compliance(W)(0=OFF)(Only 1 Gate)",layout=Layout(height='auto', width='auto'),style = style)#mind the gap
#fourth line
secondary_grid[3,0]=widgets.BoundedFloatText(value=comp,min=-0.1,max=0.1,step=0.01,layout=Layout(height='auto', width=floatbox_width))
secondary_grid[3,2]=widgets.BoundedFloatText(value=0,min=0,max=2,step=0.1,layout=Layout(height='auto', width=floatbox_width))#mind the gap
parameters = {
'start': secondary_grid[1,0],
'step': secondary_grid[1,1],
'stop':secondary_grid[1,2],
'comp':secondary_grid[3,0],
'pcomp':secondary_grid[3,2]
}
return secondary_grid,parameters
def replot():
replot_grid = GridspecLayout(7,2)
replot_grid[0,0]= widgets.Checkbox(
description = "Replot",
value = False,
indent = False,
)
replot_grid[1,0] = widgets.Label('X-axis',layout=Layout(height='auto', width='auto'))
replot_grid[1,1] = widgets.Label('Y-axis',layout=Layout(height='auto', width='auto'))
for i in range(2):
replot_grid[2,i]= widgets.Dropdown(
options = [],
description = "Variable:",
layout=Layout(height='auto', width=floatbox_width),
)
replot_grid[3,i] = widgets.FloatText(
value = None,
description = 'min:',
layout=Layout(height='auto', width=floatbox_width),
)
replot_grid[4,i] = widgets.FloatText(
value = None,
description = 'max:',
layout=Layout(height='auto', width=floatbox_width),
)
replot_grid[5,i] = widgets.Dropdown(
description = 'scale:',
options =['linear','log'],
value = 'linear',
layout=Layout(height='auto', width=floatbox_width),
)
replot_grid[6,i]= widgets.Checkbox(
description = "Autolimits",
value = True,
style = style,
)
replot_dict ={
'x_variable':replot_grid[2,0],
'x_min':replot_grid[3,0],
'x_max':replot_grid[4,0],
'x_scale':replot_grid[5,0],
'x_auto':replot_grid[6,0],
'y_variable': replot_grid[2,1],
'y_min':replot_grid[3,1],
'y_max':replot_grid[4,1],
'y_scale':replot_grid[5,1],
'y_auto':replot_grid[6,1],
'check': replot_grid[0,0]
}
return replot_grid, replot_dict
\ No newline at end of file
This diff is collapsed.
%% Cell type:code id:890af4e0-af4e-49e7-9236-d7980e435edb tags:
``` python
import plotly.express as px
import numpy as np
import pandas as pd
from pathlib import Path
#directory = r""
#namepython = "8__"
#pathpython = Path(directory) / namepython
#path = Path(directory) / (namepython + "A.txt")
display(a)
fig_a = px.scatter(a, x="VDS/V", y="IDmm/mA/mm", color="VGS/V",
width=1300, height=800);
fig_a.show()
print("################################################################################################################################################\n\n\n")
display(d)
d["IGmm/mA/mm"] = d["IGmm/mA/mm"].abs()
fig_d = px.scatter(d, log_y=True, x="VGS/V", y="IGmm/mA/mm", width=1300,
height=800,);
#fig_d.update_yaxes(range=[np.log10(1e-6), np.log10(50)]);
fig_d.show();
print("################################################################################################################################################\n\n\n")
display(u)
fig_uID = px.scatter(u, log_y=True, x="VGS/V", y="IDmm/mA/mm",
color="VDS/V", width=1300, height=800, );
#fig_d.update_yaxes(range=[np.log10(1e-6), np.log10(250)]);
fig_uID.show();
fig_uIG = px.scatter(u, log_y=False, x="VGS/V", y="IGmm/mA/mm",
width=1300, height=800,);
fig_uIG.show();
d["IGmm/mA/mm"] = d["IGmm/mA/mm"].abs()
fig_uIG2 = px.scatter(u, log_y=True , x="VGS/V", y="IGmm/mA/mm",
width=1300, height=800,);
fig_uIG2.show();
fig_ugm = px.scatter(u, log_y=False, x="VGS/V", y="gm/mS/mm",
color="VDS/V", width=1300, height=800,);
#fig_ugm.update_xaxes(range=[-3, 2.5])
fig_ugm.show();
```
%% Cell type:code id:81f37cac-ea14-4540-8bc9-78bee248dfbb tags:
``` python
import sys
sys.path.insert(0, './lib')
sys.path.insert(0, '..') #append parent directory
from interface import *
from help import *
```
%% Cell type:code id:731635ba-6f97-4a65-ad78-ae90b277544b tags:
``` python
# Create the grids
#create the information grid
style = {'description_width': 'initial'}
sample,smu = information_box_new()
###end of sampling information#######################################
# move checkboxes outside of the tabs
transfer_check,integration_transfer,transfer_gates = header('Transfer Curve',"MEDium")
output_check,integration_output,output_gates = header('Output Curve',"SHORt")
gatediode_check,integration_gatediode,_=header('Gatediode',"MEDium")
checkboxes = widgets.HBox([transfer_check,output_check,gatediode_check])
display(checkboxes)
#transfer
Vds_transfer_widgets,Vds_transfer = secondary('VDS',0.05,0.95,1,1e-2)
Vtg_transfer_widgets,Vtg_transfer = primary('VTG',-5,0.01,5,1e-3)
Vbg_transfer_widgets,Vbg_transfer = synchronous('VBG',-15,0.1,15,1e-3)
replot_transfer_widgets,replot_transfer = replot()
transfer_box = widgets.VBox([integration_transfer,transfer_gates,Vds_transfer_widgets,Vtg_transfer_widgets,Vbg_transfer_widgets,replot_transfer_widgets])
#output
Vds_output_widgets,Vds_output = primary('VDS',0,0.01,5,1e-2)
Vtg_output_widgets,Vtg_output = secondary('VTG',-5,2,5,1e-3)
Vbg_output_widgets,Vbg_output = additional_secondary('VBG',-15,5,15,1e-3)
replot_output_widgets,replot_output = replot()
output_box = widgets.VBox([integration_output,output_gates,Vds_output_widgets,Vtg_output_widgets,Vbg_output_widgets,replot_output_widgets])
#GateDiodde
terminal = widgets.Dropdown(
options = ['VTG','VBG'],
description = 'Selected Gate:',
value ='VTG',
style= {'description_width': 'initial'}
)
Vg_gatediode_widgets,Vg_gatediode=primary('VG',-5,0.05,5,1e-3)
replot_gatediode_widgets,replot_gatediode = replot()
gatediode_box = widgets.VBox([integration_gatediode,terminal,Vg_gatediode_widgets,replot_gatediode_widgets])
#the tab widget
children = [transfer_box,output_box,gatediode_box]
titles = ["Transfer","Output","Gatediode"]
tab = widgets.Tab()
tab.children = children
tab.titles = titles
display(tab)
button = widgets.Button(description ='Start Measurement')
output = widgets.Output()
export_ini_button = widgets.Button(description = 'Export as ini')
import_ini_button = widgets.Button(description='Import from ini')
replot_button = widgets.Button(description = 'Replot',disabled = True)
all_widgets =[transfer_gates,output_gates,button,transfer_check,integration_transfer,output_check,integration_output,gatediode_check,integration_gatediode,terminal,export_ini_button,import_ini_button]
replot_widgets = [replot_transfer,replot_output,replot_gatediode,replot_button]
add_widgets_to_list(sample,all_widgets)
add_widgets_to_list(smu,all_widgets)
add_widgets_to_list(Vds_transfer,all_widgets)
add_widgets_to_list(Vtg_transfer,all_widgets)
add_widgets_to_list(Vbg_transfer,all_widgets)
add_widgets_to_list(Vds_output,all_widgets)
add_widgets_to_list(Vtg_output,all_widgets)
add_widgets_to_list(Vbg_output,all_widgets)
add_widgets_to_list(Vg_gatediode,all_widgets)
line = widgets.HBox([button,import_ini_button,export_ini_button,replot_button])
display(line,output)
```
%% Output
%% Cell type:code id:ed53d9c4-9e84-4675-b544-c6f4e2911229 tags:
``` python
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment