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

TLM measurement programm interface

parent 3ecee478
Branches
No related tags found
No related merge requests found
import ipywidgets as widgets
from ipywidgets import GridspecLayout,Layout
from IPython.display import clear_output
import sys
# Interface to collect information about the sample
def sample_interface():
width = "90%"
height = "auto"
style = {'description_width': 'initial'}
sample = GridspecLayout(6,2)
sample[0,0] = widgets.Label("Sample Information")
sample[0,0].style.font_weight = 'bold'
#iterate over the first two columns
for i in range(1,6,2):
sample[i:i+2,0]= widgets.Text(layout=Layout(height=height, width=width),style = style)
sample[1:3,0].description = "Processing Number:"
sample[3:5,0].description = "Sample Series:"
sample[5:7,0].description = "Field:"
#measurement information in the next columns
sample[1:3,1]= widgets.Dropdown(options=["TLM","CTLM"],value ='TLM',layout=Layout(height=height, width='60%'),description="Type:") #TLM or CTLM
sample[3:5,1]= widgets.BoundedIntText(value=50,min=1,max=sys.maxsize,step=1,layout=Layout(height=height, width=width),description="Contactlength(um):",style = style)
sample[5:7,1]= widgets.BoundedIntText(value=100,min=1,max=sys.maxsize,step=1,layout=Layout(height=height, width='60%'),description="Width(um):",style = style)
def on_type_change(change):
if change['new'] =="TLM":
sample[3:5,1].value = 50
sample[3:5,1].description = 'Contactlength(um)'
else:
sample[3:5,1].value = 55
sample[3:5,1].description = 'Inner Radius(um)'
sample[1:3,1].observe(on_type_change, names='value')
display(sample)
print()
sample_dict = {
'processing_number':sample[1:3,0],
'sample_series':sample[3:5,0],
'field':sample[5:7,0],
'type':sample[1:3,1],
'length':sample[3:5,1],
'width':sample[5:7,1],
}
return sample_dict
#function to get interface from measurement parameters
def parameters_interface():
width = "60%"
height = "auto"
style = {'description_width': 'initial'}
parameters_title=widgets.Label("Parameters",layout=Layout(height=height, width='50%'))
parameters_title.style.font_weight='bold'
parameters = GridspecLayout(2,4)
# Constant Value
parameters[0,0]=widgets.HTML("Source (A)<br>0nA to 101 mA",layout=Layout(height=height, width=width))
parameters[0,1]=widgets.BoundedFloatText(value=1e-4,min=0,max=0.101,step=1e-3,layout=Layout(height=height, width=width))
#compliance value
parameters[0,2] = widgets.HTML("V-compliance (V)<br>1 to 105V",layout=Layout(height=height, width=width))
parameters[0,3] = widgets.BoundedFloatText(value=20,min=1,max=105,step=1,layout=Layout(height=height, width=width))
# Dwell time
parameters[1,0]=widgets.HTML("dwell time (sec)<br>50ms to 999.9s",layout=Layout(height=height, width=width))
parameters[1,1]=widgets.BoundedFloatText(value=50e-3,min=-0.1,max=0.1,step=1e-3,layout=Layout(height=height, width=width))
display(parameters_title)
display(parameters)
print()
parameters_dict = {
'source':parameters[0,1],
'comp':parameters[0,3],
'dwell':parameters[1,1],
}
return parameters_dict
def measured_values():
title = widgets.Label("Measured Values",layout=Layout(height='auto', width='auto'))
title.style.font_weight='bold'
values = GridspecLayout(6,3)
# Title of each column
values[0,0] = widgets.HTML("Distance <br> (µm)",layout=Layout(height='auto', width='auto'))
values[0,1] = widgets.HTML("Voltage <br> (V)",layout=Layout(height='auto', width='auto'))
values[0,2] = widgets.HTML("Resistance <br> (Ohm)",layout=Layout(height='auto', width='auto'))
# iterate over the first colmumn for the distances
distances = [5,10,15,20,50]
for i,distance in enumerate(distances):
values[i+1,0]= widgets.BoundedIntText(value=int(distance),min=1,max=sys.maxsize,step=1,layout=Layout(height='auto', width='auto'))
# Iterate over voltage and resistance column
for j in range(1,3): # The 2 columns
for i in range(1,6): # The 5 Values
values[i,j] = widgets.FloatText(value = 0, layout=Layout(height='auto', width='auto'),disabled = True)
display(title)
display(values)
print()
values_dict = dict()
for j in range(0,3): # The 3 columns
for i in range(1,6): # The 5 rows
if j == 0:
key = f"d{i}"
elif j == 1:
key = f"V{i}"
else: # j== 2
key = f"R{i}"
values_dict[key] = values[i,j]
return values_dict
%% Cell type:code id:32c13f8d-a4af-47dc-918c-134211f95ed7 tags:
``` python
from interface import *
#the interface
sample = sample_interface()
parameters = parameters_interface()
results = measured_values()
```
%% Output
%% Cell type:code id:486dd859-bcaa-48b7-9e30-ab91884777c5 tags:
``` python
```
File moved
File moved
File moved
File moved
File moved
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment