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

Changes memristor 1-7

parent d51716de
No related branches found
No related tags found
No related merge requests found
......@@ -87,10 +87,10 @@ def contact_check(i,j,device):
while device.operation_completed() == False:
time.sleep(2)
device.autoscaling()
R = device.return_values(f'R{i}{j}')[0] #only the first value
print(f"R{i}{j}:{'{:.2e}'.format(R)} Ohm")
device.del_user_functions()
device.autoscaling()
return R
......@@ -241,24 +241,31 @@ def sampling_check(voltage,device):
device.user_function('R','OHM','V2/I2')
device.display_variable('X','@TIME')
device.display_variable('X','@INDEX')
device.display_variable('Y1','R')
device.single_measurement()
while device.operation_completed() == False:
time.sleep(2)
device.autoscaling()
R = device.return_values('R')
R = np.array(R)
index = np.array(device.return_values('@INDEX'))
R = np.array(device.return_values('R'))
R_mean = np.average(R)
device.del_user_functions()
device.autoscaling()
if np.max(R)/np.min(R)>10:
# red color code red = '\033[91m'
red = '\033[91m'
print()
return R_mean
# Plot the results
fig,ax = plt.subplots()
ax.set_title(f"Average Resistance(Sampling Check):{'{:.2e}'.format(R_mean)} Ohm")
ax.set_yscale('log')
ax.set_ylabel('Resistance (Ohm)')
ax.set_xlabel('Sampling Index')
ax.set_xticks(index)
ax.scatter(index,np.absolute(R),label = f"Voltage={voltage}V")
ax.legend()
display(fig)
return R_mean
#new (retention)
def retention(voltage,period,duration,device):
......@@ -314,12 +321,13 @@ def retention(voltage,period,duration,device):
while device.operation_completed() == False:
time.sleep(2)
device.autoscaling()
TIME = device.return_values('@TIME')
R = device.return_values('R')
TIME = np.array(TIME)
R = np.array(R)
device.del_user_functions()
device.autoscaling()
return TIME,R
......
......
......@@ -229,7 +229,7 @@ def constant_meas(dictionary,device):
t1 = time.time()
# get the execution time
elapsed_time = t1 - t0
device.autoscaling()
I_i=device.return_values("I2")
V_i=device.return_values("V2")
......@@ -242,6 +242,7 @@ def constant_meas(dictionary,device):
values = (V_i,I_i,R_i)
device.del_user_functions()
device.autoscaling()
return times,values
......
......
......@@ -6,6 +6,9 @@ from keyboard import add_hotkey,remove_hotkey
# pulsed libraries
from help_pulse import *
import warnings
warnings.filterwarnings("ignore")
#create temporary file to store the results localy
temp_file= os.path.join(os.getcwd(),'tempfile.txt')
......@@ -195,7 +198,7 @@ device.disable_not_smu()
def on_contact_check_clicked(b):
global folder,temp_file
with output:
clear_output(wait = True)
clear_output()
change_state(all_widgets)
device.inst.lock_excl()
......@@ -219,7 +222,7 @@ def on_contact_check_clicked(b):
def on_qcc_clicked(b):
global folder,temp_file
with output:
clear_output(wait = True)
clear_output()
change_state(all_widgets)
device.inst.lock_excl()
......@@ -268,8 +271,7 @@ def on_set_button_clicked(b):
if valid == True:
if sampling.value == True: #do sampling set before set process(100mV)
R_mean_before= sampling_check(-0.01,device)
print(f"Average Resistance(Sampling Check):{'{:.2e}'.format(R_mean_before)} Ohm")
first_sampling = False
#execute measurement,plot results and save them
V12,I12 = sweep(0,Vset.value,step.value,CC_vset.value,integration_time.value,device)
......@@ -280,8 +282,6 @@ def on_set_button_clicked(b):
if sampling.value == True: #do sampling set after set process(10mV)
R_mean_after = sampling_check(0.01,device)
print(f"Average Resistance(Sampling Check):{'{:.2e}'.format(R_mean_after)} Ohm")
first_sampling = False
date = str(datetime.today().replace(microsecond=0))
title = [f"SET Memristor at {date}",f"Set Voltage={Vset.value}V",f"current compliance={CC_vset.value}A"]
......@@ -320,8 +320,6 @@ def on_reset_button_clicked(b):
if valid == True:
if sampling.value == True: #do sampling set before reset process(10mV)
R_mean_before = sampling_check(0.01,device)
print(f"Average Resistance(Sampling Check):{'{:.2e}'.format(R_mean_before)} Ohm")
first_sampling = False
#execute measurement,plot results and save them
V34,I34 = sweep(0,Vreset.value,step.value,CC_vreset.value,integration_time.value,device)
......@@ -331,8 +329,6 @@ def on_reset_button_clicked(b):
if sampling.value == True: #do sampling set after reset process(100mV)
R_mean_after = sampling_check(-0.01,device)
print(f"Average Resistance(Sampling Check):{'{:.2e}'.format(R_mean_after)} Ohm")
first_sampling = False
date = str(datetime.today().replace(microsecond=0))
title =[f"RESET Memristor at {date}",f"Reset Voltage={Vreset.value}V",f"current compliance={CC_vreset.value}A"]
......@@ -382,7 +378,6 @@ def on_full_button_clicked(b):
with open(temp_file,'a') as f:
header =[f"{number.value} full sweeps with parameters:",f"Set Voltage = {Vset.value}V",f"Current compliance set = {CC_vset.value}A",f"Reset Voltage = {Vreset.value}V",f"Current compliance reset = {CC_vreset.value}A"]
plt.figure().clear()
fig, (ax1, ax2) = plt.subplots(2,sharex=True,figsize=(8,6)) #the plots share the same x axis
fig.suptitle('FULL SWEEP')
ax1.set_title('Linear I')
......@@ -402,12 +397,15 @@ def on_full_button_clicked(b):
add_hotkey("esc",break_loop)
#execute number of measurements
for i in range(number.value):#here it is easier to implement the sampling checks
clear_output(wait = True)
clear_output()
if i>0 :
display(fig)
if sampling.value == True: #before set(100mv)
R_mean_init = sampling_check(-0.01,device)
resistances.append(R_mean_init)
V12,I12 = sweep(0,Vset.value,step.value,CC_vset.value,integration_time.value,device) #set
plot_sweep(V12,I12,f"SET Iteration {i+1}")
#after set/before reset
if sampling.value == True: #before set(10mv)
......@@ -415,6 +413,12 @@ def on_full_button_clicked(b):
resistances.append(R_mean_set)
V34,I34 = sweep(0,Vreset.value,step.value,CC_vreset.value,integration_time.value,device) #reset
plot_sweep(V34,I34,f"RESET Iteration {i+1}")
#after reset
if sampling.value == True:#-0.1V
R_mean_reset = sampling_check(-0.01,device)
resistances.append(R_mean_reset)
#Quick Contact Check after reset Process
if auto_qcc.value == True:
......@@ -423,20 +427,13 @@ def on_full_button_clicked(b):
else: # OL
R = OL(device)
#no reason to do check at the end because the next loop will do that(not anymore) more sampling checks
#after reset
if sampling.value == True:#-0.1V
R_mean_reset = sampling_check(-0.01,device)
resistances.append(R_mean_reset)
#butterfly curve
V=np.concatenate((V12,V34))
I=np.concatenate((I12,I34))
#create data frame and save to file
df = create_data_frame(V,I)
display(df)
if i == 0 :
header.extend([f"{i+1} Iteration"])
title = header.copy()
......@@ -451,16 +448,11 @@ def on_full_button_clicked(b):
title= [f"Quick Contact Check({qcc_select.value}) after Reset"]
write_to_file(temp_file,title,R)
#plot results
ax1.plot(V,I)
ax2.plot(V,np.absolute(I))
fig.tight_layout()
#update plot
display(fig)
display(df)
#check for loop termination
if stop == True:
information_box("Endurance stopped after esc!")
......@@ -476,26 +468,21 @@ def on_full_button_clicked(b):
#plot resistances if sampling value == True or len(resistances) !=0
if len(resistances)!=0:
indexes = np.arange(1,len(resistances)+1)
resistances = np.array(resistances)
resistances = np.absolute(resistances)
plt.figure().clear()
fig, ax = plt.subplots()
fig.suptitle('Resistance')
ax.set(xlabel='Index',ylabel='Resistance(Ohm)')
ax.set_yscale('log')
plt.scatter(indexes,resistances)
plt.show()
#print(len(resistances))
#print(indexes)
fig.suptitle('Average Resistances from sampling checks')
ax.set(xlabel='Index',ylabel='Resistance(Ohm)',yscale='log')
ax.scatter(indexes,resistances)
display(fig)
#upload results
temp_file,file,folder=upload_results(temp_file,file,folder)
#unlock the device
device.inst.unlock()
change_state(all_widgets)
......@@ -543,7 +530,7 @@ def on_retention_button_clicked(b):
def on_sweep_button_clicked(b):
with output:
clear_output(wait = True)
clear_output()
change_state(all_widgets)
check_pulse(sweep_dict)
......@@ -565,7 +552,7 @@ def on_sweep_button_clicked(b):
def on_constant_button_clicked(b):
with output:
global first
clear_output(wait = True)
clear_output()
change_state(all_widgets)
check_pulse(sweep_dict)
......
......
%% Cell type:code id:7611a98c-c1cf-46cb-bdd9-fd3dc6a1f53c 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:ca8f0bc8-670c-4deb-bedb-8d5d92b978f2 tags:
%% Cell type:code id:01f338ba-d3a5-47ec-993e-53866010308b tags:
``` python
```
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment