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

Sentech Evaluation completed

parent 76db0f54
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,7 @@ import ipywidgets as widgets ...@@ -2,6 +2,7 @@ import ipywidgets as widgets
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import pandas as pd import pandas as pd
import os import os
import numpy as np
import tkinter as tk import tkinter as tk
from tkinter import filedialog from tkinter import filedialog
...@@ -82,9 +83,11 @@ dir_button = widgets.Button(description = 'Choose Folder') ...@@ -82,9 +83,11 @@ dir_button = widgets.Button(description = 'Choose Folder')
plot_button = widgets.Button(description = 'Plot') plot_button = widgets.Button(description = 'Plot')
next_file = widgets.Button(description = 'Next File') next_file = widgets.Button(description = 'Next File')
previous_file = widgets.Button(description = 'Previous file') previous_file = widgets.Button(description = 'Previous file')
current_file = widgets.Text(description = 'Current File',disabled = True) current_file = widgets.Text(description = 'Current File',disabled = True,value = 'No File Selected')
x_axis = widgets.Dropdown(description = 'X-Axis',disabled = True) x_axis = widgets.Dropdown(description = 'X-Axis',disabled = True)
y_axis = widgets.Dropdown(description = 'Y-Axis') y_axis = widgets.Dropdown(description = 'Y-Axis')
x_scale = widgets.Dropdown(description ='X-Scale',options = ['linear','log'],value = 'linear')
y_scale = widgets.Dropdown(description ='Y-Scale',options = ['linear','log'],value = 'linear')
output = widgets.Output() output = widgets.Output()
counter = 0 counter = 0
...@@ -96,16 +99,19 @@ device = None ...@@ -96,16 +99,19 @@ device = None
buttons = widgets.HBox([dir_button,plot_button,previous_file,next_file]) buttons = widgets.HBox([dir_button,plot_button,previous_file,next_file])
config = widgets.HBox([x_axis,y_axis,current_file]) config = widgets.HBox([x_axis,y_axis,current_file])
scale = widgets.HBox([x_scale,y_scale])
display(buttons) display(buttons)
display(config) display(config)
display(scale)
display(output) display(output)
all_widgets = [dir_button,plot_button,previous_file,next_file,y_axis] all_widgets = [dir_button,plot_button,previous_file,next_file,y_axis,x_scale,y_scale]
def on_choose_folder_clicked(b): def on_choose_folder_clicked(b):
global counter,folder,files,df,start_time,device global counter,folder,files,df,start_time,device
with output: with output:
change_state(all_widgets) change_state(all_widgets)
current_file.value = 'No File Selected'
folder = choose_folder() folder = choose_folder()
os.chdir(folder) #change current working directory os.chdir(folder) #change current working directory
files = os.listdir(os.getcwd()) #get the files from the chosen directory files = os.listdir(os.getcwd()) #get the files from the chosen directory
...@@ -173,6 +179,45 @@ def on_next_file_clicked(b): ...@@ -173,6 +179,45 @@ def on_next_file_clicked(b):
next_file.on_click(on_next_file_clicked) next_file.on_click(on_next_file_clicked)
def on_plot_clicked(b):
global counter,folder,files,df,start_time,device
with output:
change_state(all_widgets)
if current_file.value != 'No File Selected': #there is a file to plot
fig,ax = plt.subplots()
fig.suptitle(device +" "+ start_time)
if x_scale.value == 'log':
x = np.absolute(df[x_axis.value])
ax.set_xscale('log')
else:
x = df[x_axis.value]
ax.set_xscale('linear')
if y_scale.value == 'log':
y = np.absolute(df[y_axis.value])
ax.set_yscale('log')
else:
y = df[y_axis.value]
ax.set_yscale('linear')
ax.set_xlabel(x_axis.value)
ax.set_ylabel(y_axis.value)
ax.plot(x,y,color = 'b')
mng = plt.get_current_fig_manager()
mng.window.state('zoomed')
mng.window.attributes('-topmost', 1)
plt.show(block= True)
else:
information_box("No file to plot!")
change_state(all_widgets)
plot_button.on_click(on_plot_clicked)
......
%% Cell type:code id:e615178f-e424-4ae7-a128-5428c9b562d7 tags: %% Cell type:code id:e615178f-e424-4ae7-a128-5428c9b562d7 tags:
``` python ``` python
%matplotlib tk
%run evaluation.py %run evaluation.py
``` ```
%% Output %% Output
%% Cell type:code id:3773b35c-de0e-4515-b1a2-ed0e92d63c6e tags:
%% Cell type:code id:150e0b0a-18c8-4e4e-b3cc-41ba2c1a66ad tags:
``` python ``` python
``` ```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment