diff --git a/hp4155/measurements.py b/hp4155/measurements.py index d4305671463c407ef47673611372f72a99259c4f..4863b041cd1bdd99c96a4ffddb49d5bd38dd49d2 100644 --- a/hp4155/measurements.py +++ b/hp4155/measurements.py @@ -143,135 +143,6 @@ def stress_sampling(V2_stress=10,V3_stress=3,stress_time=30,V2_sampling=10,V3_sa plt.show() 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'): diff --git a/hp4155/.ipynb_checkpoints/ctlm-checkpoint.ipynb b/hp4155/old/tlm-ctlm/.ipynb_checkpoints/ctlm-checkpoint.ipynb similarity index 100% rename from hp4155/.ipynb_checkpoints/ctlm-checkpoint.ipynb rename to hp4155/old/tlm-ctlm/.ipynb_checkpoints/ctlm-checkpoint.ipynb diff --git a/hp4155/.ipynb_checkpoints/ctlm_part2-checkpoint.ipynb b/hp4155/old/tlm-ctlm/.ipynb_checkpoints/ctlm_part2-checkpoint.ipynb similarity index 100% rename from hp4155/.ipynb_checkpoints/ctlm_part2-checkpoint.ipynb rename to hp4155/old/tlm-ctlm/.ipynb_checkpoints/ctlm_part2-checkpoint.ipynb diff --git a/hp4155/.ipynb_checkpoints/labview_ctlm-checkpoint.ipynb b/hp4155/old/tlm-ctlm/.ipynb_checkpoints/labview_ctlm-checkpoint.ipynb similarity index 100% rename from hp4155/.ipynb_checkpoints/labview_ctlm-checkpoint.ipynb rename to hp4155/old/tlm-ctlm/.ipynb_checkpoints/labview_ctlm-checkpoint.ipynb diff --git a/hp4155/old/tlm-ctlm/.ipynb_checkpoints/old_meas-checkpoint.py b/hp4155/old/tlm-ctlm/.ipynb_checkpoints/old_meas-checkpoint.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/hp4155/.ipynb_checkpoints/tlm_eval-checkpoint.ipynb b/hp4155/old/tlm-ctlm/.ipynb_checkpoints/tlm_eval-checkpoint.ipynb similarity index 100% rename from hp4155/.ipynb_checkpoints/tlm_eval-checkpoint.ipynb rename to hp4155/old/tlm-ctlm/.ipynb_checkpoints/tlm_eval-checkpoint.ipynb diff --git a/hp4155/ctlm.ipynb b/hp4155/old/tlm-ctlm/ctlm.ipynb similarity index 100% rename from hp4155/ctlm.ipynb rename to hp4155/old/tlm-ctlm/ctlm.ipynb diff --git a/hp4155/ctlm_part2.ipynb b/hp4155/old/tlm-ctlm/ctlm_part2.ipynb similarity index 100% rename from hp4155/ctlm_part2.ipynb rename to hp4155/old/tlm-ctlm/ctlm_part2.ipynb diff --git a/hp4155/labview_ctlm.ipynb b/hp4155/old/tlm-ctlm/labview_ctlm.ipynb similarity index 100% rename from hp4155/labview_ctlm.ipynb rename to hp4155/old/tlm-ctlm/labview_ctlm.ipynb diff --git a/hp4155/old/tlm-ctlm/old_meas.py b/hp4155/old/tlm-ctlm/old_meas.py new file mode 100644 index 0000000000000000000000000000000000000000..f253fa1a8acef3757998f229d3fba7614c5a2b34 --- /dev/null +++ b/hp4155/old/tlm-ctlm/old_meas.py @@ -0,0 +1,127 @@ +#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 diff --git a/hp4155/tlm_eval.ipynb b/hp4155/old/tlm-ctlm/tlm_eval.ipynb similarity index 100% rename from hp4155/tlm_eval.ipynb rename to hp4155/old/tlm-ctlm/tlm_eval.ipynb