Skip to content
Snippets Groups Projects
Commit 7e46f090 authored by JupyterHub User's avatar JupyterHub User
Browse files

implemented 5 points CTLM with plots and txt file

parent 58383bec
No related branches found
No related tags found
No related merge requests found
...@@ -131,16 +131,28 @@ def stress_sampling(): ...@@ -131,16 +131,28 @@ def stress_sampling():
del device del device
# These are some help functions for the setup of the CTLM measurement
def single_ctlm(time,start=-50*10**(-3),stop=50*10**(-3),step=10**(-3),comp=10V): #prepare full measurement
def ctlm(field_name ='M00',time='MED',start=-50*10**(-3),stop=50*10**(-3),step=10**(-3),comp=10V,distances=(5,10,15,25,45)):
#connect to the device
device = module.HP4155a('GPIB0::17::INSTR')
#initilize figure
plt.figure()
plt.xlabel('Voltage(V)')
plt.ylabel('Current(A)')
plt.title("CTLM plot")
plt.legend()
#execute five measurements
for j in range(len(distances)):
#setup
device.reset() device.reset()
device.inst.write(":PAGE:MEAS") device.inst.write(":PAGE:MEAS")
device.inst.write(":PAGE:CHAN:MODE SWEEP") #go to sweep page and prepare sweep measurement device.inst.write(":PAGE:CHAN:MODE SWEEP") #go to sweep page and prepare sweep measurement
#setup smus
#smu1 is constant and common #smu1 is constant and common
device.smu_mode_meas(1,'COMM') device.smu_mode_meas(1,'COMM')
device.smu_function_sweep(1,'CONS') device.smu_function_sweep(1,'CONS')
...@@ -179,6 +191,7 @@ def single_ctlm(time,start=-50*10**(-3),stop=50*10**(-3),step=10**(-3),comp=10V) ...@@ -179,6 +191,7 @@ def single_ctlm(time,start=-50*10**(-3),stop=50*10**(-3),step=10**(-3),comp=10V)
while device.operation_completed() == False: while device.operation_completed() == False:
pass pass
voltage_values = device.return_data('V3') voltage_values = device.return_data('V3')
current_values = device.return_data('I3') current_values = device.return_data('I3')
...@@ -187,3 +200,33 @@ def single_ctlm(time,start=-50*10**(-3),stop=50*10**(-3),step=10**(-3),comp=10V) ...@@ -187,3 +200,33 @@ def single_ctlm(time,start=-50*10**(-3),stop=50*10**(-3),step=10**(-3),comp=10V)
for i in range(len(voltage_values)): for i in range(len(voltage_values)):
resistance_values.append(voltage_values[i]/current_values[i]) resistance_values.append(voltage_values[i]/current_values[i])
#plot results of the single measurement
plt.plot(voltage_values,current_values,label=f"distance={distances[j]}")
#save measurement as txt file
#add title to the results
header = ['Voltage(V)', 'Current(A)','Resistance(Ohm)']
data = {header[0]:voltage_values,header[1]:current_values,header[2]:resisance_values}
df = pd.DataFrame(data)
print(df)
date = str(datetime.today().replace(microsecond=0))
file_name = f"{field_name}_CTLM_{j+1}.txt"
#path = f"\\FILESERVER\public\Datentransfer\Asonitis, Alexandros\{file_name}"
#export DataFrame to text file (keep header row and index column)
with open(file_n, 'a') as f:
f.write('title\n')
df_string = df.to_string()
f.write(df_string)
#wait for confirmation from user after a measurement is done
while True:
answer = input('please press enter to continue with the next measurement or finish after the last measurement!')
if answer == "":
break
#close the connection and plot all the diagramms
plt.show()
del device
Source diff could not be displayed: it is too large. Options to address this: view the blob.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment