From 7ae163db72e4ed82b19fcf64c94f4342a80fd14b Mon Sep 17 00:00:00 2001 From: unknown <asoalexandros@gmail.com> Date: Thu, 12 Dec 2024 12:03:12 +0100 Subject: [PATCH] memristor version 4.1 --- hp4155/memristor (Version 4.1)/help.py | 6 ++-- hp4155/memristor (Version 4.1)/help_pulse.py | 8 ++--- hp4155/memristor (Version 4.1)/memristor.py | 32 +++++++++---------- .../memristor_buttons.ipynb | 22 ++++++++++--- 4 files changed, 39 insertions(+), 29 deletions(-) diff --git a/hp4155/memristor (Version 4.1)/help.py b/hp4155/memristor (Version 4.1)/help.py index 8348ea6..3941edf 100644 --- a/hp4155/memristor (Version 4.1)/help.py +++ b/hp4155/memristor (Version 4.1)/help.py @@ -31,6 +31,7 @@ import os #contact check between two SMUs (i,j) def contact_check(i,j,device): + device.del_user_functions() smu = [1,2,3,4] device.measurement_mode('SAMP') parameters ={ @@ -92,7 +93,6 @@ def contact_check(i,j,device): 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 @@ -137,6 +137,7 @@ def OL(device): #double sweep from start to stop and then from start to stop def sweep(start,stop,step,comp,integration,device): #step cannot be negative + device.del_user_functions() if start < stop and step < 0 : step = -step elif start > stop and step > 0 : @@ -259,7 +260,6 @@ def sampling_check(voltage,device): 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() # Plot the results @@ -278,6 +278,7 @@ def sampling_check(voltage,device): #new (retention) def retention(voltage,period,duration,device): + device.del_user_functions() parameters ={ 'mode' : 'LIN', 'hold': 0, @@ -344,7 +345,6 @@ def retention(voltage,period,duration,device): R = device.return_values('R') TIME = np.array(TIME) R = np.array(R) - device.del_user_functions() device.autoscaling() return TIME,R diff --git a/hp4155/memristor (Version 4.1)/help_pulse.py b/hp4155/memristor (Version 4.1)/help_pulse.py index 5ac0cbc..f6a4287 100644 --- a/hp4155/memristor (Version 4.1)/help_pulse.py +++ b/hp4155/memristor (Version 4.1)/help_pulse.py @@ -37,6 +37,7 @@ def check_pulse(dictionary): #sweep pulse measurement def sweep_meas(dictionary,device): + device.del_user_functions() smu_v = device.smu_dict() smu_ground = device.smu_dict() parameters = device.var1_dict() @@ -75,8 +76,6 @@ def sweep_meas(dictionary,device): device.display_variable("X","V2") device.axis_scale('X',"LIN") - device.display_variable('X','MIN',min(start,stop)) - device.display_variable('X','MAX',max(start,stop)) device.display_variable("Y1",'I2') device.axis_scale('Y1',"LIN") @@ -107,7 +106,6 @@ def sweep_meas(dictionary,device): times = (elapsed_time,expected_time) values = (V_i,I_i,R_i) - del device return times,values @@ -162,6 +160,7 @@ def save_sweep(folder,sample_dict,values,times,sweep_dict): f.write("\n\n\n") def constant_meas(dictionary,device): + device.del_user_functions() smu_v = device.smu_dict() smu_ground = device.smu_dict() sweep_params = device.var1_dict() @@ -247,7 +246,7 @@ def constant_meas(dictionary,device): times = (elapsed_time,expected_time) values = (V_i,I_i,R_i) - device.del_user_functions() + device.autoscaling() return times,values @@ -307,7 +306,6 @@ def save_constant(folder,sample_dict,values,times,cons_dict): f.write(df.to_string()) f.write("\n\n\n") -import ipywidgets as widgets #sample interface diff --git a/hp4155/memristor (Version 4.1)/memristor.py b/hp4155/memristor (Version 4.1)/memristor.py index 342fb62..ddb5750 100644 --- a/hp4155/memristor (Version 4.1)/memristor.py +++ b/hp4155/memristor (Version 4.1)/memristor.py @@ -152,14 +152,14 @@ duration=widgets.BoundedFloatText( # for automatic stop of endurance auto_stop = widgets.Checkbox( - description = 'Auto QCC after Reset', + description = 'Auto Stop', style = {'description_width': 'initial'}, value = False ) threshold = widgets.FloatText( description = "Stop Condition: R(HRS)/R(LRS)<", - style = {'description_width': 'initial'} + style = {'description_width': 'initial'}, value = 1000 ) @@ -174,7 +174,8 @@ line4 = widgets.HBox([retention_button,Vretention,period,duration]) all = widgets.VBox([line0,line1,line2,line3,line4]) output = widgets.Output() - +#choose folder directory +folder=choose_folder() #here buttons dont work yet! #display all at the end display(all_text_boxes) @@ -192,7 +193,7 @@ tab.children = children tab.titles = titles display(tab) -display(widgets.HBox([import_ini,button,export_ini_button])) +display(widgets.HBox([import_ini_button,export_ini_button])) display(output) all_widgets=[sweep_button,cons_button,sample_series,field,DUT,set,reset,full,new_folder,retention_button,contact_check,qcc,qcc_select,Vset,CC_vset,Vreset,CC_vreset,step,integration_time,number,sampling,Vretention,period,duration,auto_qcc,auto_stop,threshold,export_ini_button,import_ini_button] @@ -202,7 +203,7 @@ add_widgets_to_list(sweep_dict,all_widgets) # The regular dictionary for ini regular_parameters={ 'step': step, - 'integration': integration, + 'integration': integration_time, 'set_voltage': Vset, 'set_compliance': CC_vset, 'reset_voltage': Vreset, @@ -218,9 +219,6 @@ device = hp4155a.HP4155a('GPIB0::17::INSTR') device.reset() device.disable_not_smu() -#choose folder directory -folder=choose_folder() #here buttons dont work yet! - def on_contact_check_clicked(b): global folder,temp_file with output: @@ -439,7 +437,7 @@ def on_full_button_clicked(b): resistances.append(R_mean_set) if auto_stop.value == True and abs(R_mean_init/R_mean_set)< abs(threshold.value): stop = True - + if stop == False: # do the reset everything ok 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}") @@ -493,19 +491,17 @@ def on_full_button_clicked(b): #check for loop termination if stop == True: - clear_output(wait= True) - time.sleep(2) - display(fig) + clear_output(wait = True) information_box("Endurance stopped after esc (manually) or automatically!") + display(fig) f.write("endurance stopped!\n\n") break else: clear_output(wait = True) - time.sleep(2) - display(fig) information_box("Endurance completed!") + display(fig) f.write("endurance completed!\n\n") - + remove_hotkey('esc') stop = False @@ -576,6 +572,7 @@ def on_sweep_button_clicked(b): with output: clear_output() change_state(all_widgets) + device.inst.lock_excl() check_pulse(sweep_dict) sample_dict= { @@ -587,15 +584,15 @@ def on_sweep_button_clicked(b): times,values = sweep_meas(sweep_dict,device) plot_sweep_pulse(values) save_sweep(folder,sample_dict,values,times,sweep_dict) + device.inst.unlock() change_state(all_widgets) def on_constant_button_clicked(b): with output: - global first clear_output() change_state(all_widgets) - + device.inst.lock_excl() check_pulse(sweep_dict) sample_dict= { @@ -607,6 +604,7 @@ def on_constant_button_clicked(b): times,values = constant_meas(cons_dict,device) plot_constant_pulse(values) save_constant(folder,sample_dict,values,times,cons_dict) + device.inst.unlock() change_state(all_widgets) def on_export_ini_clicked(b): diff --git a/hp4155/memristor (Version 4.1)/memristor_buttons.ipynb b/hp4155/memristor (Version 4.1)/memristor_buttons.ipynb index c9aa7e1..f7f1517 100644 --- a/hp4155/memristor (Version 4.1)/memristor_buttons.ipynb +++ b/hp4155/memristor (Version 4.1)/memristor_buttons.ipynb @@ -9,7 +9,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "04df3def923445eb95f28afa67430db0", + "model_id": "212346701646426e93e8303278b3364e", "version_major": 2, "version_minor": 0 }, @@ -23,7 +23,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "0eeebb7ea7f64c97814087e1c195f32b", + "model_id": "3139b7a506294d9da242f0a20ad14372", "version_major": 2, "version_minor": 0 }, @@ -37,7 +37,21 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "ff84a98e2896443cbf3470c994e9b383", + "model_id": "d95060388c364b88a88bbb56670d622c", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "HBox(children=(Button(description='Import from ini', style=ButtonStyle()), Button(description='Export as ini',…" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "949c539ec0cd44ce983f7825903d8774", "version_major": 2, "version_minor": 0 }, @@ -56,7 +70,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1047e606-d5cb-420b-892f-766226339854", + "id": "cf97050b-5c05-4e11-a706-60a4d48c3d0d", "metadata": {}, "outputs": [], "source": [] -- GitLab