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

evaluation sentech (file detection)

parent 676b7347
No related branches found
No related tags found
No related merge requests found
import ipywidgets as widgets
import matplotlib.pyplot as plt
import pandas as pd
import os
import tkinter as tk
from tkinter import filedialog
import tkinter.messagebox
def information_box(information):
#open dialog and hide the main window
root = tk.Tk()
root.withdraw()
root.lift() #show window above all other applications
root.attributes("-topmost", True)#window stays above all other applications
#display meaagebox
tkinter.messagebox.showinfo(message=information)
root.destroy()
def choose_folder():
root = tk.Tk()
root.withdraw()
root.lift() #show window above all other applications
root.attributes("-topmost", True)#window stays above all other applications
#choose nonemty folder
folder = tk.filedialog.askdirectory()
while folder == '':
folder = tk.filedialog.askdirectory()
root.destroy()
return folder
def change_state(widgets_list):
for widget in widgets_list:
widget.disabled = not widget.disabled
def get_device(file):
with open(file) as f:
lines = f.readlines()
if lines[1] == "System: SI ALD RWTH [ALD 007]\n":
return 'ALD'
elif lines[1] == "System: SI 500 RWTH Aachen [500-211]\n":
return 'ICP-CL'
elif lines[1] == "Anlage: SI 500 RWTH Aachen\n":
return 'ICP-FL'
else:
return "" #No device detected
def read_file(file):
device = get_device(file)
if device == 'ALD':
with open(file) as f:
lines = f.readlines()
start_time = lines[4]
df = pd.read_csv(files[0],sep ='\t',skiprows = 10,encoding = 'ANSI',index_col=False)
elif device == 'ICP-CL':
with open(file) as f:
lines = f.readlines()
start_time = lines[4]
df = pd.read_csv(file,sep ='\t',skiprows = 10,encoding = 'ANSI',index_col=False)
elif device =='ICP-FL':
with open(file) as f:
lines = f.readlines()
start_time = lines[3]
df = pd.read_csv(file,sep ='\t',skiprows = 9,encoding = 'ANSI',index_col=False)
else: #device = ""
start_time = None
df = None
return device,df,start_time
dir_button = widgets.Button(description = 'Choose Folder')
plot_button = widgets.Button(description = 'Plot')
next_file = widgets.Button(description = 'Next File')
previous_file = widgets.Button(description = 'Previous file')
current_file = widgets.Text(description = 'Current File',disabled = True)
x_axis = widgets.Dropdown(description = 'X-Axis',disabled = True)
y_axis = widgets.Dropdown(description = 'Y-Axis')
output = widgets.Output()
counter = 0
folder = None
files = []
df = None
start_time = None
device = None
buttons = widgets.HBox([dir_button,plot_button,previous_file,next_file])
config = widgets.HBox([x_axis,y_axis,current_file])
display(buttons)
display(config)
display(output)
all_widgets = [dir_button,plot_button,previous_file,next_file,y_axis]
def on_choose_folder_clicked(b):
global counter,folder,files,df,start_time,device
with output:
change_state(all_widgets)
folder = choose_folder()
os.chdir(folder) #change current working directory
files = os.listdir(os.getcwd()) #get the files from the chosen directory
# get all the valid files
valid_files = []
for file in files:
if file.endswith('.log') == True:
device = get_device(file)
if device != "":
valid_files.append(file)
files = valid_files.copy()
if len(files) == 0:
information_box("No Valid Files Detected! Please Choose a New Folder!")
else:
counter = 0
current_file.value = files[counter]
device,df,start_time = read_file(current_file.value)
options = list(df.columns.values)
x_axis.options = [options[0]] #only the first column
y_axis.options = options[1:] #the rest columns
x_axis.value = options[0]
y_axis.value = options[1]
change_state(all_widgets)
dir_button.on_click(on_choose_folder_clicked)
def on_previous_file_clicked(b):
global counter,folder,files,df,start_time,device
with output:
change_state(all_widgets)
if counter>0:
counter = counter -1
current_file.value = files[counter]
device,df,start_time = read_file(current_file.value)
options = list(df.columns.values)
x_axis.options = [options[0]] #only the first column
y_axis.options = options[1:] #the rest columns
x_axis.value = options[0]
y_axis.value = options[1]
else:
information_box("There is no previous file!")
change_state(all_widgets)
previous_file.on_click(on_previous_file_clicked)
def on_next_file_clicked(b):
global counter,folder,files,df,start_time,device
with output:
change_state(all_widgets)
if counter<len(files)-1:
counter = counter +1
current_file.value = files[counter]
device,df,start_time = read_file(current_file.value)
options = list(df.columns.values)
x_axis.options = [options[0]] #only the first column
y_axis.options = options[1:] #the rest columns
x_axis.value = options[0]
y_axis.value = options[1]
else:
information_box("There is no next file!")
change_state(all_widgets)
next_file.on_click(on_next_file_clicked)
\ No newline at end of file
%% Cell type:code id:e615178f-e424-4ae7-a128-5428c9b562d7 tags:
``` python
%run evaluation.py
```
%% Output
%% Cell type:code id:3773b35c-de0e-4515-b1a2-ed0e92d63c6e tags:
``` python
```
%% Cell type:code id:333ed23f-9444-4ff9-a353-034926fec379 tags:
``` python
import pandas as pd
import os
```
%% Cell type:code id:6d412ed1-cca1-40a3-a4ed-cc47b718047f tags:
``` python
os.chdir(r"\\FILESERVER\public\Datentransfer\Asonitis, Alexandros\Sentech\ICP-Fl")
files = os.listdir(os.getcwd())
```
%% Cell type:code id:df8512a5-e965-4f7d-a796-3bdab1c6ee3a tags:
``` python
#that is what we need for ICP FL
with open(files[0]) as f:
for i,line in enumerate(f):
if i == 1:
system = line
print(line)
if i==3:
start_time=line
df = pd.read_csv(files[0],sep ='\t',skiprows = 9,encoding = 'ANSI',index_col=False)
display(df)
```
%% Output
Anlage: SI 500 RWTH Aachen
%% Cell type:code id:b9a56914-ea70-4ac0-8dd9-3bf58bca921d tags:
``` python
# This is what we need for ICP-Cl
os.chdir(r"\\FILESERVER\public\Datentransfer\Asonitis, Alexandros\Sentech\ICP-Cl")
files = os.listdir(os.getcwd())
```
%% Cell type:code id:3e11ce4e tags:
``` python
with open(files[0]) as f:
for i,line in enumerate(f):
if i == 1:
system = line
print(line)
if i == 4:
start_time = line
```
%% Output
System: SI 500 RWTH Aachen [500-211]
%% Cell type:code id:154676ca tags:
``` python
for file in files:
df = pd.read_csv(file,sep ='\t',skiprows = 10,encoding = 'ANSI',index_col=False)
display(df)
```
%% Output
%% Cell type:code id:b98a2c4f tags:
``` python
# this is what we need for ALD
os.chdir(r"\\FILESERVER\public\Datentransfer\Asonitis, Alexandros\Sentech\ALD")
files = os.listdir(os.getcwd())
with open(files[0]) as f:
for i,line in enumerate(f):
if i == 1:
system = line
print(system)
if i == 4:
start_time = line
print(start_time)
```
%% Output
System: SI ALD RWTH [ALD 007]
Starting time: 12.03.2024 12:12:25
%% Cell type:code id:9b7a0ec6 tags:
``` python
df = pd.read_csv(files[0],sep ='\t',skiprows = 10,encoding = 'ANSI',index_col=False)
display(df)
```
%% Output
%% Cell type:code id:c56a10fc tags:
``` python
print(list(df.columns.values))
```
%% Output
['time (ms)', 'Baratron pr. (Pa)', 'MSK (Pa)', 'PS matchbox C load (%)', 'Heating pwr. (%)', 'Auxiliary input 1 (Bias)', 'Pwr. int. contr. 1 (Reaktordeckel) (%)', 'Pwr. int. contr. 2 (Reaktor) (%)', 'Pwr. int. contr. 3 (Reaktorboden) (%)', 'Pwr. int. contr. 8 (ALD Linie 2) (%)', 'Pwr. int. contr. 9 (Purge Linie 2) (%)', 'Pwr. int. contr. 14 (Tor Reaktor) (%)', 'Sequencer run', 'PS power (W)', 'PS power reflected (W)', 'Temperature (°C)', 'PS matchbox C tune (%)', 'Throttle position (%)', 'gas 1 (N2) (sccm)', 'gas 2 (O2) (sccm)', 'gas 3 (H2 4% in Ar) (sccm)', 'ALD2 gas (N2) (sccm)', 'Temp. int. contr. 1 (Reaktordeckel) (°C)', 'Temp. int. contr. 2 (Reaktor) (°C)', 'Temp. int. contr. 3 (Reaktorboden) (°C)', 'Temp. int. contr. 8 (ALD Linie 2) (°C)', 'Temp. int. contr. 9 (Purge Linie 2) (°C)', 'Temp. int. contr. 14 (Tor Reaktor) (°C)']
%% Cell type:code id:953f5b12-2cfb-48e2-ab44-ec4c7f27fec5 tags:
``` python
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment