little changes
This commit is contained in:
parent
6846b95748
commit
8e36d3d3f3
Binary file not shown.
Before Width: | Height: | Size: 82 KiB |
62
Automation/ChartWindow.py
Normal file
62
Automation/ChartWindow.py
Normal file
@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Created on Mon Nov 14 21:44:23 2022
|
||||
|
||||
@author: anna
|
||||
"""
|
||||
import os
|
||||
import csv
|
||||
import serial
|
||||
import numpy as np
|
||||
import time
|
||||
from PyQt6 import QtCore
|
||||
from PyQt6.QtGui import QPixmap
|
||||
from PyQt6.QtWidgets import (QLabel,
|
||||
QLineEdit,
|
||||
QPushButton,
|
||||
QWidget,
|
||||
QTableWidget,
|
||||
QGridLayout,
|
||||
QTableWidgetItem,
|
||||
QHeaderView,
|
||||
QTextBrowser)
|
||||
from Analisis_data import Data
|
||||
from Abstract_window import AbstractWindow
|
||||
|
||||
class ChartWindow(AbstractWindow):
|
||||
def __init__(self, parent):
|
||||
super().__init__()
|
||||
|
||||
self.setWindowTitle('Обработка данных')
|
||||
self.parent = parent
|
||||
self.parent.chartname = 'Chart'
|
||||
self.parent.data = Data(data_filename=os.path.join(self.parent.folder, self.parent.dataname),
|
||||
saving=os.path.join(self.parent.folder, self.parent.chartname))
|
||||
self.parent.data.read_csv()
|
||||
# add B(I_M) #TODO
|
||||
self.parent.data.x = np.array(self.parent.data.data['I_0,mA'])*np.array(self.parent.data.data['I_M,mA'])
|
||||
self.parent.data.y = self.parent.data.data['U_34,mV']
|
||||
self.parent.data.ylabel = 'U_34,mV'
|
||||
self.parent.data.xlabel = 'I$_{обр} \cdot B$, мА$\cdot $ Tл'
|
||||
self.parent.data.make_grafic()
|
||||
|
||||
self.setWindowTitle('Основной эксперимент. Обработка данных')
|
||||
self.resize(1400, 800)
|
||||
|
||||
self.centralwidget = QWidget()
|
||||
self.setCentralWidget(self.centralwidget)
|
||||
|
||||
pixmap = QPixmap(os.path.join(
|
||||
self.parent.folder, self.parent.chartname))
|
||||
self.label = QLabel(self)
|
||||
self.label.setScaledContents(True)
|
||||
self.label.setFixedSize(0.7*self.width(), 0.9*self.height())
|
||||
self.label.setPixmap(pixmap)
|
||||
|
||||
self.text = QTextBrowser()
|
||||
self.text.setText('text')
|
||||
|
||||
self.hbox_layout = QGridLayout(self.centralwidget)
|
||||
self.hbox_layout.addWidget(self.label, 0, 0)
|
||||
self.hbox_layout.addWidget(self.text, 0, 1)
|
@ -113,3 +113,8 @@ class GraduationWindow(AbstractWindow):
|
||||
I_M = self.parent.ser.read(bytesToRead)
|
||||
self.volt += 5
|
||||
self.save_data([b, self.volt, I_M, t])
|
||||
|
||||
def closeEvent(self, event):
|
||||
pass
|
||||
# msg = 'VOLTage '+str(0)+'\n'
|
||||
# self.parent.ser.write(msg.encode('ascii'))
|
@ -14,8 +14,8 @@ from PyQt6.QtWidgets import (QApplication,
|
||||
QLabel
|
||||
)
|
||||
from Abstract_window import AbstractWindow
|
||||
from Main_experiment_window import (MainExperimentDataWindow,
|
||||
MainExperimentChartWindow)
|
||||
from Main_experiment_window import MainWindow
|
||||
from ChartWindow import ChartWindow
|
||||
from GraduationWindow import GraduationWindow
|
||||
from SignWindow import SignWindow
|
||||
from ResistanceWindow import ResistanceWindow
|
||||
@ -31,9 +31,7 @@ class Start:
|
||||
self.app = QApplication.instance()
|
||||
self.window = StartWindow(self)
|
||||
|
||||
# self.add_ser()
|
||||
# self.parent.amp_name= os.path.join('/dev', 'usbtmc1')
|
||||
# self.volt_name = os.path.join('/dev', 'usbtmc0')
|
||||
# self.add_equip()
|
||||
|
||||
self.draw()
|
||||
self.app.exec()
|
||||
@ -50,19 +48,19 @@ class Start:
|
||||
self.window = GraduationWindow(self)
|
||||
if self.number == 20:
|
||||
self.window.close()
|
||||
self.window = MainExperimentDataWindow(self)
|
||||
if self.number == 21:
|
||||
self.window.close()
|
||||
self.window = MainExperimentChartWindow(self)
|
||||
self.window = MainWindow(self)
|
||||
if self.number == 30:
|
||||
self.window.close()
|
||||
self.window = SignWindow(self)
|
||||
if self.number == 40:
|
||||
self.window.close()
|
||||
self.window = ResistanceWindow(self)
|
||||
if self.number == 50:
|
||||
self.window.close()
|
||||
self.window = ChartWindow(self)
|
||||
self.draw()
|
||||
|
||||
def add_ser(self):
|
||||
def add_equip(self):
|
||||
self.ser = serial.Serial(
|
||||
port='/dev/ttyUSB2',
|
||||
baudrate=9600,
|
||||
@ -72,6 +70,9 @@ class Start:
|
||||
msg = 'OUTput on\n'
|
||||
self.ser.write(msg.encode('ascii'))
|
||||
|
||||
self.parent.amp_name= os.path.join('/dev', 'usbtmc1')
|
||||
self.volt_name = os.path.join('/dev', 'usbtmc0')
|
||||
|
||||
|
||||
class StartWindow(AbstractWindow):
|
||||
def __init__(self, parent):
|
||||
@ -103,6 +104,11 @@ class StartWindow(AbstractWindow):
|
||||
if not self.parent.foldername:
|
||||
self.res.setEnabled(False)
|
||||
|
||||
self.chart = QPushButton('Обработка данных')
|
||||
self.chart.clicked.connect(self.chart_click)
|
||||
if not self.parent.foldername:
|
||||
self.chart.setEnabled(False)
|
||||
|
||||
self.main = QPushButton('Основной эксперимент')
|
||||
self.main.clicked.connect(self.main_click)
|
||||
if not self.parent.foldername:
|
||||
@ -117,11 +123,16 @@ class StartWindow(AbstractWindow):
|
||||
self.hbox_layout.addWidget(self.sign, 3, 0)
|
||||
self.hbox_layout.addWidget(self.res, 3, 1)
|
||||
self.hbox_layout.addWidget(self.main, 2, 1)
|
||||
self.hbox_layout.addWidget(self.chart, 4, 0, 1, -1)
|
||||
|
||||
def flow_click(self):
|
||||
self.parent.number = 10
|
||||
self.parent.change_number()
|
||||
|
||||
def chart_click(self):
|
||||
self.parent.number = 50
|
||||
self.parent.change_number()
|
||||
|
||||
def main_click(self):
|
||||
self.parent.number = 20
|
||||
self.parent.change_number()
|
||||
@ -145,6 +156,7 @@ class StartWindow(AbstractWindow):
|
||||
self.main.setEnabled(True)
|
||||
self.sign.setEnabled(True)
|
||||
self.res.setEnabled(True)
|
||||
self.chart.setEnabled(True)
|
||||
self.lineEdit.setReadOnly(True)
|
||||
|
||||
|
||||
|
@ -40,7 +40,7 @@ class ThreadData(QtCore.QThread):
|
||||
self.sleep(1)
|
||||
|
||||
|
||||
class MainExperimentDataWindow(AbstractWindow):
|
||||
class MainWindow(AbstractWindow):
|
||||
def __init__(self, parent):
|
||||
super().__init__()
|
||||
|
||||
@ -75,9 +75,9 @@ class MainExperimentDataWindow(AbstractWindow):
|
||||
self.new.clicked.connect(self.new_clicked)
|
||||
self.new.setEnabled(False)
|
||||
|
||||
self.chart = QPushButton('График')
|
||||
self.chart.setEnabled(False)
|
||||
self.chart.clicked.connect(self.chart_clicked)
|
||||
self.menu = QPushButton('Меню')
|
||||
self.menu.setEnabled(False)
|
||||
self.menu.clicked.connect(self.menu_clicked)
|
||||
|
||||
self.lineEdit = QLineEdit(placeholderText='Введите a, мм')
|
||||
self.lineEdit.returnPressed.connect(self.enter_a)
|
||||
@ -98,7 +98,7 @@ class MainExperimentDataWindow(AbstractWindow):
|
||||
self.grid_layout.addWidget(self.start, 1, 2)
|
||||
self.grid_layout.addWidget(self.stop, 1, 3)
|
||||
self.grid_layout.addWidget(self.new, 2, 2, 1, -1)
|
||||
self.grid_layout.addWidget(self.chart, 3, 2, 1, -1)
|
||||
self.grid_layout.addWidget(self.menu, 3, 2, 1, -1)
|
||||
|
||||
def enter_a(self):
|
||||
# TODO
|
||||
@ -119,7 +119,7 @@ class MainExperimentDataWindow(AbstractWindow):
|
||||
self.data_thread.running = False
|
||||
self.stop.setEnabled(False)
|
||||
self.start.setEnabled(True)
|
||||
self.chart.setEnabled(True)
|
||||
self.menu.setEnabled(True)
|
||||
|
||||
def new_clicked(self):
|
||||
self.number_iteration += 1
|
||||
@ -130,8 +130,8 @@ class MainExperimentDataWindow(AbstractWindow):
|
||||
self.new.setEnabled(True)
|
||||
self.stop.setEnabled(True)
|
||||
|
||||
def chart_clicked(self):
|
||||
self.parent.number = 21
|
||||
def menu_clicked(self):
|
||||
self.parent.number = 0
|
||||
self.parent.change_number()
|
||||
|
||||
def no_data(self):
|
||||
@ -199,41 +199,8 @@ class MainExperimentDataWindow(AbstractWindow):
|
||||
|
||||
def closeEvent(self, event):
|
||||
self.data_thread.running = False
|
||||
# msg = 'VOLTage '+str(0)+'\n'
|
||||
# self.parent.ser.write(msg.encode('ascii'))
|
||||
|
||||
|
||||
class MainExperimentChartWindow(AbstractWindow):
|
||||
def __init__(self, parent):
|
||||
super().__init__()
|
||||
|
||||
self.setWindowTitle('Основной эксперимент. Обработка данных')
|
||||
self.parent = parent
|
||||
self.parent.chartname = 'Chart'
|
||||
self.parent.data = Data(data_filename=os.path.join(self.parent.folder, self.parent.dataname),
|
||||
saving=os.path.join(self.parent.folder, self.parent.chartname))
|
||||
self.parent.data.read_csv()
|
||||
# add B(I_M) #TODO
|
||||
self.parent.data.x = np.array(self.parent.data.data['I_0,mA'])*np.array(self.parent.data.data['I_M,mA'])
|
||||
self.parent.data.y = self.parent.data.data['U_34,mV']
|
||||
self.parent.data.ylabel = 'U_34,mV'
|
||||
self.parent.data.xlabel = 'I$_{обр} \cdot B$, мА$\cdot $ Tл'
|
||||
self.parent.data.make_grafic()
|
||||
|
||||
self.setWindowTitle('Основной эксперимент. Обработка данных')
|
||||
self.resize(1400, 800)
|
||||
|
||||
self.centralwidget = QWidget()
|
||||
self.setCentralWidget(self.centralwidget)
|
||||
|
||||
pixmap = QPixmap(os.path.join(
|
||||
self.parent.folder, self.parent.chartname))
|
||||
self.label = QLabel(self)
|
||||
self.label.setScaledContents(True)
|
||||
self.label.setFixedSize(0.7*self.width(), 0.9*self.height())
|
||||
self.label.setPixmap(pixmap)
|
||||
|
||||
self.text = QTextBrowser()
|
||||
self.text.setText('text')
|
||||
|
||||
self.hbox_layout = QGridLayout(self.centralwidget)
|
||||
self.hbox_layout.addWidget(self.label, 0, 0)
|
||||
self.hbox_layout.addWidget(self.text, 0, 1)
|
||||
|
@ -76,3 +76,8 @@ class SignWindow(AbstractWindow):
|
||||
without_field = self.measure(0)
|
||||
with_field = self.measure(10)
|
||||
return without_field, with_field
|
||||
|
||||
def closeEvent(self, event):
|
||||
pass
|
||||
# msg = 'VOLTage '+str(0)+'\n'
|
||||
# self.parent.ser.write(msg.encode('ascii'))
|
Binary file not shown.
BIN
Automation/__pycache__/ChartWindow.cpython-39.pyc
Normal file
BIN
Automation/__pycache__/ChartWindow.cpython-39.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 150 KiB After Width: | Height: | Size: 147 KiB |
@ -1 +1,6 @@
|
||||
"U_34,mV","I_M,mA","U_0,mV","I_0,mA","E, mV",N,"t,ms"
|
||||
0.016666666666666666,0.016666666666666666,0.016666666666666666,0.00016666666666666666,0,1,1
|
||||
16.7,16.7,0.016666666666666666,0.16699999999999998,5.0,1,1002
|
||||
33.38333333333333,33.38333333333333,0.016666666666666666,0.3338333333333333,10.0,1,2003
|
||||
50.06666666666667,50.06666666666667,0.016666666666666666,0.5006666666666667,15.0,1,3004
|
||||
66.75,66.75,0.016666666666666666,0.6675,20.0,1,4005
|
||||
|
|
Loading…
Reference in New Issue
Block a user