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

txt csv files work!

parent 035e6ba2
No related branches found
No related tags found
No related merge requests found
...@@ -4,14 +4,15 @@ import module ...@@ -4,14 +4,15 @@ import module
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import pandas as pd import pandas as pd
from datetime import datetime from datetime import datetime
import os
def I_V_Measurement(start,stop,step): def I_V_Measurement(start,stop,step):
device = module.HP4155a('GPIB0::17::INSTR') device = module.HP4155a('GPIB0::17::INSTR')
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
device.reset()
#setup sweep #setup sweep
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
...@@ -60,8 +61,10 @@ def I_V_Measurement(start,stop,step): ...@@ -60,8 +61,10 @@ def I_V_Measurement(start,stop,step):
print(df) print(df)
#exporting the data frame in an excel file #exporting the data frame in an excel file
#file_name =f"_results_{date}.csv" file_name ="\results.csv"
#df.to_csv(file_name) path = "C:\Users\user\Desktop"
directory = os.path.join(cwd,file_name)
df.to_csv(directory)
del device del device
...@@ -217,8 +220,9 @@ def ctlm(field_name ='M00',start=-50*10**(-3),stop=50*10**(-3),step=10**(-3),com ...@@ -217,8 +220,9 @@ def ctlm(field_name ='M00',start=-50*10**(-3),stop=50*10**(-3),step=10**(-3),com
df = pd.DataFrame(data) df = pd.DataFrame(data)
print(df) print(df)
file_name = f"{field_name}_CTLM_{j+1}_{date}.txt" file_name = field_name+"_CTLM_"+str(j+1)+"_"+date+".txt"
path = f"\\FILESERVER\public\Datentransfer\Asonitis, Alexandros\_{file_name}" cwd = os.getcwd()
path = os.path.join(cwd,file_name)
#export DataFrame to text file (keep header row and index column) #export DataFrame to text file (keep header row and index column)
#f=open(path, 'a') #f=open(path, 'a')
#f.write('title\n') #f.write('title\n')
......
Source diff could not be displayed: it is too large. Options to address this: view the blob.
No preview for this file type
...@@ -4,6 +4,7 @@ import module ...@@ -4,6 +4,7 @@ import module
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import pandas as pd import pandas as pd
from datetime import datetime from datetime import datetime
import os
def I_V_Measurement(start,stop,step): def I_V_Measurement(start,stop,step):
...@@ -60,9 +61,10 @@ def I_V_Measurement(start,stop,step): ...@@ -60,9 +61,10 @@ def I_V_Measurement(start,stop,step):
print(df) print(df)
#exporting the data frame in an excel file #exporting the data frame in an excel file
file_name ="\_results_"+date+".csv" file_name ="results.csv"
path = "\\FILESERVER\public\Datentransfer\Asonitis, Alexandros" + file_name path = r"C:\Users\user\Desktop"
df.to_csv(path) directory = os.path.join(path,file_name)
df.to_csv(directory)
del device del device
...@@ -218,13 +220,14 @@ def ctlm(field_name ='M00',start=-50*10**(-3),stop=50*10**(-3),step=10**(-3),com ...@@ -218,13 +220,14 @@ def ctlm(field_name ='M00',start=-50*10**(-3),stop=50*10**(-3),step=10**(-3),com
df = pd.DataFrame(data) df = pd.DataFrame(data)
print(df) print(df)
file_name = field_name+"_CTLM_"+str(j+1)+"_"+date+".txt" file_name = field_name+"_CTLM_"+str(j+1)+".txt"
path = "\\FILESERVER\public\Datentransfer\Asonitis, Alexandros\ " + file_name path =r"C:\Users\user\Desktop"
directory = os.path.join(path,file_name)
#export DataFrame to text file (keep header row and index column) #export DataFrame to text file (keep header row and index column)
#f=open(path, 'a') f=open(directory, 'a')
#f.write('title\n') f.write('title\n')
#df_string = df.to_string() df_string = df.to_string()
#f.write(df_string) f.write(df_string)
#wait for confirmation from user after a measurement is done #wait for confirmation from user after a measurement is done
while True: while True:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment