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

moved files and old measurements

parent fe290fc9
Branches
No related tags found
No related merge requests found
......@@ -144,135 +144,6 @@ def stress_sampling(V2_stress=10,V3_stress=3,stress_time=30,V2_sampling=10,V3_sa
del device
#prepare full measurement
def ctlm(field_name ='M00',start=-50*10**(-3),stop=50*10**(-3),step=10**(-3),comp=10,distances=(5,10,15,25,45),time='MED',innen=0):
#connect to the device
device = module.HP4155a('GPIB0::17::INSTR')
date = str(datetime.today().replace(microsecond=0))
#initilize figure
plt.figure()
plt.xlabel('Voltage(V)')
plt.ylabel('Current(A)')
plt.title("CTLM plot")
#lists for appending all data values
ctlm_voltage = []
ctlm_current = []
ctlm_resistance = []
#execute five measurements
for j in range(len(distances)):
#setup
device.reset()
device.inst.write(":PAGE:MEAS")
device.inst.write(":PAGE:CHAN:MODE SWEEP") #go to sweep page and prepare sweep measurement
#vsus and vmus are disabled
device.disable_vsu(1)
device.disable_vsu(2)
device.disable_vmu(1)
device.disable_vmu(2)
#smu1 is constant and common
device.smu_mode_meas(1,'COMM')
device.smu_function_sweep(1,'CONS')
#smu2 is constant and I
device.smu_mode_meas(2,'I')
device.smu_function_sweep(2,'CONS')
device.cons_smu_value(2,0)
#smu3 is var1 and I
device.smu_mode_meas(3,'I')
device.smu_function_sweep(3,'VAR1')
#smu4 is constant and I
device.smu_mode_meas(4,'I')
device.smu_function_sweep(4,'CONS')
device.cons_smu_value(4,0)
#select compliance of smu3
device.comp('VAR1',comp)
#compliance of smu2 and smu4 is 10V
device.const_comp(2,10)
device.const_comp(4,10)
# smu1 is common and compliance is automatically set to maximum
#define user functions
device.user_function('I','A','I3')
print(device.error())
device.user_function('V','V','V4-V2')
print(device.error())
device.user_function('R','OHM','DIFF(V,I)')
print(device.error())
#integration time
device.integration_time(time)
#define start-step-stop
device.start_value_sweep(start)
device.step_sweep(step)
device.stop_value_sweep(stop)
#start measurement
device.single_measurement()
while device.operation_completed() == False:
pass
voltage_values = device.return_data('V3')
current_values = device.return_data('I3')
voltage = device.return_data('V')
print(voltage_values)
print(current_values)
ctlm_voltage.append(voltage_values)
ctlm_current.append(current_values)
#plot results of the single measurement
#plt.plot(voltage_values,current_values,label=f"distance={distances[j]}")
plt.plot(voltage_values,current_values,label='ausgangvoltage')
plt.legend()
plt.show()
plt.figure()
plt.plot(voltage,current_values,label='Eingangsvoltage')
plt.legend()
plt.show()
#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)
file_name = field_name+"_CTLM_"+str(j+1)+".txt"
path =r"\\fileserver.cst.rwth-aachen.de\public\Datentransfer\Asonitis, Alexandros"
directory = os.path.join(path,file_name)
#export DataFrame to text file (keep header row and index column)
f=open(directory, 'a')
f.write('title\n')
df_string = df.to_string()
f.write(df_string)
#plot diagramm
#plt.legend()
#plt.show()
#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
del device
#tlm/ctlm final part
def tlm_final(innen=0,distances=(5,10,15,25,45),field_name ='M00',start=-50*10**(-3),stop=50*10**(-3),step=10**(-3),comp=10,time='MED'):
......
File moved
File moved
File moved
#prepare full measurement
def ctlm(field_name ='M00',start=-50*10**(-3),stop=50*10**(-3),step=10**(-3),comp=10,distances=(5,10,15,25,45),time='MED',innen=0):
#connect to the device
device = module.HP4155a('GPIB0::17::INSTR')
date = str(datetime.today().replace(microsecond=0))
#initilize figure
plt.figure()
plt.xlabel('Voltage(V)')
plt.ylabel('Current(A)')
plt.title("CTLM plot")
#lists for appending all data values
ctlm_voltage = []
ctlm_current = []
ctlm_resistance = []
#execute five measurements
for j in range(len(distances)):
#setup
device.reset()
device.inst.write(":PAGE:MEAS")
device.inst.write(":PAGE:CHAN:MODE SWEEP") #go to sweep page and prepare sweep measurement
#vsus and vmus are disabled
device.disable_vsu(1)
device.disable_vsu(2)
device.disable_vmu(1)
device.disable_vmu(2)
#smu1 is constant and common
device.smu_mode_meas(1,'COMM')
device.smu_function_sweep(1,'CONS')
#smu2 is constant and I
device.smu_mode_meas(2,'I')
device.smu_function_sweep(2,'CONS')
device.cons_smu_value(2,0)
#smu3 is var1 and I
device.smu_mode_meas(3,'I')
device.smu_function_sweep(3,'VAR1')
#smu4 is constant and I
device.smu_mode_meas(4,'I')
device.smu_function_sweep(4,'CONS')
device.cons_smu_value(4,0)
#select compliance of smu3
device.comp('VAR1',comp)
#compliance of smu2 and smu4 is 10V
device.const_comp(2,10)
device.const_comp(4,10)
# smu1 is common and compliance is automatically set to maximum
#define user functions
device.user_function('I','A','I3')
print(device.error())
device.user_function('V','V','V4-V2')
print(device.error())
device.user_function('R','OHM','DIFF(V,I)')
print(device.error())
#integration time
device.integration_time(time)
#define start-step-stop
device.start_value_sweep(start)
device.step_sweep(step)
device.stop_value_sweep(stop)
#start measurement
device.single_measurement()
while device.operation_completed() == False:
pass
voltage_values = device.return_data('V3')
current_values = device.return_data('I3')
voltage = device.return_data('V')
print(voltage_values)
print(current_values)
ctlm_voltage.append(voltage_values)
ctlm_current.append(current_values)
#plot results of the single measurement
#plt.plot(voltage_values,current_values,label=f"distance={distances[j]}")
plt.plot(voltage_values,current_values,label='ausgangvoltage')
plt.legend()
plt.show()
plt.figure()
plt.plot(voltage,current_values,label='Eingangsvoltage')
plt.legend()
plt.show()
#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)
file_name = field_name+"_CTLM_"+str(j+1)+".txt"
path =r"\\fileserver.cst.rwth-aachen.de\public\Datentransfer\Asonitis, Alexandros"
directory = os.path.join(path,file_name)
#export DataFrame to text file (keep header row and index column)
f=open(directory, 'a')
f.write('title\n')
df_string = df.to_string()
f.write(df_string)
#plot diagramm
#plt.legend()
#plt.show()
#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
del device
\ No newline at end of file
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment