project complete (ver 0.1); further updates needed
This commit is contained in:
parent
46b5845387
commit
ad51e65228
13
PycharmProjects/3.5.1 auto/fitting.py
Normal file
13
PycharmProjects/3.5.1 auto/fitting.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
from scipy.optimize import curve_fit
|
||||||
|
from numpy import tanh
|
||||||
|
|
||||||
|
|
||||||
|
# Обсчет значений на данный момент недоступен, но может быть вызван в другом файле
|
||||||
|
# с использованием функции fit()
|
||||||
|
def probe(x, I_0, k_0, A):
|
||||||
|
return I_0 * tanh(k_0 / I_0 * x) + A * x
|
||||||
|
|
||||||
|
|
||||||
|
def fit(x, y):
|
||||||
|
params = curve_fit(probe, x, y, [50, 10, 1])[0]
|
||||||
|
return params
|
12
PycharmProjects/3.5.1 auto/main.py
Normal file
12
PycharmProjects/3.5.1 auto/main.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import visual
|
||||||
|
import sys
|
||||||
|
from PySide6 import QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
app = QtWidgets.QApplication([])
|
||||||
|
|
||||||
|
widget = visual.TitleScreen()
|
||||||
|
widget.showFullScreen()
|
||||||
|
|
||||||
|
sys.exit(app.exec())
|
@ -4,6 +4,8 @@ import random
|
|||||||
from numpy import tanh
|
from numpy import tanh
|
||||||
|
|
||||||
|
|
||||||
|
# Значения part = 1, 2 соответствуют режимам считывания с первой и второй пары приборов соответственно
|
||||||
|
# (currently not available), режимы 3 и 4 являются тестовыми и генерируют значения самостоятельно
|
||||||
def get_point(part, num):
|
def get_point(part, num):
|
||||||
if part == 1:
|
if part == 1:
|
||||||
v1 = open('voltmeter1.txt')
|
v1 = open('voltmeter1.txt')
|
||||||
@ -42,16 +44,21 @@ def get_point(part, num):
|
|||||||
elif part == 4:
|
elif part == 4:
|
||||||
vol[3][num].append(random.random() * 50 - 25)
|
vol[3][num].append(random.random() * 50 - 25)
|
||||||
if experiment % 3 == 0:
|
if experiment % 3 == 0:
|
||||||
cur[3][num].append((83 * tanh(15.5 / 83 * vol[3][num][-1]) + 1.7 * vol[3][num][-1]) * (0.98 + random.random() / 25))
|
cur[3][num].append(
|
||||||
|
(83 * tanh(15.5 / 83 * vol[3][num][-1]) + 1.7 * vol[3][num][-1]) * (0.98 + random.random() / 25))
|
||||||
elif experiment % 3 == 1:
|
elif experiment % 3 == 1:
|
||||||
cur[3][num].append((44 * tanh(8.7 / 44 * vol[3][num][-1]) + 0.9 * vol[3][num][-1]) * (0.98 + random.random() / 25))
|
cur[3][num].append(
|
||||||
|
(44 * tanh(8.7 / 44 * vol[3][num][-1]) + 0.9 * vol[3][num][-1]) * (0.98 + random.random() / 25))
|
||||||
else:
|
else:
|
||||||
cur[3][num].append((22 * tanh(4.4 / 22 * vol[3][num][-1]) + 0.5 * vol[3][num][-1]) * (0.98 + random.random() / 25))
|
cur[3][num].append(
|
||||||
|
(22 * tanh(4.4 / 22 * vol[3][num][-1]) + 0.5 * vol[3][num][-1]) * (0.98 + random.random() / 25))
|
||||||
|
|
||||||
|
|
||||||
def update_plot(part, num):
|
def update_plot(part, num):
|
||||||
for i in range(10):
|
for i in range(10):
|
||||||
get_point(part, num)
|
get_point(part, num)
|
||||||
|
|
||||||
|
|
||||||
def saveplot(part):
|
def saveplot(part):
|
||||||
plt.figure(figsize=(8, 6))
|
plt.figure(figsize=(8, 6))
|
||||||
for i in range(len(vol[part - 1])):
|
for i in range(len(vol[part - 1])):
|
||||||
@ -62,6 +69,7 @@ def saveplot(part):
|
|||||||
plt.savefig('tmpplots/tmpplot' + str(part) + '.jpg', dpi=200)
|
plt.savefig('tmpplots/tmpplot' + str(part) + '.jpg', dpi=200)
|
||||||
plt.close()
|
plt.close()
|
||||||
|
|
||||||
|
|
||||||
def empty_plot(part):
|
def empty_plot(part):
|
||||||
vol[part - 1] = [[]]
|
vol[part - 1] = [[]]
|
||||||
cur[part - 1] = [[]]
|
cur[part - 1] = [[]]
|
||||||
@ -71,12 +79,14 @@ def empty_plot(part):
|
|||||||
plt.savefig('tmpplots/tmpplot' + str(part) + '.jpg', dpi=200)
|
plt.savefig('tmpplots/tmpplot' + str(part) + '.jpg', dpi=200)
|
||||||
plt.close()
|
plt.close()
|
||||||
|
|
||||||
|
|
||||||
def plus_plot(part):
|
def plus_plot(part):
|
||||||
global experiment
|
global experiment
|
||||||
vol[part - 1].append([])
|
vol[part - 1].append([])
|
||||||
cur[part - 1].append([])
|
cur[part - 1].append([])
|
||||||
experiment += 1
|
experiment += 1
|
||||||
|
|
||||||
|
|
||||||
def minus_plot(part):
|
def minus_plot(part):
|
||||||
vol[part - 1].pop()
|
vol[part - 1].pop()
|
||||||
cur[part - 1].pop()
|
cur[part - 1].pop()
|
||||||
@ -84,6 +94,7 @@ def minus_plot(part):
|
|||||||
vol[part - 1].append([])
|
vol[part - 1].append([])
|
||||||
cur[part - 1].append([])
|
cur[part - 1].append([])
|
||||||
|
|
||||||
|
|
||||||
vol = [[], [], [[]], [[]]]
|
vol = [[], [], [[]], [[]]]
|
||||||
cur = [[], [], [[]], [[]]]
|
cur = [[], [], [[]], [[]]]
|
||||||
experiment = 0
|
experiment = 0
|
BIN
PycharmProjects/3.5.1 auto/tmpplots/tmpplot1.jpg
Normal file
BIN
PycharmProjects/3.5.1 auto/tmpplots/tmpplot1.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 68 KiB |
BIN
PycharmProjects/3.5.1 auto/tmpplots/tmpplot3.jpg
Normal file
BIN
PycharmProjects/3.5.1 auto/tmpplots/tmpplot3.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 68 KiB |
BIN
PycharmProjects/3.5.1 auto/tmpplots/tmpplot4.jpg
Normal file
BIN
PycharmProjects/3.5.1 auto/tmpplots/tmpplot4.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 68 KiB |
@ -3,6 +3,7 @@ import plots
|
|||||||
import PIL
|
import PIL
|
||||||
|
|
||||||
|
|
||||||
|
# Значения парметра part при построении графиков установлены на тестовый режим
|
||||||
class TitleScreen(QtWidgets.QWidget):
|
class TitleScreen(QtWidgets.QWidget):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
Loading…
Reference in New Issue
Block a user