From 17effe5c1fd14c11884307ae25a795724ba7ef7e Mon Sep 17 00:00:00 2001 From: Harrison Edwards Date: Thu, 19 Oct 2017 18:19:37 -0400 Subject: [PATCH] added laser/attenuator functionality --- LCL.ui | 192 +++++++++++------- LCL_run.py | 13 +- LCL_ui.py | 76 ++++--- __pycache__/LCL_ui.cpython-36.pyc | Bin 4813 -> 5398 bytes .../image_movement_controller.cpython-36.pyc | Bin 0 -> 3984 bytes __pycache__/laser_controller.cpython-36.pyc | Bin 0 -> 3034 bytes __pycache__/stage_controller.cpython-36.pyc | Bin 7023 -> 7023 bytes image_processing.py | 23 +++ laser_controller.py | 76 +++++++ stage_controller.py | 5 +- 10 files changed, 280 insertions(+), 105 deletions(-) create mode 100644 __pycache__/image_movement_controller.cpython-36.pyc create mode 100644 __pycache__/laser_controller.cpython-36.pyc create mode 100644 image_processing.py create mode 100644 laser_controller.py diff --git a/LCL.ui b/LCL.ui index 0545ff7..fb00c86 100644 --- a/LCL.ui +++ b/LCL.ui @@ -6,8 +6,8 @@ 0 0 - 733 - 621 + 1000 + 689 @@ -17,17 +17,6 @@ LCL System - - - - 100 - 0 - 621 - 481 - - - - @@ -44,10 +33,10 @@ - 10 - 10 - 81 - 61 + 3 + 3 + 71 + 31 @@ -61,10 +50,10 @@ - 10 - 70 - 81 - 61 + 73 + 3 + 71 + 31 @@ -78,26 +67,26 @@ - 10 - 130 - 81 - 61 + 3 + 33 + 71 + 31 Qt::NoFocus - Miscellaneous + Misc. Screenshot - 310 - 510 - 161 + 4 + 83 + 131 41 @@ -105,10 +94,10 @@ - 490 - 490 - 231 - 121 + 7 + 330 + 131 + 191 @@ -117,9 +106,9 @@ - 40 + 38 60 - 90 + 51 23 @@ -133,9 +122,9 @@ - 80 + 59 40 - 75 + 51 23 @@ -149,9 +138,9 @@ - 40 + 37 20 - 90 + 51 23 @@ -165,9 +154,9 @@ - 10 + 13 40 - 75 + 51 23 @@ -181,8 +170,8 @@ - 7 - 90 + 25 + 84 75 23 @@ -197,8 +186,8 @@ - 87 - 90 + 25 + 104 75 23 @@ -213,8 +202,8 @@ - 160 - 60 + 29 + 150 62 22 @@ -241,8 +230,8 @@ - 170 - 40 + 29 + 130 47 13 @@ -255,8 +244,8 @@ - 310 - 490 + 6 + 63 71 16 @@ -268,9 +257,9 @@ - 310 - 560 - 161 + 3 + 123 + 131 23 @@ -285,8 +274,8 @@ 10 - 230 - 81 + 170 + 61 22 @@ -303,8 +292,8 @@ - 10 - 210 + 9 + 150 71 16 @@ -316,10 +305,10 @@ - 130 - 500 - 161 - 71 + 7 + 230 + 131 + 91 @@ -328,9 +317,9 @@ - 8 + 27 20 - 75 + 70 23 @@ -341,9 +330,9 @@ - 8 + 27 40 - 75 + 70 23 @@ -354,9 +343,9 @@ - 80 - 40 - 75 + 27 + 60 + 70 23 @@ -369,7 +358,7 @@ 10 - 270 + 200 75 23 @@ -378,6 +367,69 @@ Load Image + + + + 145 + 3 + 851 + 681 + + + + + + + + 10 + 520 + 120 + 151 + + + + Laser Controls + + + + + 10 + 20 + 101 + 23 + + + + Flash Lamp Auto + + + + + + 10 + 50 + 101 + 23 + + + + Flash Lamp Off + + + + + + 10 + 80 + 101 + 23 + + + + Fire Q-Switch + + + diff --git a/LCL_run.py b/LCL_run.py index 7b4a345..8110339 100644 --- a/LCL_run.py +++ b/LCL_run.py @@ -9,6 +9,7 @@ from PyQt5 import QtGui from utils import screen_shooter,now,comment from stage_controller import stage_controller from image_movement_controller import image_based_movement_controller +from laser_controller import laser_controller, attenuator_controller class ShowVideo(QtCore.QObject): camera_port = 1 @@ -24,8 +25,8 @@ class ShowVideo(QtCore.QObject): @QtCore.pyqtSlot() def startVideo(self): comment('video properties:') - self.camera.set(3,2048) - self.camera.set(4,1644) + self.camera.set(3,1024) + self.camera.set(4,822) self.camera.set(15,52.131) for i in range(19): comment('property {}, value: {}'.format(i, @@ -34,7 +35,7 @@ class ShowVideo(QtCore.QObject): ret, image = self.camera.read() image = cv2.cvtColor(image,cv2.COLOR_RGB2BGR) self.screenshot_signal.emit(image) - radius = 100 + radius = 50 y = int(image.shape[0]/2) x = int(image.shape[1]/2) cv2.line(image,(x-radius,y),(x+radius,y),(255,0,0),2) @@ -116,6 +117,10 @@ class main_window(QMainWindow): self.ui.load_image_pushbutton.clicked.connect(image_move_controller.show_file_dialog) + self.ui.start_flashlamp_pushbutton.clicked.connect(laser.fire_auto) + self.ui.stop_flashlamp_pushbutton.clicked.connect(laser.simmer) + self.ui.fire_qswitch_pushbutton.clicked.connect(laser.fire_qswitch) + self.show() comment('finished init') @@ -145,6 +150,8 @@ if __name__ == '__main__': app = QApplication(sys.argv) stage = stage_controller() image_move_controller = image_based_movement_controller() + attenuator = attenuator_controller() + laser = laser_controller() window = main_window() window.vid.startVideo() comment('exit with code: ' + str(app.exec_())) diff --git a/LCL_ui.py b/LCL_ui.py index 19c0514..23daf0a 100644 --- a/LCL_ui.py +++ b/LCL_ui.py @@ -11,63 +11,57 @@ from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") - MainWindow.resize(733, 621) + MainWindow.resize(1000, 689) MainWindow.setFocusPolicy(QtCore.Qt.StrongFocus) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") - self.verticalLayoutWidget = QtWidgets.QWidget(self.centralwidget) - self.verticalLayoutWidget.setGeometry(QtCore.QRect(100, 0, 621, 481)) - self.verticalLayoutWidget.setObjectName("verticalLayoutWidget") - self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget) - self.verticalLayout.setContentsMargins(0, 0, 0, 0) - self.verticalLayout.setObjectName("verticalLayout") self.pushButton = QtWidgets.QPushButton(self.centralwidget) self.pushButton.setGeometry(QtCore.QRect(-90, 200, 75, 23)) self.pushButton.setObjectName("pushButton") self.target_screenshot_button = QtWidgets.QPushButton(self.centralwidget) - self.target_screenshot_button.setGeometry(QtCore.QRect(10, 10, 81, 61)) + self.target_screenshot_button.setGeometry(QtCore.QRect(3, 3, 71, 31)) self.target_screenshot_button.setFocusPolicy(QtCore.Qt.NoFocus) self.target_screenshot_button.setObjectName("target_screenshot_button") self.non_target_screenshot_button = QtWidgets.QPushButton(self.centralwidget) - self.non_target_screenshot_button.setGeometry(QtCore.QRect(10, 70, 81, 61)) + self.non_target_screenshot_button.setGeometry(QtCore.QRect(73, 3, 71, 31)) self.non_target_screenshot_button.setFocusPolicy(QtCore.Qt.NoFocus) self.non_target_screenshot_button.setObjectName("non_target_screenshot_button") self.misc_screenshot_button = QtWidgets.QPushButton(self.centralwidget) - self.misc_screenshot_button.setGeometry(QtCore.QRect(10, 130, 81, 61)) + self.misc_screenshot_button.setGeometry(QtCore.QRect(3, 33, 71, 31)) self.misc_screenshot_button.setFocusPolicy(QtCore.Qt.NoFocus) self.misc_screenshot_button.setObjectName("misc_screenshot_button") self.comment_box = QtWidgets.QTextEdit(self.centralwidget) - self.comment_box.setGeometry(QtCore.QRect(310, 510, 161, 41)) + self.comment_box.setGeometry(QtCore.QRect(4, 83, 131, 41)) self.comment_box.setObjectName("comment_box") self.groupBox = QtWidgets.QGroupBox(self.centralwidget) - self.groupBox.setGeometry(QtCore.QRect(490, 490, 231, 121)) + self.groupBox.setGeometry(QtCore.QRect(7, 330, 131, 191)) self.groupBox.setObjectName("groupBox") self.down_button = QtWidgets.QPushButton(self.groupBox) - self.down_button.setGeometry(QtCore.QRect(40, 60, 90, 23)) + self.down_button.setGeometry(QtCore.QRect(38, 60, 51, 23)) self.down_button.setFocusPolicy(QtCore.Qt.NoFocus) self.down_button.setObjectName("down_button") self.right_button = QtWidgets.QPushButton(self.groupBox) - self.right_button.setGeometry(QtCore.QRect(80, 40, 75, 23)) + self.right_button.setGeometry(QtCore.QRect(59, 40, 51, 23)) self.right_button.setFocusPolicy(QtCore.Qt.NoFocus) self.right_button.setObjectName("right_button") self.up_button = QtWidgets.QPushButton(self.groupBox) - self.up_button.setGeometry(QtCore.QRect(40, 20, 90, 23)) + self.up_button.setGeometry(QtCore.QRect(37, 20, 51, 23)) self.up_button.setFocusPolicy(QtCore.Qt.NoFocus) self.up_button.setObjectName("up_button") self.left_button = QtWidgets.QPushButton(self.groupBox) - self.left_button.setGeometry(QtCore.QRect(10, 40, 75, 23)) + self.left_button.setGeometry(QtCore.QRect(13, 40, 51, 23)) self.left_button.setFocusPolicy(QtCore.Qt.NoFocus) self.left_button.setObjectName("left_button") self.home_stage_button = QtWidgets.QPushButton(self.groupBox) - self.home_stage_button.setGeometry(QtCore.QRect(7, 90, 75, 23)) + self.home_stage_button.setGeometry(QtCore.QRect(25, 84, 75, 23)) self.home_stage_button.setFocusPolicy(QtCore.Qt.NoFocus) self.home_stage_button.setObjectName("home_stage_button") self.get_position_button = QtWidgets.QPushButton(self.groupBox) - self.get_position_button.setGeometry(QtCore.QRect(87, 90, 75, 23)) + self.get_position_button.setGeometry(QtCore.QRect(25, 104, 75, 23)) self.get_position_button.setFocusPolicy(QtCore.Qt.NoFocus) self.get_position_button.setObjectName("get_position_button") self.step_size_doublespin_box = QtWidgets.QDoubleSpinBox(self.groupBox) - self.step_size_doublespin_box.setGeometry(QtCore.QRect(160, 60, 62, 22)) + self.step_size_doublespin_box.setGeometry(QtCore.QRect(29, 150, 62, 22)) self.step_size_doublespin_box.setFocusPolicy(QtCore.Qt.ClickFocus) self.step_size_doublespin_box.setDecimals(0) self.step_size_doublespin_box.setMinimum(50.0) @@ -76,39 +70,57 @@ class Ui_MainWindow(object): self.step_size_doublespin_box.setProperty("value", 1000.0) self.step_size_doublespin_box.setObjectName("step_size_doublespin_box") self.step_size_label = QtWidgets.QLabel(self.groupBox) - self.step_size_label.setGeometry(QtCore.QRect(170, 40, 47, 13)) + self.step_size_label.setGeometry(QtCore.QRect(29, 130, 47, 13)) self.step_size_label.setObjectName("step_size_label") self.comment_box_label = QtWidgets.QLabel(self.centralwidget) - self.comment_box_label.setGeometry(QtCore.QRect(310, 490, 71, 16)) + self.comment_box_label.setGeometry(QtCore.QRect(6, 63, 71, 16)) self.comment_box_label.setObjectName("comment_box_label") self.user_comment_button = QtWidgets.QPushButton(self.centralwidget) - self.user_comment_button.setGeometry(QtCore.QRect(310, 560, 161, 23)) + self.user_comment_button.setGeometry(QtCore.QRect(3, 123, 131, 23)) self.user_comment_button.setFocusPolicy(QtCore.Qt.NoFocus) self.user_comment_button.setObjectName("user_comment_button") self.magnification_combobox = QtWidgets.QComboBox(self.centralwidget) - self.magnification_combobox.setGeometry(QtCore.QRect(10, 230, 81, 22)) + self.magnification_combobox.setGeometry(QtCore.QRect(10, 170, 61, 22)) self.magnification_combobox.setFocusPolicy(QtCore.Qt.NoFocus) self.magnification_combobox.setEditable(True) self.magnification_combobox.setCurrentText("") self.magnification_combobox.setObjectName("magnification_combobox") self.magnification_label = QtWidgets.QLabel(self.centralwidget) - self.magnification_label.setGeometry(QtCore.QRect(10, 210, 71, 16)) + self.magnification_label.setGeometry(QtCore.QRect(9, 150, 71, 16)) self.magnification_label.setObjectName("magnification_label") self.calibration_groupbox = QtWidgets.QGroupBox(self.centralwidget) - self.calibration_groupbox.setGeometry(QtCore.QRect(130, 500, 161, 71)) + self.calibration_groupbox.setGeometry(QtCore.QRect(7, 230, 131, 91)) self.calibration_groupbox.setObjectName("calibration_groupbox") self.upper_left_calibration_button = QtWidgets.QPushButton(self.calibration_groupbox) - self.upper_left_calibration_button.setGeometry(QtCore.QRect(8, 20, 75, 23)) + self.upper_left_calibration_button.setGeometry(QtCore.QRect(27, 20, 70, 23)) self.upper_left_calibration_button.setObjectName("upper_left_calibration_button") self.bottom_left_calibration_button = QtWidgets.QPushButton(self.calibration_groupbox) - self.bottom_left_calibration_button.setGeometry(QtCore.QRect(8, 40, 75, 23)) + self.bottom_left_calibration_button.setGeometry(QtCore.QRect(27, 40, 70, 23)) self.bottom_left_calibration_button.setObjectName("bottom_left_calibration_button") self.bottom_right_calibration_button = QtWidgets.QPushButton(self.calibration_groupbox) - self.bottom_right_calibration_button.setGeometry(QtCore.QRect(80, 40, 75, 23)) + self.bottom_right_calibration_button.setGeometry(QtCore.QRect(27, 60, 70, 23)) self.bottom_right_calibration_button.setObjectName("bottom_right_calibration_button") self.load_image_pushbutton = QtWidgets.QPushButton(self.centralwidget) - self.load_image_pushbutton.setGeometry(QtCore.QRect(10, 270, 75, 23)) + self.load_image_pushbutton.setGeometry(QtCore.QRect(10, 200, 75, 23)) self.load_image_pushbutton.setObjectName("load_image_pushbutton") + self.verticalLayoutWidget = QtWidgets.QWidget(self.centralwidget) + self.verticalLayoutWidget.setGeometry(QtCore.QRect(145, 3, 851, 681)) + self.verticalLayoutWidget.setObjectName("verticalLayoutWidget") + self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget) + self.verticalLayout.setContentsMargins(0, 0, 0, 0) + self.verticalLayout.setObjectName("verticalLayout") + self.laser_controls_groupbox = QtWidgets.QGroupBox(self.centralwidget) + self.laser_controls_groupbox.setGeometry(QtCore.QRect(10, 520, 120, 151)) + self.laser_controls_groupbox.setObjectName("laser_controls_groupbox") + self.start_flashlamp_pushbutton = QtWidgets.QPushButton(self.laser_controls_groupbox) + self.start_flashlamp_pushbutton.setGeometry(QtCore.QRect(10, 20, 101, 23)) + self.start_flashlamp_pushbutton.setObjectName("start_flashlamp_pushbutton") + self.stop_flashlamp_pushbutton = QtWidgets.QPushButton(self.laser_controls_groupbox) + self.stop_flashlamp_pushbutton.setGeometry(QtCore.QRect(10, 50, 101, 23)) + self.stop_flashlamp_pushbutton.setObjectName("stop_flashlamp_pushbutton") + self.fire_qswitch_pushbutton = QtWidgets.QPushButton(self.laser_controls_groupbox) + self.fire_qswitch_pushbutton.setGeometry(QtCore.QRect(10, 80, 101, 23)) + self.fire_qswitch_pushbutton.setObjectName("fire_qswitch_pushbutton") MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) @@ -122,7 +134,7 @@ class Ui_MainWindow(object): " Screenshot")) self.non_target_screenshot_button.setText(_translate("MainWindow", "Non-Target \n" " Screenshot")) - self.misc_screenshot_button.setText(_translate("MainWindow", "Miscellaneous \n" + self.misc_screenshot_button.setText(_translate("MainWindow", "Misc. \n" " Screenshot")) self.groupBox.setTitle(_translate("MainWindow", "Stage Controls")) self.down_button.setText(_translate("MainWindow", "Down")) @@ -140,6 +152,10 @@ class Ui_MainWindow(object): self.bottom_left_calibration_button.setText(_translate("MainWindow", "Bottom Left")) self.bottom_right_calibration_button.setText(_translate("MainWindow", "Bottom Right")) self.load_image_pushbutton.setText(_translate("MainWindow", "Load Image")) + self.laser_controls_groupbox.setTitle(_translate("MainWindow", "Laser Controls")) + self.start_flashlamp_pushbutton.setText(_translate("MainWindow", "Flash Lamp Auto")) + self.stop_flashlamp_pushbutton.setText(_translate("MainWindow", "Flash Lamp Off")) + self.fire_qswitch_pushbutton.setText(_translate("MainWindow", "Fire Q-Switch")) if __name__ == "__main__": diff --git a/__pycache__/LCL_ui.cpython-36.pyc b/__pycache__/LCL_ui.cpython-36.pyc index ed188b789afd24b9640b213e026212263c7f3b04..c979be00cff25ccb4b8f5b94a3227aa05b8cd3b0 100644 GIT binary patch literal 5398 zcma)ATT>g!6&~G%E+E83+-%Eh!-8$_1>e?JY`kXe1&l1PcW0d)3-th_l{DI(kui!> zsf2yVTPiQfKSW~dT3W0ju$fSy1(xv%LdGXk47)0JK`wI2v*W~$P+ui-mZ$(V^s|Gq{j zixjn)=mFZ*Wdf9P6P5nxJBnu!k24X|w0D6D#!Wp!2~sSy9~9-F z8>)mW5vp;cmDoG@ywi;MJFOB2BP{VAdKWbbloFLBSSe<(D2uW9zVH&b#xO@h>5!2| zOr%);;p`EG z5h#pEg~_fyjC3iCKw;{L!YC9*rNXCdx?_)xb}5WPVdjX!7!<~o!nqEGu`Y!%D4drH zNJCbpDGN-_pl8gkq ziyeA+mZ!RAX$lJWq{64*`E5?4G%XeGvjz5`ZI-6H6s9XP>>()#&N;TI${Kqlm1+FG z@_CfbOXbfo|LvnWkG?#XjKlMG0gMZhkz-33%@=C?7r=NT88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nvDZ_g)sCY%a&C;Glw zmepAGw@U=Wr9&XUUEbofc}6`{5C1ZZsuX!6KZK6LsxslrMOyGRqbzY{iE2wiSz_9f zRF=55;EP7`B(x>1e3IIdQI-*H$tp`qTSk>7tt~la$!JSnS+d$PrYxh{GOjE+Z7C>A zUR#RFGNvsPY82zzGO2tD+A^gqMQxc@mI-Z{QI^TTB5VEBrrgop6t-+>`w(RS$M!U@ zbPLa9{VkEdh1VjV!N~J;<$V0|Fpt%Q#({sO0wVdLs>wAhm3lV!C`Jt6-rO3DwJnsdN=b( zO@cpYw~+;9wem-FHu0$-1Rw6tY_Gv(ZZ_%c%S1&4@MP)=#8=c#mA-?^U4k$|Nu-?d(0Ew>k@nud?p*(Y?@Oqg<(Qwe ztQJzIW%((~YC5dbAU$JQzvxsOL5rZ5Kp8?$Sd?3Zj4cK&jmxFPkqjkmK^7uz;-4dy zwOJnbV_Sz6@0MH^K{+O>M+pqjcwT*gIIep`mQ|5;| zwu}yWf8TlSNBM#6`7wULYt~Q2>L>37L%dIA-K96bVmSXRBZ07yX_KKia(y!NKMCl~ AuK)l5 diff --git a/__pycache__/image_movement_controller.cpython-36.pyc b/__pycache__/image_movement_controller.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c4eb4ffa7806a0595a81f6f61378f8c7d478aa3b GIT binary patch literal 3984 zcmb_fTW=gm74GWW^xR^{@e(Vr%fJhn1-y%w<(3snNH!s0Y!3@s(Xwbwrpk8Dc2Cb% zmE+9FmXIdWz5xG&-@u>Xxt@@CK=}*%#CNKDF7`SK67;C5tLu8sSLb}^%m?ju?4i9+v(&3>9XI{L4?;4Nr9og?&_^$H? zz8f<)-sJ2Pr`vo5nVh|DXj;7o<8hV_`Z_H}rq=s3<;Oy!`{`(Wsvo8OtT;CH-flV) zAM;e3X76#DiK;*B?e?FEtm~Sf_jF*_AEYnx{X%gRHMqlKjp2^1;KO9sXVksSZyBKkFavkHjOHJ{O0(4|fw)9O<*Z z6o;jxdGTE2Vx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>$t1m^JGlTr61xVhpn^e`)^X>>T*epe0|K{ z!U)Cuimym7+n(nto}~>*0+bS$34nZ?I&9pqm37G{=%Z35Aud?qy*EjE1(Zt`Ojf*5 zypqQr`8w3*mLn=#+a+1(?wtPuv#X2$ucGYi{|}<<>~))0*wfUKgoDD9k}!XX-Ah7^ zETNKl(M8CoRQ-yopliPM6qrX1>o^0@;8FWlQhzO%Xn&{jEht?7@g+$heA|h z)+np_aC`B8P7=b>qlzq4QW{`GkxlaB=6pK-1xiZ6%CtYQ-BxJXq+UumESFezu@YP- dw23|{6U3jBc__+u*5TeA_{FBXetZ4)e*nT@x#a)= literal 0 HcmV?d00001 diff --git a/__pycache__/laser_controller.cpython-36.pyc b/__pycache__/laser_controller.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c2dc83175286c5a7202a9ae2334d4ad3077afe02 GIT binary patch literal 3034 zcmcImTaVjB6rS-dj+1OJQ0RrW5iKBdSwN^zl?uAr0;*`UEiIr%D_JHp={h)eI(ArX zx+@{2uRQQG_$NH_>{p)p7y86^#@QsBtlAX2neRP=G}iKYQR$@pzD#nk&b@p+RkA}{`;P(U z21a%pM6xy)3~F&X=>85G$Cg;+Qy&*%K$A z!pY)z9A;7loixc+8pl#~IE2t+VK^A;7}*aXg6~1*o{_U2-!nmtUA}7wa~B%?X6>@T z++{tpXOXFzv!|Rh;Q)u;a{(H`z@UTEYFq0YcRq`LeT%V2kb~#1FMXq^5R8-Cg_c)`N#ZYoqm5;oL75O>7okHy&nNw~_(=T+{r9zWF80^hdaJiSecBwg$ZvI)=%M3D6;<#re4ML{ObC(&F^u0wz(z6 zcDT8b$eSwqMQ+|+za3<0H{TAG++2inb+A*oK@cTT9t4OxmeFO5TlhKLD}RQ^T|PRq z^xysebtnSpp+F_SXrEjKBY2PP@-c^3;2ZEp4;~qFVVz-PtWP{)VcjOo=TIM6Pxcz# z=v*cf5hahB6oX+Rnt9sPid=iL_nbErg~P}m=G_mj`cC0=Q`HZ1MG6&mHi)BK)il2i z7Xen8bW$OGQ=Ony9oV?ESee`&WVwPcjc7?u(YZ#HWkZQ5)GE+YM$j|BbDEDXECF-i z_yKeXA&t)4U=W2G9gPC-8Dj>VOkf5)Cg>Q5K%+IfsAM)slT0>|dlFt1&8|xOQzU#_ zUBHFfR<%MLA)ro!Ol(zefTsW}?^(34PA~_P%g^FyM!`S^dVGbC&M%obe}0;i&s7u4mc{&KXkg|1Y zPVBj5vD0%$7QOaj(baCGWDpMXlmcPj;Im7Tr^k*e*x0!HV##%V<>PES$~#;BobY8I z&!3z|G5Ka1#Z)XxANM%r`80nKv(}HzCwso39bQJFQD&X3>)E37kK?NM=hRuoVpf6kZVYQ!$K*uLr^7VHlS?>NQ+f=0%e@3NJ;DR;c7my+eeg&S^sSD9UfO z-(E60;TmqkwOz+G%b(uuU}O3aDmO5)%OEfBfyf89I2Go(Oom~ezP!QR#I^sr!8yzA z>`KJGJbRCnjpSaX7Wi|c!dZR#yLba znB<6$F*KNq&1H1qP#jkO-|kZReC+{Rh&O5;(qLu^;Yh)~gIz`kb6H@|kg?QY6xB?1 z4rIRGs`Ip}gK8F8RH(0G%(swBGl_HGI;;PAAGy3={}=kmOgs!eVlz<}4>7KZwKX#C zK>K)ecK^J2^F5^HJBq52dY8z1L>AI_2ICA%Di|MPXe^PXHP=?OM&+R&MhQv+^BX#j z3p*M1@wH*hLfQAWo3o2N)vFfuNkd{(lYaouEBscgo%lQ&9j NXBX!a5kauVb=jHwJ_6lfN*jL)qe+m6+8985t*giL7Vr zoBT^;1LKs*t3@|5&e$9)rohO^vbj!Nl#y}X<|z^ujEqYrpOq|UTszrSDw}c6 M*~R!oIT+a(0T#?6y8r+H diff --git a/image_processing.py b/image_processing.py new file mode 100644 index 0000000..c2ef6df --- /dev/null +++ b/image_processing.py @@ -0,0 +1,23 @@ +import cv2 +import matplotlib.pyplot as plt +import numpy as np + +image_loc = r'C:\Users\hedwa\Desktop\experiment_18_10_2017___16.12.30.872461\miscellaneous___18_10_2017___16.18.25.934712.jpg' + +image = cv2.imread(image_loc) +figure, axes = plt.subplots(1,2) +image = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY) +axes[0].set_yticks([]) +axes[0].set_xticks([]) +axes[0].imshow(image) +image = cv2.medianBlur(image,31) +kernel = np.ones((20,20),np.uint8) +image = cv2.dilate(image,kernel,iterations = 2) +image = cv2.erode(image,kernel,iterations = 2) +_,image = cv2.threshold(image, 60, 255, cv2.THRESH_BINARY) +axes[1].set_yticks([]) +axes[1].set_xticks([]) +axes[1].imshow(image) + + +plt.show() \ No newline at end of file diff --git a/laser_controller.py b/laser_controller.py new file mode 100644 index 0000000..6268b94 --- /dev/null +++ b/laser_controller.py @@ -0,0 +1,76 @@ +import serial +import numpy as np +from utils import comment +from PyQt5 import QtCore + +class laser_controller(): + + def __init__(self): + com = 'COM7' + baud = 9600 + parity = serial.PARITY_NONE + self.ser = serial.Serial(com, baud, timeout=.25, + parity=parity) + self.ser.flushInput() + self.ser.flushOutput() + # we want to start simmering immediately if not already + self.ser.readline() + self.simmer() + self.set_delay(200) + + def issue_command(self,command): + command_string = '{}\r\n'.format(command) + comment('sending command to laser:{}'.format(command_string.split('\r')[0])) + self.ser.write(command_string.encode('utf-8')) + + def send_receive(self,command): + self.issue_command(command) + response = self.ser.readline() + comment('response received from laser:{}'.format(response)) + return response + + def simmer(self): + return self.send_receive('M') + + def stop_flash(self): + return self.send_receive('S') + + def fire_auto(self): + return self.send_receive('A') + + def fire_qswitch(self): + return self.send_receive('OP') + + def set_delay(self,delay): + self.send_receive('W {}'.format(delay)) + +class attenuator_controller(): + + def __init__(self): + com = 'COM5' + baud = 19200 + parity = serial.PARITY_NONE + self.ser = serial.Serial(com, baud, timeout=.25, + parity=parity) + self.ser.flushInput() + self.ser.flushOutput() + # we always want the attenuator to be at 0.6 + self.send_receive('TF 0.6') + + def issue_command(self,command): + command_string = ';AT:{}\n'.format(command) + comment('sending command to attenuator:{}'.format(command_string.split('\n')[0])) + self.ser.write(command_string.encode('utf-8')) + + def send_receive(self,command): + self.issue_command(command) + response = self.ser.readline() + comment('response received from attenuator:{}'.format(response)) + return response + +if __name__ == '__main__': + laser = laser_controller() + laser.simmer() + laser.send_receive('') + # attenuator = attenuator_controller() + # attenuator.send_receive('TF?') diff --git a/stage_controller.py b/stage_controller.py index 3a5b97d..c336486 100644 --- a/stage_controller.py +++ b/stage_controller.py @@ -9,7 +9,7 @@ class stage_controller(): ''' open the serial port and check the status of the stage ''' - com = 'COM4' + com = 'COM6' baud = 9600 parity = serial.PARITY_NONE self.ser = serial.Serial(com, baud, timeout=.25, @@ -18,7 +18,7 @@ class stage_controller(): self.last_move_vector = np.zeros(2) self.magnification = 4 self.microns_per_pixel = 50/14.5 - self.calibration_factor = 1.45*4 + self.calibration_factor = 1.25*4 self.calibration = calibration_manager() self.key_control_dict = { 87:self.move_up, @@ -137,6 +137,7 @@ class stage_controller(): def handle_keypress(self,key): if key in self.key_control_dict.keys(): + # TODO: probably better to move this to the main file... self.key_control_dict[key]() @QtCore.pyqtSlot() -- GitLab