-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmy_popW.py
144 lines (126 loc) · 6.54 KB
/
my_popW.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'popW.ui'
#
# Created by: PyQt5 UI code generator 5.15.9
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from qtpy import QtCore, QtGui, QtWidgets
import sys
class Ui_MainWindow(QtWidgets.QMainWindow):
def __init__ ( self, parent = None ):
QtWidgets.QMainWindow.__init__(self, parent)
#self.setWindowTitle("New Window Title")
self.setupUi(self)
self.retranslateUi(self)
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(368, 360)
MainWindow.setStyleSheet("background-color: rgb(38, 41, 48);")
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.textbox2 = QtWidgets.QLineEdit(self.centralwidget)
self.textbox2.setGeometry(QtCore.QRect(260, 180, 68, 25))
self.textbox2.setStyleSheet("color: rgb(255, 255, 255);\n"
"background-color: rgb(65, 72, 81);")
#self.doubleSpinBox_3P.setObjectName("doubleSpinBox_3P")
self.label_4P = QtWidgets.QLabel(self.centralwidget)
self.label_4P.setGeometry(QtCore.QRect(30, 230, 111, 25))
self.label_4P.setStyleSheet("color: rgb(255, 255, 255);\n"
"background-color: rgb(65, 72, 81);")
self.label_4P.setObjectName("label_4P")
self.label_2P = QtWidgets.QLabel(self.centralwidget)
self.label_2P.setGeometry(QtCore.QRect(30, 130, 101, 25))
self.label_2P.setStyleSheet("color: rgb(255, 255, 255);\n"
"background-color: rgb(65, 72, 81);")
self.label_2P.setObjectName("label_2P")
self.doubleSpinBoxP = QtWidgets.QDoubleSpinBox(self.centralwidget)
self.doubleSpinBoxP.setGeometry(QtCore.QRect(260, 80, 68, 25))
self.doubleSpinBoxP.setStyleSheet("color: rgb(255, 255, 255);\n"
"background-color: rgb(65, 72, 81);")
self.doubleSpinBoxP.setObjectName("doubleSpinBoxP")
self.pushButtonCom = QtWidgets.QPushButton(self.centralwidget)
self.pushButtonCom.setGeometry(QtCore.QRect(50, 300, 112, 34))
self.pushButtonCom.setStyleSheet("color: rgb(255, 255, 255);\n"
"background-color: rgb(65, 72, 81);\n"
"font: 75 8pt \"MS Shell Dlg 2\";")
self.pushButtonCom.setObjectName("pushButtonCom")
self.pushButtonCom2 = QtWidgets.QPushButton(self.centralwidget)
self.pushButtonCom2.setGeometry(QtCore.QRect(210, 300, 112, 34))
self.pushButtonCom2.setStyleSheet("color: rgb(255, 255, 255);\n"
"background-color: rgb(65, 72, 81);\n"
"font: 75 8pt \"MS Shell Dlg 2\";")
self.pushButtonCom2.setObjectName("pushButtonCom2")
self.label_3P = QtWidgets.QLabel(self.centralwidget)
self.label_3P.setGeometry(QtCore.QRect(30, 180, 201, 25))
self.label_3P.setStyleSheet("color: rgb(255, 255, 255);\n"
"background-color: rgb(65, 72, 81);")
self.label_3P.setObjectName("label_3P")
self.textbox1 = QtWidgets.QLineEdit(self.centralwidget)
self.textbox1.setGeometry(QtCore.QRect(260, 230, 68, 25))
self.textbox1.setStyleSheet("color: rgb(255, 255, 255);\n"
"background-color: rgb(65, 72, 81);")
self.labelP = QtWidgets.QLabel(self.centralwidget)
self.labelP.setGeometry(QtCore.QRect(30, 80, 110, 25))
self.labelP.setStyleSheet("color: rgb(255, 255, 255);\n"
"background-color: rgb(65, 72, 81);")
self.labelP.setObjectName("labelP")
self.doubleSpinBox_2P = QtWidgets.QDoubleSpinBox(self.centralwidget)
self.doubleSpinBox_2P.setGeometry(QtCore.QRect(260, 130, 68, 25))
self.doubleSpinBox_2P.setStyleSheet("color: rgb(255, 255, 255);\n"
"background-color: rgb(65, 72, 81);")
self.doubleSpinBox_2P.setObjectName("doubleSpinBox_2P")
self.doubleSpinBox0P = QtWidgets.QDoubleSpinBox(self.centralwidget)
self.doubleSpinBox0P.setGeometry(QtCore.QRect(260, 30, 68, 25))
self.doubleSpinBox0P.setStyleSheet("color: rgb(255, 255, 255);\n"
"background-color: rgb(65, 72, 81);")
self.doubleSpinBox0P.setObjectName("doubleSpinBox0P")
self.label0P = QtWidgets.QLabel(self.centralwidget)
self.label0P.setGeometry(QtCore.QRect(30, 30, 85, 25))
self.label0P.setStyleSheet("color: rgb(255, 255, 255);\n"
"background-color: rgb(65, 72, 81);")
self.label0P.setObjectName("label0P")
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 368, 31))
self.menubar.setObjectName("menubar")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
self.setVals()
self.setConnections()
def setVals(self):
#customizing widgets
#self.doubleSpinBox_3P.setSuffix(" km")
# Set val
self.doubleSpinBox0P.setValue(1.33) #Media refractive index
self.doubleSpinBoxP.setValue(1.51) #Oil RI
self.doubleSpinBox_2P.setValue(1.4) #NA
self.textbox2.setText("610") #Wavelength
self.textbox1.setText("150") #pixel size
def setConnections(self):
self.pushButtonCom.clicked.connect(self.su_resul)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "PSF FWHM Calc"))
self.label_4P.setText(_translate("MainWindow", "Pixel Size [nm]"))
self.label_2P.setText(_translate("MainWindow", "Objective NA"))
self.pushButtonCom.setText(_translate("MainWindow", "Compute"))
self.pushButtonCom2.setText(_translate("MainWindow", "Decorrelation"))
self.label_3P.setText(_translate("MainWindow", "Emission Wavelength [nm]"))
self.labelP.setText(_translate("MainWindow", "Oil (or Air) RI"))
self.label0P.setText(_translate("MainWindow", "Medium RI"))
def su_resul(self):
na = self.doubleSpinBox_2P.value()*(self.doubleSpinBox0P.value()/self.doubleSpinBoxP.value())
fwhm_res = (0.5746*(float(self.textbox2.text())))/(na*(float(self.textbox1.text())))
#print("success",fwhm_res)
return fwhm_res
#print(self.textbox1.text())
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
mywin = Ui_MainWindow()
mywin.show()
sys.exit(app.exec_())