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

corrected errors of the previous commit after testing

parent 80845658
No related branches found
No related tags found
No related merge requests found
......@@ -81,6 +81,11 @@ class HP4155a(object):
command=f":PAGE:STR:SMU{smu_number}:NAME '{name}'"
self.inst.write(command)
def copy_current_page(self):
command=":HCOP:DATA?"
data=self.inst.query(command)
return data
#-----------------------------------------------------------sweep functions---------------------------------------------------------------
def smu_disable_sweep(self,number):
command= f":PAGE:CHAN:SMU{number}:DIS"
......
......@@ -2,7 +2,7 @@
VGS=-12
VDS=10
comp= 0.1
time = 30
time = 4
[sampling]
mode=L10
......
......@@ -96,19 +96,21 @@ def Stress_Sampling():
if stress_counter==0 and sampling_counter==0:
if pc.selected != None:
save_file_path=pc.selected
print(f'save data to:{save_file_path}')
else: #here we can clear the output the opposute is (stress_counter!=0 or sampling_counter!=0)
clear_output()
#read the ini file
if fc.selected!=None:
ini_file=fc.selected
print(f"get parameters from:{ini_file}")
#configparser to raed parameters from the ini file for stress
cp=configparser.ConfigParser()
cp.read(ini_file)
VDS_str=cp.getfloat('stress','VDS')
VGS_str=cp.getfloat('stress','VGS')
stress_time=cp.getfloat('time','comp')
stress_time=cp.getfloat('stress','time')
str_comp=cp.getfloat('stress','comp')
#setup the device
device.stress_page() #go to stress page
......@@ -131,14 +133,17 @@ def Stress_Sampling():
device.smu_value(3,VGS_str)
#time
device.stress_time(stress_time)
print(device.error())
device.start_stress()
#message for the user
print("stress operation in progress please wait...")
while device.operation_completed() == False:
pass
print("stress operation completed!")
data = device.copy_current_page() #retuns the stress output from the machine
print(data)#test
print("stress operation completed!")
#increase stress counter
stress_counter= stress_counter+1
......@@ -149,6 +154,7 @@ def Stress_Sampling():
if stress_counter == 0 and sampling_counter == 0:
if pc.selected!=None:
save_file_path = pc.selected
print(f'save data to:{save_file_path}')
else:
clear_output()
......@@ -156,8 +162,10 @@ def Stress_Sampling():
if fc.selected!=None:
ini_file = fc.selected
print(f"get parameters from:{ini_file}")
#get parameters from ini exception Handling will be added later
cp=configparser.Configparser()
cp=configparser.ConfigParser()
cp.read(ini_file)
VDS_sampling=cp.getfloat('sampling','VDS')
......@@ -168,7 +176,7 @@ def Stress_Sampling():
number_of_points=cp.getint('sampling','number_of_samples')
integration_time=cp.get('sampling','integration_time')
initial_interval=cp.getfloat('sampling','initial_interval')
hold_time=cp.getfloat('sampling','initial interval')
hold_time=cp.getfloat('sampling','hold_time')
#start with sampling measurement
device.measurement_mode('SAMP')
......@@ -200,6 +208,7 @@ def Stress_Sampling():
device.constant_smu_sampling(3,VGS_sampling)
device.constant_smu_comp(2,samp_Vds_comp)
device.constant_smu_comp(3,samp_Vgs_comp)
print(device.error())
#set sampling parameters
device.sampling_mode(sampling_mode)
......@@ -207,13 +216,16 @@ def Stress_Sampling():
device.integration_time(integration_time)
device.initial_interval(initial_interval)
device.delay_time(hold_time)
print(device.error())
#define user functions
device.user_function('ABSIGm','mA/mm','ABS(1E4*IG)')
device.user_function('ABSIDm','mA/mm','ABS(1E4*ID)')
print(device.error())
#as shown at text file two more user functions have to be defined
device.user_function('IDmm','mA/mm','1E4*ID')
device.user_function('IGmm','mA/mm', '1E4*IG')
print(device.error())
device.display_variable('X','@TIME')
device.display_variable('Y1','ABSIDm')
......@@ -233,6 +245,9 @@ def Stress_Sampling():
#we need this function for the dataframe at the txt.
IDmm = device.return_data('IDmm')
IGmm = device.return_data('IGmm')
#test
print(IDmm)
print(IGmm)
plt.figure().clear()
fig, ax1 = plt.subplots()
......@@ -241,7 +256,7 @@ def Stress_Sampling():
ax1.set_xlabel('time(s)')
ax1.set_ylabel('IG(mA/mm)', color = color)
ax1.set_yscale('log')#logaritmic scale
ax1.plot(time, IG, color = color)
ax1.plot(time, ABSIGm, color = color)
ax1.tick_params(axis ='y', labelcolor = color)
# Adding Twin Axes to plot using dataset_2
......@@ -249,7 +264,7 @@ def Stress_Sampling():
color = 'tab:green'
ax2.set_ylabel('ID(ma/mm)', color = color)
ax2.plot(time, ID, color = color)
ax2.plot(time, ABSIDm, color = color)
ax2.set_yscale('log') #logarithmic scale
ax2.tick_params(axis ='y', labelcolor = color)
......
%% Cell type:code id:6ad34005-0b22-4016-8f1a-c733e140945b tags:
``` python
from stress_sampling import *
Stress_Sampling()
```
%% Output
%% Cell type:code id:f730213c-12cb-4a4d-8896-180a8091fc2a tags:
``` python
```
......
%% Cell type:code id:8ec7e7da-5d72-46b5-97dd-d02d83068f9c tags:
``` python
import ipywidgets as widgets
from IPython.display import display, clear_output
import configparser
import os
import matplotlib.pyplot as plt
from ipyfilechooser import FileChooser
from pathlib import Path
```
%% Cell type:code id:414970ee-991a-478a-bf6c-98745e924bcb tags:
``` python
uploader=widgets.FileUpload(
accept='.ini', # Accepted file extension
multiple=False, # True to accept multiple files upload else False
description='Upload ini file'
)
display(uploader)
```
%% Output
%% Cell type:code id:f03428fa-44f1-4932-97f8-8dde2f31413d tags:
``` python
print(uploader)
uploaded_file = uploader.value[0]
uploaded_file.name
```
%% Output
FileUpload(value=(), accept='.ini', description='Upload ini file')
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
Cell In[4], line 2
1 print(uploader)
----> 2 uploaded_file = uploader.value[0]
3 uploaded_file.name
IndexError: tuple index out of range
%% Cell type:code id:7ff141c7-8be6-45b7-b233-25ee68c1e968 tags:
``` python
config=configparser.ConfigParser()
location=r"\\FILESERVER\public\Datentransfer\Asonitis, Alexandros"
path=os.path.join(location,uploaded_file.name)
config.read(path)
config.sections()
```
%% Output
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[5], line 3
1 config=configparser.ConfigParser()
2 location=r"\\FILESERVER\public\Datentransfer\Asonitis, Alexandros"
----> 3 path=os.path.join(location,uploaded_file.name)
4 config.read(path)
5 config.sections()
NameError: name 'uploaded_file' is not defined
%% Cell type:code id:58f94ab0-1282-4cd6-8411-32d47f3ad502 tags:
``` python
print(config['parameters'])
```
%% Output
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
Cell In[6], line 1
----> 1 print(config['parameters'])
File ~\AppData\Local\Programs\Python\Python312\Lib\configparser.py:941, in RawConfigParser.__getitem__(self, key)
939 def __getitem__(self, key):
940 if key != self.default_section and not self.has_section(key):
--> 941 raise KeyError(key)
942 return self._proxies[key]
KeyError: 'parameters'
%% Cell type:code id:3f4292fb-1a51-4398-bad0-8cb00d250c17 tags:
``` python
import codecs
codecs.decode(uploaded_file.content, encoding="utf-8")
```
%% Output
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[7], line 2
1 import codecs
----> 2 codecs.decode(uploaded_file.content, encoding="utf-8")
NameError: name 'uploaded_file' is not defined
%% Cell type:code id:2f5bd133-bf0b-4463-ad31-a5f89482b4a9 tags:
``` python
t= config.items('parameters')
print(t)
```
%% Output
[('start', '-0.05'), ('stop', '0.05'), ('step', '0.001'), ('comp', '10'), ('time', 'MED')]
%% Cell type:code id:6c32389f-7e78-4b89-a5ef-e20a2f7d3a56 tags:
``` python
config.getfloat('parameters','start')
```
%% Output
-0.05
%% Cell type:code id:16ea860b-87be-4b6a-a983-57aeeb404b31 tags:
``` python
button = widgets.Button(description="Click Me!")
output = widgets.Output()
display(button, output)
def on_button_clicked(b):
with output:
resistance = [199.0687, 203.1307, 207.3624, 211.7744, 216.3797, 221.1893, 226.2174, 231.4787, 236.9896, 242.7693, 248.838, 255.2181, 261.9341, 269.0141, 276.4874, 284.3889, 292.7551, 301.6264, 311.0509, 321.0848, 331.7863, 343.2259, 355.4841, 368.6504, 382.8311, 398.1461, 414.7365, 432.7694, 452.4416, 473.9852, 491.4541, 488.2188, 485.5548, 482.6365, 480.0089, 477.8993, 475.462, 473.3512, 471.7728, 469.9153, 468.2796, 467.1869, 465.7367, 465.1277, 463.9013, 462.756, 462.8145, 461.8933, 460.749, 462.548, -9.9e+307, 459.826, 459.255, 460.9573, 462.064, 462.1692, 463.4757, 464.6631, 465.969, 466.9178, 468.4606, 470.2536, 471.66, 473.7292, 475.982, 478.0425, 480.7104, 483.5262, 486.6198, 489.6606, 493.1878, 473.9649, 452.4223, 432.7527, 414.7214, 398.1343, 382.8215, 368.6438, 355.4759, 343.2188, 331.7775, 321.0737, 311.0401, 301.6142, 292.7427, 284.3794, 276.4811, 269.0093, 261.9302, 255.2141, 248.8343, 242.7657, 236.9855, 231.4752, 226.2149, 221.1874, 216.3789, 211.7756, 207.3632, 203.1304, 199.0674]
current=[-0.05, -0.049, -0.048, -0.047, -0.046, -0.045, -0.044, -0.043, -0.042, -0.041, -0.04, -0.039, -0.038, -0.037, -0.036, -0.035, -0.034, -0.033, -0.032, -0.031, -0.03, -0.029, -0.028, -0.027, -0.026, -0.025, -0.024, -0.023, -0.022, -0.021, -0.02, -0.019, -0.018, -0.017, -0.016, -0.015, -0.014, -0.013, -0.012, -0.011, -0.01, -0.009, -0.008, -0.007, -0.006, -0.005, -0.004, -0.003, -0.002, -0.001, 0.0, 0.001, 0.002, 0.003, 0.004, 0.005, 0.006, 0.007, 0.008, 0.009, 0.01, 0.011, 0.012, 0.013, 0.014, 0.015, 0.016, 0.017, 0.018, 0.019, 0.02, 0.021, 0.022, 0.023, 0.024, 0.025, 0.026, 0.027, 0.028, 0.029, 0.03, 0.031, 0.032, 0.033, 0.034, 0.035, 0.036, 0.037, 0.038, 0.039, 0.04, 0.041, 0.042, 0.043, 0.044, 0.045, 0.046, 0.047, 0.048, 0.049, 0.05]
resistance[current.index(0)]=float('NAN')
voltage = [-9.953434, -9.953406, -9.953396, -9.953398, -9.953468, -9.95352, -9.953564, -9.953582, -9.953562, -9.95354, -9.95352, -9.953506, -9.953494, -9.953522, -9.953548, -9.95361, -9.953674, -9.953672, -9.953628, -9.953628, -9.953588, -9.953552, -9.953556, -9.953562, -9.953608, -9.953652, -9.953676, -9.953696, -9.953716, -9.95369, -9.829082, -9.276158, -8.739986, -8.20482, -7.680142, -7.16849, -6.656468, -6.153566, -5.661274, -5.169068, -4.682796, -4.204682, -3.725894, -3.255894, -2.783408, -2.31378, -1.851258, -1.38568, -0.921498, -0.462548, -0.003156, 0.459826, 0.91851, 1.382872, 1.848256, 2.310846, 2.780854, 3.252642, 3.727752, 4.20226, 4.684606, 5.17279, 5.65992, 6.15848, 6.663748, 7.170638, 7.691366, 8.219946, 8.759156, 9.303552, 9.863756, 9.953262, 9.95329, 9.953312, 9.953314, 9.953358, 9.95336, 9.953382, 9.953324, 9.953344, 9.953324, 9.953284, 9.953284, 9.95327, 9.953252, 9.953278, 9.953318, 9.953344, 9.953348, 9.95335, 9.953374, 9.953392, 9.953392, 9.953434, 9.953456, 9.953434, 9.95343, 9.953454, 9.953434, 9.95339, 9.95337]
fig = plt.figure()
plt.plot(voltage,current)
display(fig)
button.on_click(on_button_clicked)
```
%% Output
%% Cell type:code id:3b2291fe-3dd1-41ca-94d3-dcacd687433b tags:
``` python
fig=0
ax1=0
ax2=0
fig, (ax1, ax2) = plt.subplots(2,sharex=True,figsize=(8,6)) #the plots share the same x axis
fig.suptitle('CTLM plot')
ax1.set_title('I(V)')
ax1.set(xlabel='Voltage(V)',ylabel='Current(A)')
ax2.set_title('R(V)')
ax2.set(xlabel='Voltage(V)',ylabel='Resistance(Ohm)')
```
%% Output
[Text(0.5, 0, 'Voltage(V)'), Text(0, 0.5, 'Resistance(Ohm)')]
%% Cell type:code id:1640acf0-267e-4b40-b2a9-a6e73725d787 tags:
``` python
fc = FileChooser(select_desc='load .ini')
fc.filter_pattern = '*.ini'
display(fc)
pc = FileChooser(select_desc="save path")
pc.show_only_dirs = True
display(pc)
```
%% Output
%% Cell type:code id:209c5f24-42a7-40db-bab6-749b20564775 tags:
``` python
from IPython.display import display
button = widgets.Button(description="Click Me!")
output = widgets.Output()
button1 = widgets.Button(description="Me!")
output1 = widgets.Output()
display(button1,output1)
display(button, output)
def on_me_clicked(b):
with output1:
print("Hi")
def on_button_clicked(b):
with output1:
clear_output()
with output:
print("Button clicked.")
button.on_click(on_button_clicked)
button1.on_click()
```
%% Output
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[11], line 21
18 print("Button clicked.")
20 button.on_click(on_button_clicked)
---> 21 button1.on_click()
TypeError: Button.on_click() missing 1 required positional argument: 'callback'
%% Cell type:code id:e39e8c06-cbf4-48e9-8b47-1542b7c43a31 tags:
``` python
import ipywidgets as widgets
from IPython.display import display
# Create a text input widget
text_input = widgets.Text(
value='hi', # Initial value (can be left empty)
placeholder='Enter text here',
description='Input:',
)
# Display the text input widget
display(text_input)
# Function to handle the input
def handle_text_input(change):
input_value = change.new
print("Input value:", input_value)
# Attach the event handler to the text input widget
text_input.observe(handle_text_input, names='value')
# To access the current value as a variable:
current_value = text_input.value
print("Current value:", current_value)
```
%% Output
Current value: hi
%% Cell type:code id:b2225351-6fbe-4c3a-b268-c99b7bed44f6 tags:
``` python
import sys
sys.path.append(r"\\FILESERVER\public")
pc = FileChooser(select_desc="save path",select_default=True)
pc.show_only_dirs = True
display(pc)
```
%% Output
%% Cell type:code id:a730be0d-6f1e-4bbd-8e6a-d6a13766a76c tags:
``` python
```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment