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

Import from ini also integrated to the release version

parent 90cb9d20
Branches
No related tags found
No related merge requests found
%% Cell type:code id:3f5d53eb-4723-4e65-8d58-22888bcc84b1 tags:
``` python
%run main.py
```
%% Output
File ~\labcode\hp4155\Custom_SMU\main.py:27
ini = widgets.Button(description = 'Import from ini. (Coming Soon)',style = {'description_width': 'initial'},layout=Layout(height='auto', width='auto')
^
SyntaxError: '(' was never closed
%% Cell type:code id:b4134f36-9202-45f5-ad20-b71dfc315edd tags:
%% Cell type:code id:432e90a3-d6c4-4718-9b1f-0b9fd77e2383 tags:
``` python
```
......
......@@ -4,6 +4,7 @@ sys.path.insert(0, '..') #append parent directory
import os
import configparser
import warnings
import traceback
from interface import *
from help import *
......@@ -24,7 +25,7 @@ tab.titles = titles
display(tab)
start = widgets.Button(description='Start Measurement')
ini = widgets.Button(description = 'Import from ini. (Coming Soon)',style = {'description_width': 'initial'},layout=Layout(height='auto', width='auto'))
ini = widgets.Button(description = 'Import from ini.')
output = widgets.Output()
display(widgets.HBox([start,ini]),output)
......@@ -467,6 +468,9 @@ def on_start_clicked(b):
for key,value in parameters.items():
config.set('SAMPLING PARAMETERS',key,str(value))
# Sampling time
config.set('SAMPLING PARAMETERS','duration',str(duration))
# Now the constant smus
config.add_section('CONSTANT SMUS')
for i, cons_smu in enumerate(cons_smus):
......@@ -608,9 +612,6 @@ def on_start_clicked(b):
ini.disabled = False
return # just to be sure
# This should be tested at the end.
# After the ini files have been created
"""
def on_ini_clicked(b):
with output:
clear_output()
......@@ -638,6 +639,7 @@ def on_ini_clicked(b):
# Get the measurement Mode
measurement_mode = get_mode(sections)
# Get the constant smus
for j in range(1,5):
third_page[21,j].value = config.get(f"CONSTANT SMU{j}",'value')
......@@ -648,6 +650,140 @@ def on_ini_clicked(b):
third_page[0,0].value = measurement_mode
third_page[0,1].value = get_integration(sections)
"""
# Get the SMU channels
for i in range(1,5):
first_page[i,1].value = config.get(f"SMU{i}",'vname')
first_page[i,2].value = config.get(f"SMU{i}",'iname')
first_page[i,3].value = config.get(f"SMU{i}",'mode')
first_page[i,4].value = config.get(f"SMU{i}",'func')
first_page[i,5].value = eval(config.get(f"SMU{i}",'disabled'))
# Get the maximum 6 user functions
for i in range(1,7):
if f"USER FUNCTION {i}" in sections:
second_page[i,0].value = config.get(f"USER FUNCTION {i}",'name')
second_page[i,1].value = config.get(f"USER FUNCTION {i}",'unit')
second_page[i,2].value = config.get(f"USER FUNCTION {i}",'expression')
# Get the Sweep units VAR1,VAR2,VARD, PULSE
# VAR1
third_page[4,0].value = config.get('VAR1','start')
third_page[5,0].value = config.get('VAR1','stop')
third_page[6,0].value = config.get('VAR1','step')
third_page[7,0].value = config.get('VAR1','comp')
third_page[8,0].value = config.get('VAR1','pcomp')
hyst = config.get('VAR1','mode')
if hyst == 'SING':
third_page[9,0].value = False
elif hyst == 'DOUB':
third_page[9,0].value = True
else:
raise Exception("Invalid Hysterisis Mode")
# VAR2
third_page[4,1].value = config.get('VAR2','start')
third_page[5,1].value = config.get('VAR2','step')
third_page[6,1].value = config.get('VAR2','points')
third_page[7,1].value = config.get('VAR2','comp')
third_page[8,1].value = config.get('VAR2','pcomp')
# VARD
third_page[4,2].value = config.get('VARD','offset')
third_page[5,2].value = config.get('VARD','ratio')
third_page[7,2].value = config.get('VARD','comp')
third_page[8,2].value = config.get('VARD','pcomp')
# PULSE
third_page[4,3].value = config.get('PULSE','period')
third_page[5,3].value = config.get('PULSE','width')
third_page[6,3].value = config.get('PULSE','base')
# Get the axes
for j in range(1,4):
fourth_page[1,j].value = config.get(f"AXIS {j}",'name')
fourth_page[2,j].value = config.get(f"AXIS {j}",'scale')
fourth_page[3,j].value = config.get(f"AXIS {j}",'min')
fourth_page[4,j].value = config.get(f"AXIS {j}",'max')
# Get the variables
for i in range(8):
if f"VARIABLE {i+1}" in sections:
fifth_page[6+i,0].value = config.get(f"VARIABLE {i+1}",'name')
fifth_page[6+i,1].value = config.get(f"VARIABLE {i+1}",'unit')
elif measurement_mode == 'SAMPLING':
third_page[0,0].value = measurement_mode
third_page[0,1].value = get_integration(sections)
# Get the SMU channels
for i in range(1,5):
first_page[i,1].value = config.get(f"SMU{i}",'vname')
first_page[i,2].value = config.get(f"SMU{i}",'iname')
first_page[i,3].value = config.get(f"SMU{i}",'mode')
first_page[i,4].value = config.get(f"SMU{i}",'func')
first_page[i,5].value = eval(config.get(f"SMU{i}",'disabled'))
# Get the maximum 6 user functions
for i in range(1,7):
if f"USER FUNCTION {i}" in sections:
second_page[i,0].value = config.get(f"USER FUNCTION {i}",'name')
second_page[i,1].value = config.get(f"USER FUNCTION {i}",'unit')
second_page[i,2].value = config.get(f"USER FUNCTION {i}",'expression')
# Get the sampling Parameters
third_page[12,0].value = config.get('SAMPLING PARAMETERS','mode')
third_page[13,0].value = config.get('SAMPLING PARAMETERS','interval')
third_page[16,0].value = config.get('SAMPLING PARAMETERS','hold')
third_page[14,0].value = config.get('SAMPLING PARAMETERS','points')
third_page[17,0].value = bool(config.get('SAMPLING PARAMETERS','filter'))
third_page[15,0].value = config.get('SAMPLING PARAMETERS','duration')
# Get the axes
for j in range(1,4):
fourth_page[1,j].value = config.get(f"AXIS {j}",'name')
fourth_page[2,j].value = config.get(f"AXIS {j}",'scale')
fourth_page[3,j].value = config.get(f"AXIS {j}",'min')
fourth_page[4,j].value = config.get(f"AXIS {j}",'max')
# Get the variables
for i in range(8):
if f"VARIABLE {i+1}" in sections:
fifth_page[6+i,0].value = config.get(f"VARIABLE {i+1}",'name')
fifth_page[6+i,1].value = config.get(f"VARIABLE {i+1}",'unit')
elif measurement_mode == 'STRESS':
third_page[0,0].value = measurement_mode
# There is no integration time
# Get the SMU channels
for i in range(1,5):
first_page[i,1].value = config.get(f"SMU{i}",'name')
# There is not iname
first_page[i,3].value = config.get(f"SMU{i}",'mode')
# Function is set automatically
first_page[i,5].value = eval(config.get(f"SMU{i}",'disabled'))
# Skip The user Functions
# Set the Stress parameters
third_page[15,0].value = config.get('PARAMETERS','stress time')
third_page[16,0].value = config.get('PARAMETERS','hold time')
third_page[17,0].value = bool(config.get('PARAMETERS','filter'))
# Skip the axes and variables
else:
raise Exception("MEASUREMENT MODE NOT FOUND!")
except Exception as e:
error_box(traceback.format_exc())
change_state(first_page,second_page,third_page,fourth_page,fifth_page)
start.disabled = False
ini.disabled = False
start.on_click(on_start_clicked)
ini.on_click(on_ini_clicked)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment