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

integrated sampling check in the memristor measurement

parent ecfe9a7b
Branches
No related tags found
No related merge requests found
......@@ -24,8 +24,6 @@ import numpy as np
from IPython.display import display, clear_output
import pandas as pd
from datetime import datetime
import configparser
from ipyfilechooser import FileChooser
import ipywidgets as widgets
import time
import os
......@@ -81,7 +79,7 @@ def sweep(start,stop,step,comp,integration,device):
return V, I
#sampling check
def sampling_check(device):
def sampling_check(voltage,device):
device.measurement_mode('SAMP')
......@@ -89,7 +87,7 @@ def sampling_check(device):
device.smu_mode_meas(4,'COMM')
#set voltage and compliance
device.constant_smu_sampling(2,1e-3)
device.constant_smu_sampling(2,voltage)
device.constant_smu_comp(2,'MAX')
device.sampling_mode('LIN')
......@@ -196,11 +194,26 @@ def check_values(step,set_voltage,reset_voltage):
tkinter.messagebox.showerror(message="Invalid parameter setting(step>voltage)")
#now if the set-reset voltages have the same polarity show a warning
if set_voltage*reset_voltage>0:
elif set_voltage*reset_voltage>0:
valid = tk.messagebox.askokcancel(message="Set-Reset voltages have the same polarity. Continue?")
else:
pass
root.destroy()
return valid
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()
\ No newline at end of file
......@@ -7,6 +7,7 @@ from keyboard import add_hotkey,remove_hotkey
#additional variables
first = True #first measurement
file_path = None
first_sampling = True #indicates first sampling for set and reset buttons because we cannot add two at each button
# the three naming fields
......@@ -162,6 +163,11 @@ def on_set_button_clicked(b):
valid = check_values(step.value,Vset.value,Vreset.value)
if valid == True:
if sampling.value == True and first_sampling == True: #do sampling set before set process(100mV)
R_mean = sampling_check(0.1,device)
print(f"Average Resistance(Sampling Check):{R_mean}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)
plot_sweep(V12,I12,'SET')
......@@ -170,8 +176,13 @@ def on_set_button_clicked(b):
title = f"SET Memristor:"+"\n\n"+f"Set Voltage={Vset}V"+"\n"+f"current compliance={CC_vset}A"+"\n"
write_to_file(file_path,title,df)
else:
print("Please Try again!")
if sampling.value == True: #do sampling set after set process(10mV)
R_mean = sampling_check(0.01,device)
print(f"Average Resistance(Sampling Check):{R_mean}Ohm")
first_sampling = False
#show messagebox
information_box("Measurement finished!")
change_state(buttons)
change_state(parameters)
......@@ -195,6 +206,12 @@ def on_reset_button_clicked(b):
valid = check_values(step.value,Vset.value,Vreset.value)
if valid == True:
if sampling.value == True and first_sampling == True: #do sampling set before reset process(10mV)
R_mean = sampling_check(0.01,device)
print(f"Average Resistance(Sampling Check):{R_mean}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)
plot_sweep(V34,I34,'RESET')
......@@ -203,8 +220,13 @@ def on_reset_button_clicked(b):
title =f"RESET Memristor:"+"\n\n"+f"Reset Voltage={Vreset}V"+"\n"+f"current compliance={CC_vreset}A"+"\n"
write_to_file(file_path,title,df)
else:
print("Please Try again!")
if sampling.value == True: #do sampling set after reset process(100mV)
R_mean = sampling_check(0.1,device)
print(f"Average Resistance(Sampling Check):{R_mean}Ohm")
first_sampling = False
#show messagebox
information_box("Measurement finished!")
change_state(buttons)
change_state(parameters)
......@@ -255,12 +277,27 @@ def on_full_button_clicked(b):
nonlocal stop
stop = True
#help list with the resistances
resistances = []
add_hotkey("esc",break_loop)
#execute number of measurements
for i in range(number.value):
for i in range(number.value):#here it is easier to implement the sampling checks
if sampling.value == True: #before set(100mv)
R_mean = sampling_check(0.1,device)
resistances.append(R_mean)
V12,I12 = sweep(0,Vset.value,step.value,CC_vset.value,integration_time.value,device) #set
#after set/before set
if sampling.value == True: #before set(10mv)
R_mean = sampling_check(0.01,device)
resistances.append(R_mean)
V34,I34 = sweep(0,Vreset.value,step.value,CC_vreset.value,integration_time.value,device) #reset
#no reason to do check at the end because the next loop will do that
#butterfly curve
V=np.concatenate((V12,V34))
I=np.concatenate((I12,I34))
......@@ -284,20 +321,29 @@ def on_full_button_clicked(b):
#check for loop termination
if stop == True:
print("endurance stopped after esc!")
information_box("Endurance stopped after esc!")
f.write("endurance stopped!\n\n")
break
else:
print("endurance completed!")
information_box("Endurance completed!")
f.write("endurance completed!\n\n")
remove_hotkey('esc')
stop = False
else:
print('Please Try again!')
#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)
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()
#link buttons with functions
set.on_click(on_set_button_clicked)
......
......@@ -9,7 +9,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "a46dd0031c054d3bb767255c7b03bc65",
"model_id": "abf9071e10964bb1b3a36f710c1ee2e3",
"version_major": 2,
"version_minor": 0
},
......@@ -30,7 +30,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "e6e7219bf2464d78934b27f8975276d0",
"model_id": "977d30c950bc4fb6a65f1d7fda02d3aa",
"version_major": 2,
"version_minor": 0
},
......@@ -51,7 +51,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "0f78337db38842f488bc30f76711f2c1",
"model_id": "39d46f522f0f4871828d0fa4388ba74a",
"version_major": 2,
"version_minor": 0
},
......@@ -65,7 +65,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "9aca61683d9e4ac9a550eca50a73aef1",
"model_id": "f0ce8f8078a0425da119bb011dd15e7c",
"version_major": 2,
"version_minor": 0
},
......
"""These are old help functions"""
"""These are old help functions and their dependances"""
from ipyfilechooser import FileChooser
import configparser
def decode_ini(process,ini_file):
#if fc.selected!=None:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment