Commit 36ada480 authored by glt005's avatar glt005
Browse files

Working on files controller, dma_1_graph, kappa_table, main_window, run, and...

Working on files controller, dma_1_graph, kappa_table, main_window, run, and peak_info. Creating peak_info widget on main window and working to create seperate tab for kappa table
parent 3e2d4233
......@@ -4,6 +4,7 @@ import PySide2.QtWidgets as Qw
import model.model as Model
import view.main_window as MainWindow
#import view.peak_info_widget as PeakInfo
class Controller:
def __init__(self,model: Model.Model,main_view: MainWindow.MainWindow):
......@@ -25,6 +26,8 @@ class Controller:
# Peak fitting
self.main_view.peak_fit_button.clicked.connect(self.peak_fit_button_clicked)
# Calculating Kappa
def menu_file_open_action(self):
# """
# Opens data files and begins the scan alignment process
......
......@@ -37,7 +37,8 @@ class RunOfScans:
header=0,
sep='\t',
index_col=0,
skiprows=skiprows)
skiprows=skiprows,
encoding = "ISO-8859-1")
ts = pd.to_datetime(self.df.apply(lambda col: col["Date"] + " " + col["Start Time"], axis=0))
self.df.loc["Date", :] = ts
self.df = self.df.drop(index=["Start Time"])
......
import sys
import matplotlib as mpl
......
......@@ -7,24 +7,29 @@ import sys
import matplotlib as mpl
import matplotlib.pyplot as plt
import PySide2.QtCore as Qc
import PySide2.QtWidgets as Qw
import pandas as pd
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg
from model.model import Model
mpl.use('Qt5Agg')
class Kappa_Data_Graph_Widget(FigureCanvasQTAgg):
def __init__(self, parent=None, width=5, height=4, dpi=100):
self.fig = plt.Figure(figsize=(width, height), dpi=dpi)
super(Kappa_Data_Graph_Widget, self).__init__(self.fig)
self.model = None
def set_model(self, model: Model):
self.model = model
self.update_plot()
def update_plot(self):
pass
\ No newline at end of file
class Kappa_Data_Table_Widget(Qw.QTableWidget):
def __init__(self, kappa_table):
super(self.__class__, self).__init__()
self.kappa_table = kappa_table
self.setColumnCount(6)
self.setHorizontalHeaderLabels(["Scan", "Dp2", "Gf", "?_gf", "?_Dpu", "K"])
self.setSelectionBehavior(Qw.QTableWidget.SelectRows)
self.verticalHeader().setVisible(False)
self.setColumnWidth(0, 40)
self.setColumnWidth(1, 60)
self.setColumnWidth(2, 40)
self.setColumnWidth(3, 70)
self.horizontalHeader().setStretchLastSection(True)
\ No newline at end of file
......@@ -19,7 +19,8 @@ from model.scan import MAX_PEAKS_TO_FIT
from view.helper_widgets import TitleHLine
from view.dma_1_graph import DMA_1_Graph_Widget
from view.scan_data_graph import Scan_Data_Graph_Widget
from view.kappa_graph import Kappa_Data_Graph_Widget
from view.kappa_table import Kappa_Data_Table_Widget
from view.peak_info import Peak_Info_Widget
class MainWindow(QMainWindow):
def __init__(self, model: model_pkg.Model):
......@@ -48,6 +49,13 @@ class MainWindow(QMainWindow):
# Create all of the graph widgets
self.create_view_graphs()
# # Initialize Tab for Kappa
# self.tabs = Qw.QTabWidget()
# self.tabs.setTabPosition(QTabWidget.North)
# self.kappa = Qw.QWidget()
# self.tabs.addTab(self.kappa, "Kappa")
# self.kappa.setLayout(self.create_kappa_widget())
# Set up the dock widget. Then, create the tabs that will be placed in the dock
dockWidget = QDockWidget("Setup Info", self)
self.tabs = self.create_tab_widget_for_docker()
......@@ -115,14 +123,54 @@ class MainWindow(QMainWindow):
self.next_scan_button = Qw.QPushButton("Next")
self.prev_scan_button = Qw.QPushButton("Prev")
# Create the buttons to use for kappa data
self.show_all_lines = Qw.QRadioButton("All Lines")
self.show_tight_lines = Qw.QRadioButton("Tight Lines")
self.show_tight_lines.setChecked(True)
# Create the check boxes for the different peaks
# Peak 1
self.peak1 = Qw.QCheckBox("Peak 1")
self.peak1.setChecked(True)
#self.peak1.stateChanged.connect(self.peak1)
# Peak 2
self.peak2 = Qw.QCheckBox("Peak 2")
self.peak2.setChecked(True)
#self.peak2.stateChanged.connect(self.peak2)
# Peak 3
self.peak3 = Qw.QCheckBox("Peak 3")
self.peak3.setChecked(True)
#self.peak3.stateChanged.connect(self.peak3)
# Peak 4
self.peak4 = Qw.QCheckBox("Peak 4")
self.peak4.setChecked(True)
#self.peak4.stateChanged.connect(self.peak4)
# Peak 5
self.peak5 = Qw.QCheckBox("Peak 5")
self.peak5.setChecked(True)
#self.peak5.stateChanged.connect(self.peak5)
# Kappa Data
# Dp
self.dp2 = Qw.QCheckBox("Dp2")
self.dp2.setChecked(True)
# self.peak1.stateChanged.connect(self.peak1)
# Dp alpha
self.dpu = Qw.QCheckBox("Dpu")
self.dpu.setChecked(True)
# self.peak2.stateChanged.connect(self.peak2)
self.gf = Qw.QCheckBox("Gf")
self.gf.setChecked(True)
self.alpha_gf = Qw.QCheckBox("Alpha Gf")
self.alpha_gf.setChecked(True)
self.show_all_points = Qw.QRadioButton("All Points")
self.show_average_points = Qw.QRadioButton("Average Points")
self.show_average_points.setChecked(True)
self.alpha_dpu = Qw.QCheckBox("Alpha Dpu")
self.alpha_dpu.setChecked(True)
self.k = Qw.QCheckBox("K")
self.k.setChecked(True)
# Curve fitting button
self.peak_fit_button = Qw.QPushButton("Fit Peaks")
......@@ -134,8 +182,10 @@ class MainWindow(QMainWindow):
self.scan_data_graph_widget = Scan_Data_Graph_Widget()
self.scan_data_graph_widget.set_model(self.model)
self.kappa_graph_widget = Kappa_Data_Graph_Widget()
self.kappa_graph_widget.set_model(self.model)
self.peak_info_widget = Peak_Info_Widget()
self.peak_info_widget.set_model(self.model)
self.kappa_table_widget = Kappa_Data_Table_Widget(self)
def create_tab_widget_for_docker(self):
......@@ -227,18 +277,25 @@ class MainWindow(QMainWindow):
form = QFormLayout(self)
form.addRow(QLabel(""))
form.addRow(TitleHLine("Kappa Lines"))
hbox_lines = Qw.QHBoxLayout()
hbox_lines.addWidget(self.show_all_lines)
hbox_lines.addWidget(self.show_tight_lines)
form.addRow(hbox_lines)
form.addRow(TitleHLine("Kappa Peaks"))
vbox_values = Qw.QVBoxLayout()
vbox_values.addWidget(self.peak1)
vbox_values.addWidget(self.peak2)
vbox_values.addWidget(self.peak3)
vbox_values.addWidget(self.peak4)
vbox_values.addWidget(self.peak5)
form.addRow(vbox_values)
form.addRow(QLabel(""))
form.addRow(TitleHLine("Kappa Values"))
hbox_values = Qw.QHBoxLayout()
hbox_values.addWidget(self.show_all_points)
hbox_values.addWidget(self.show_average_points)
form.addRow(hbox_values)
form.addRow(TitleHLine("Kappa Data"))
vbox_data = Qw.QVBoxLayout()
vbox_data.addWidget(self.dp2)
vbox_data.addWidget(self.dpu)
vbox_data.addWidget(self.gf)
vbox_data.addWidget(self.alpha_dpu)
vbox_data.addWidget(self.alpha_gf)
vbox_data.addWidget(self.k)
form.addRow(vbox_data)
vbox = Qw.QVBoxLayout()
#self.kappa_data_table = kappa.Kappa()
......@@ -247,15 +304,26 @@ class MainWindow(QMainWindow):
return form
def create_kappa_widget(self):
layout = Qw.QVBoxLayout()
layout.addWidget(self.kappa_table_widget)
frame = Qw.QFrame()
frame.setLayout(layout)
def create_center_widget(self):
splitter1 = Qw.QSplitter(Qt.Vertical)
splitter1 = Qw.QSplitter(Qt.Horizontal)
splitter1.addWidget(self.dma_1_graph_widget)
splitter1.addWidget(self.scan_data_graph_widget)
splitter1.addWidget(self.peak_info_widget)
splitter2 = Qw.QSplitter(Qt.Horizontal)
splitter2.addWidget((self.scan_data_graph_widget))
layout = Qw.QVBoxLayout()
layout.addWidget(splitter1)
layout.addWidget(splitter2)
# THe Qt way - a layout always needs a dummy widget
frame = Qw.QFrame()
......@@ -269,6 +337,10 @@ class MainWindow(QMainWindow):
self.file_open_action = QAction("&Open...",self)
self.file_menu.addAction(self.file_open_action)
self.setup_menu = self.menu.addMenu("&Setup")
self.setup_menu_action = QAction("Setup", self)
self.setup_menu.addAction(self.setup_menu_action)
self.help_menu = self.menu.addMenu("&Help")
self.help_menu_action = QAction("Help",self)
self.help_menu.addAction(self.help_menu_action)
......
import sys
import numpy as np
import PySide2.QtGui as Qg
import PySide2.QtCore as Qc
import PySide2.QtWidgets as Qw
from model.model import Model
from view.helper_widgets import TitleHLine
#from view.main_window import MainWindow
#from kappa_table import Kappa_Data_Table_Widget
class Peak_Info_Widget(Qw.QWidget):
def __init__(self, parent=None, width = 5, height = 4, dpi = 100):
super(self.__class__, self).__init__()
self.model = None
#self.window = window
self.create_controls()
def set_model(self, model: Model):
self.model = model
self.add_data()
def add_data(self) -> Qw.QFormLayout:
form = Qw.QFormLayout(self)
form.addRow(Qw.QLabel(""))
form.addRow(TitleHLine("Peak Info"))
vbox = Qw.QVBoxLayout()
vbox.addWidget(self.peak_info1)
vbox.addWidget(self.peak_info2)
vbox.addWidget(self.peak_info3)
vbox.addWidget(self.peak_info4)
vbox.addWidget(self.peak_info5)
vbox.addWidget(self.calc_kappa)
form.addRow(vbox)
return form
def create_controls(self):
# Peak 1
self.peak_info1 = Qw.QCheckBox("Peak 1")
self.peak_info1.setChecked(True)
# Peak 2
self.peak_info2 = Qw.QCheckBox("Peak 2")
self.peak_info2.setChecked(True)
# self.peak2.stateChanged.connect(self.peak2)
# Peak 3
self.peak_info3 = Qw.QCheckBox("Peak 3")
self.peak_info3.setChecked(True)
# self.peak3.stateChanged.connect(self.peak3)
# Peak 4
self.peak_info4 = Qw.QCheckBox("Peak 4")
self.peak_info4.setChecked(True)
# self.peak4.stateChanged.connect(self.peak4)
# Peak 5
self.peak_info5 = Qw.QCheckBox("Peak 5")
self.peak_info5.setChecked(True)
# Calculate Kappa
self.calc_kappa = Qw.QPushButton("Calculate Kappa")
def insertTab(self):
self.kappa_tab = Qw.QWidget()
self.kappa_tab.setObjectName("Kappa")
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment