-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNIHTS_GUI.py
3269 lines (2529 loc) · 117 KB
/
NIHTS_GUI.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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
""" NIHTS GUI - NIHTS Exposure Control
v1.16: 2020-12-07, [email protected], A Gustafsson
Creating NIHTS GUI to avoid scripting. Using PyQt5.
All scripts are copy and pasted into their calls. See comments within script.
** CURRENT NIHTS VERSION
Runs with NIHTS Scripts in GUI
To use, enter on the command line in the ipython environment:
run -i NIHTS_GUI.py
UPDATES:
- Don't send nan for any buttons
- Reconfigure NIHTS Panel -> add general Nod script
- put in checks for sending command 2x
- Fix scripts to be external
- Terminal Line Toggles on but not off
- write terminal line script section
- Add save_n feature to ABBA script - currently saving every xcam image
- * Add status bar
- * set up logging so that it goes in the correct data folder --> logging currently on mac mini desktop
- create separate log of information from terminal window
NEEDS TESTING:
- Focus script
- LMI Mapping Tab
- NIHTS Shutdown Tab
"""
import sys
import os
import os.path
import subprocess
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
import argparse
import numpy as np
import time
import datetime as dt
import wx
from astropy.io import fits
import shutil
import glob
import math
import random
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
###############################################
import logging
logger = logging.getLogger(__name__)
###############################################
##
# NIHTS STARTUP SCRIPT
##
from xenics import XenicsCamera
x = XenicsCamera()
# COMMENT 180611: currently need to confirm that camera is powered on at this step
x.set_gain(False)
x.go(1.0, 1, 1, return_images=False)
from xenics import TCS
#from xenics import AOS #Added by AG 01/14/21
from xenics import NIHTS
tcs = TCS()
#aos = AOS() #Added by AG 01/14/21
nihts = NIHTS()
###############################################
state_0 = []
state_1 = []
state_2 = []
state_3 = []
state_4 = []
state_5 = []
state_6 = []
state_7 = []
state_8 = []
XPosCurrent = []
YPosCurrent = []
ExpFTime = []
FOffset = []
FilterCurrent = []
CommandCurrent = []
StepCurrent = []
CurrentSlit = []
CurrentSlitPos = []
XExpTimeCurrent = []
CoaddsCurrent = []
XPosLMICurrent = []
YPosLMICurrent = []
XPosLMIDesired = []
YPosLMIDesired = []
CurrentBinning = []
TargetCurrent = []
NExpTimeCurrent = []
GuidingCurrent = []
NnseqCurrent = []
OffsetCurrent = []
DirCurrent = []
curr_text = []
###############################################
class QtHandler(logging.Handler):
def __init__(self):
logging.Handler.__init__(self)
def emit(self, record):
record = self.format(record)
if record: XStream.stdout().write('%s\n'%record)
logger = logging.getLogger(__name__)
handler = QtHandler()
handler.setFormatter(logging.Formatter("%(levelname)s: %(asctime)s: %(lineno)d: %(message)s"))
FORMAT = "%(levelname)s: %(asctime)s: %(lineno)d: %(message)s"
logger.addHandler(handler)
###############################################
class XStream(QObject):
_stdout = None
_stderr = None
messageWritten = pyqtSignal(str)
def flush( self ):
pass
def fileno( self ):
return -1
def write( self, msg ):
if ( not self.signalsBlocked() ):
self.messageWritten.emit(unicode(msg))
@staticmethod
def stdout():
if ( not XStream._stdout ):
XStream._stdout = XStream()
sys.stdout = XStream._stdout
return XStream._stdout
@staticmethod
def stderr():
if ( not XStream._stderr ):
XStream._stderr = XStream()
sys.stderr = XStream._stderr
return XStream._stderr
###############################################
class NIHTS(QMainWindow):
def __init__(self):
super(NIHTS, self).__init__()
self.title = 'NIHTS'
self.left = 0
self.top = 0
self.width = 850
self.height = 400
self.setWindowTitle(self.title)
self.setGeometry(self.left, self.top, self.width, self.height)
self.nihts_widget = NIHTSWidget(self)
self.setCentralWidget(self.nihts_widget)
self.show()
class NIHTSWidget(QWidget):
def __init__(self, parent):
##
# Load Scripts
##
def run_Exit(self):
logging.info('Request to Close GUI...')
infoBox = QMessageBox()
infoBox.setText("Are you sure you want to exit?")
infoBox.setWindowTitle("Exit GUI")
infoBox.setStandardButtons(QMessageBox.Yes| QMessageBox.No)
infoBox.setEscapeButton(QMessageBox.Close)
result = infoBox.exec_()
if result == QMessageBox.Yes:
logging.info('--- FINISHED ---')
app.quit()
else:
logging.info('... Not ready to close GUI')
def run_open_xcam(self):
logging.info('Open Camera')
x.open_camera()
def run_NIHTS_Arcs(self):
focus_filter = str(FilterCurrent[-1])
filter_list = ['OPEN','B','V','R','VR','SDSSg','SDSSr','SDSSi','OIII','Ha_on','Ha_off','WC','WN','CT','BC','GC','RC']
filter = filter_list[int(focus_filter)]
if filter=='OPEN':
dichroic = 239.95
offset = 0
elif filter=='B':
dichroic = 238.76
offset = 105
elif filter=='V':
dichroic = 238.76
offset = 105
elif filter=='R':
dichroic = 238.36
offset = 140
elif filter=='VR':
dichroic = 237.84
offset = 185
elif filter=='SDSSg':
dichroic = 237.90
offset = 180
elif filter=='SDSSr':
dichroic = 237.90
offset = 180
elif filter=='SDSSi':
dichroic = 237.90
offset = 180
elif filter=='OIII':
dichroic = 237.62
offset = 205
elif filter=='Ha_on':
dichroic = 238.19
offset = 155
elif filter=='Ha_off':
dichroic = 238.19
offset = 155
elif filter=='WC':
dichroic = 238.07
offset = 165
elif filter=='WN':
dichroic = 238.13
offset = 160
elif filter=='CT':
dichroic = 238.01
offset = 170
elif filter=='BC':
dichroic = 237.96
offset = 175
elif filter=='GC':
dichroic = 237.96
offset = 175
elif filter=='RC':
dichroic = 237.96
offset = 175
infoBox = QMessageBox()
infoBox.setText("Ask the TO to move the dichroic position to %smm ... Ready?" % dichroic)
infoBox.setWindowTitle("Arcs Setup")
infoBox.setStandardButtons(QMessageBox.Yes| QMessageBox.No)
infoBox.setEscapeButton(QMessageBox.Close)
result = infoBox.exec_()
if result == QMessageBox.Yes:
logging.info('Arcs Sequence Begin...')
##
# NIHTS_arcs_v3.py
##
""" NIHTS arcs - Take ARCS.
v1.3: 2018-04-12, [email protected], A Gustafsson
turn on arc lamp, take 5 arc images with 120 second exposures, and turn lamp back off and take one 120 sec No Lamps exposure. turn on arc lamp, take 3 arc images with 20 second exposures, and turn lamp back off and take one 20 sec No Lamps exposure. Inputs frame type and slit information into headers.
uses the editted version of nihts.go
** GUI Version -- Needs testing
To use, enter on the command line:
python NIHTS_arcs.py
updates:
"""
import time
print('Turning Xenon Lamp ON')
subprocess.call("pwrusb setone 3 1", shell=True) #lamp on
subprocess.call("pwrusb status", shell=True)
print('-----Starting Arc Lamp Sequence 120-s -----')
nihts.go(nexp=5, exptime=120, target='Comparison', frame_type='comparison', comment1='Slit: None, Position: None', aborterror=False)
nihts.wait4nihts()
print('-----Starting Arc Lamp Sequence 20-s -----')
nihts.go(nexp=3, exptime=20, target='Comparison', frame_type='comparison', comment1='Slit: None, Position: None', aborterror=False)
nihts.wait4nihts()
print('-----Arc Lamp ON Sequence Complete -----')
# Turn off Arc lamp
print('Turning Xenon Lamp OFF')
subprocess.call("pwrusb setone 3 0", shell=True) #lamp off
subprocess.call("pwrusb status", shell=True)
print('-----Starting No Lamp Sequence 120-s -----')
nihts.go(nexp=1, exptime=120, target='Comparison - No Lamps', frame_type='comparison', comment1='Slit: None, Position: None', aborterror=False)
nihts.wait4nihts()
print('-----Starting No Lamp Sequence 20-s -----')
nihts.go(nexp=1, exptime=20, target='Comparison - No Lamps', frame_type='comparison', comment1='Slit: None, Position: None', aborterror=False)
nihts.wait4nihts()
print('-----No Lamp Sequence Complete -----')
##
#
##
logging.info('... Arcs Sequence End')
else:
print("Ask the TO to move the dichroic position to %smm and try again." % dichroic)
def run_NIHTS_Arcs_short(self):
focus_filter = str(FilterCurrent[-1])
filter_list = ['OPEN','B','V','R','VR','SDSSg','SDSSr','SDSSi','OIII','Ha_on','Ha_off','WC','WN','CT','BC','GC','RC']
filter = filter_list[int(focus_filter)]
if filter=='OPEN':
dichroic = 239.95
offset = 0
elif filter=='B':
dichroic = 238.76
offset = 105
elif filter=='V':
dichroic = 238.76
offset = 105
elif filter=='R':
dichroic = 238.36
offset = 140
elif filter=='VR':
dichroic = 237.84
offset = 185
elif filter=='SDSSg':
dichroic = 237.90
offset = 180
elif filter=='SDSSr':
dichroic = 237.90
offset = 180
elif filter=='SDSSi':
dichroic = 237.90
offset = 180
elif filter=='OIII':
dichroic = 237.62
offset = 205
elif filter=='Ha_on':
dichroic = 238.19
offset = 155
elif filter=='Ha_off':
dichroic = 238.19
offset = 155
elif filter=='WC':
dichroic = 238.07
offset = 165
elif filter=='WN':
dichroic = 238.13
offset = 160
elif filter=='CT':
dichroic = 238.01
offset = 170
elif filter=='BC':
dichroic = 237.96
offset = 175
elif filter=='GC':
dichroic = 237.96
offset = 175
elif filter=='RC':
dichroic = 237.96
offset = 175
infoBox = QMessageBox()
infoBox.setText("Ask the TO to move the dichroic position to %smm ... Ready?" % dichroic)
infoBox.setWindowTitle("Arcs Setup")
infoBox.setStandardButtons(QMessageBox.Yes| QMessageBox.No)
infoBox.setEscapeButton(QMessageBox.Close)
result = infoBox.exec_()
if result == QMessageBox.Yes:
logging.info('Arcs Short Sequence Begin...')
##
# NIHTS_arcs_short_v0.py
##
""" NIHTS arcs - Take ARCS.
v1.0: 2018-08-29, [email protected], A Gustafsson
turn on arc lamp, take 3 arc images with 20 second exposures, and turn lamp back off and take one 20 sec No Lamps exposure.
uses the editted version of nihts.go
** GUI Version -- Needs testing
To use, enter on the command line:
python NIHTS_arcs_short.py
updates:
"""
import time
print('Turning Xenon Lamp ON')
subprocess.call("pwrusb setone 3 1", shell=True) #lamp on
subprocess.call("pwrusb status", shell=True)
print('-----Starting Arc Lamp Sequence 20-s -----')
nihts.go(nexp=3, exptime=20, target='Comparison', frame_type='comparison', comment1='Slit: None, Position: None', aborterror=False)
nihts.wait4nihts()
print('-----Arc Lamp ON Sequence Complete -----')
# Turn off Arc lamp
print('Turning Xenon Lamp OFF')
subprocess.call("pwrusb setone 3 0", shell=True) #lamp off
subprocess.call("pwrusb status", shell=True)
print('-----Starting No Lamp Sequence 20-s -----')
nihts.go(nexp=1, exptime=20, target='Comparison - No Lamps', frame_type='comparison', comment1='Slit: None, Position: None', aborterror=False)
nihts.wait4nihts()
print('-----No Lamp Sequence Complete -----')
##
#
##
logging.info('... Arcs Short Sequence End')
else:
print("Ask the TO to move the dichroic position to 237.9mm and try again.") ##Fix this
def run_NIHTS_NTestImage(self):
logging.info('NIHTS Test Exposure: 1 second')
##
# NIHTS_NTestImage.py
##
""" NIHTS Test - Take NIHTS Test Exposure
v1.1: 2018-05-14, [email protected], A Gustafsson
** GUI Version - Needs Testing
updates:
-
"""
nihts.go(nexp=1, exptime=1, target='test', frame_type='object', comment1 = 'Slit: None, Position: None', aborterror=False)
##
#
##
def run_NIHTS_Shutdown(self):
logging.info('NIHTS Shutdown')
##
# NIHTS_Shutdown.py
##
""" NIHTS Shutdown - Turn off the NIHTS Camera
v1.0: 2018-02-08, [email protected], A Gustafsson
Turn Off Arc Lamps
Turn Off XCAM camera
** This is the current version!
To use, enter on the command line:
python NIHTS_Shutdown.py
updates:
"""
import subprocess
subprocess.call("pwrusb setone 3 0", shell=True) #arc lamps off
subprocess.call("pwrusb setone 1 0", shell=True) #xcam camera off
subprocess.call("pwrusb status", shell=True)
print('-----NIHTS Shutdown Complete-----')
##
#
##
def run_NIHTS_Home(self):
logging.info('Target is at Home')
##
# NIHTS_Home.py
##
""" NIHTS Home - Declare Target is at home.
v1.1: 2018-04-12, [email protected], A Gustafsson
** GUI Version - Needs Testing
updates:
-
"""
print('Target is at HOME Location')
tcs.current_target_pt = tcs.home_pt
##
#
##
def run_NIHTS_ReturnHome(self):
logging.info('Returning Target to Home Position')
##
# NIHTS_ReturnHome.py
##
""" NIHTS Return Home - Return Target to Home Location.
v1.1: 2018-07-17, [email protected], A Gustafsson
** GUI Version - Needs Testing
updates:
-
"""
print('Return target to HOME Location')
tcs.move_object_on_xcam(tcs.current_target_pt, tcs.home_pt)
##
#
##
def run_NIHTS_XFExp(self):
logging.info('XCAM Exposure')
##
# NIHTS_XFExp
##
""" XCAM Exposure - Take XCAM Exposure
v1.1: 2018-05-14, [email protected], A Gustafsson
** GUI Version - Needs Testing
updates:
-
"""
print('XCAM Exp Time', ExpFTime[-1])
xtime = ExpFTime[-1]
print(xtime)
nihts.wait4nihts()
x.go(xtime, 1, 1, return_images=False)
state_0.append(0)
state_1.append(0)
state_2.append(0)
state_3.append(0)
state_4.append(0)
state_5.append(0)
state_6.append(0)
state_7.append(0)
state_8.append(0)
XPosCurrent.append(100)
YPosCurrent.append(100)
ExpFTime.append(3)
FOffset.append(700)
FilterCurrent.append(5)
CommandCurrent.append(0)
StepCurrent.append(50)
CurrentSlit.append(1)
CurrentSlitPos.append(0)
XExpTimeCurrent.append(1)
CoaddsCurrent.append(1)
XPosLMICurrent.append(100)
YPosLMICurrent.append(100)
XPosLMIDesired.append(100)
YPosLMIDesired.append(100)
CurrentBinning.append(1)
TargetCurrent.append('test')
NExpTimeCurrent.append(1)
GuidingCurrent.append(0)
NnseqCurrent.append(1)
OffsetCurrent.append(20)
DirCurrent.append(0)
def run_toggleCommandLine(state_comm):
print(state_comm)
if state_comm == Qt.Checked:
print('Checked')
grid_t1.addWidget(Terminal1(self), 6, 1, 1, 3)
grid_t2.addWidget(Terminal2(self), 8, 1, 1, 3)
grid_t3.addWidget(Terminal3(self), 7, 1, 1, 4)
grid_t4.addWidget(Terminal4(self), 8, 1, 1, 4)
grid_t5.addWidget(Terminal5(self), 8, 1, 1, 4)
elif state_comm != Qt.Checked:
print('Not Checked')
#grid_t1.removeWidget(Terminal1(self))
#Terminal1(self).deleteLater()
super(QWidget, self).__init__(parent)
self.layout = QVBoxLayout(self)
##
# Initialize tab screen
##
self.tabs = QTabWidget()
self.tab1 = QWidget()
self.tab2 = QWidget()
self.tab3 = QWidget()
self.tab4 = QWidget()
self.tab5 = QWidget()
self.tab6 = QWidget()
self.tab7 = QWidget()
self.tabs.resize(500,200)
##
# CREATE TABS
##
self.tabs.addTab(self.tab1,"1. TEST IMAGE")
self.tabs.addTab(self.tab2,"2. CALIBRATIONS")
self.tabs.addTab(self.tab3,"3. FOCUS")
self.tabs.addTab(self.tab4,"4. XCAM")
self.tabs.addTab(self.tab5,"5. NIHTS")
self.tabs.addTab(self.tab6,"6. LMI ACQUISITION")
self.tabs.addTab(self.tab7,"7. SHUTDOWN")
##
# NIHTS TEST TAB
##
grid_t1 = QGridLayout()
grid_t1.setSpacing(10)
TestLabel1 = QLabel('Take NIHTS Test Image')
TestLabel1.setAlignment(Qt.AlignVCenter | Qt.AlignHCenter)
TestLabel2 = QLabel('* This must be done at the start of each LOUI initialization *')
TestLabel2.setAlignment(Qt.AlignVCenter | Qt.AlignHCenter)
TestButton = QPushButton("NIHTS Test Image")
TestButton.clicked.connect(run_NIHTS_NTestImage)
OpenCamButton = QPushButton("Open Camera")
OpenCamButton.clicked.connect(run_open_xcam)
CheckBox_Comm = QCheckBox("Command Line")
CheckBox_Comm.stateChanged.connect(run_toggleCommandLine)
ExitButton = QPushButton("Exit")
ExitButton.clicked.connect(run_Exit)
grid_t1.addWidget(ExitButton, 4, 5, 1, 1)
grid_t1.addWidget(TestLabel1, 1, 1, 1, 5)
grid_t1.addWidget(TestButton, 2, 3, 1, 1)
grid_t1.addWidget(TestLabel2, 3, 1, 1, 5)
grid_t1.addWidget(OpenCamButton, 4, 5, 1, 1)
grid_t1.addWidget(CheckBox_Comm, 5, 1, 1, 1)
self.tab1.setLayout(grid_t1)
##
# CALIBRATIONS TAB
##
grid_t2 = QGridLayout()
grid_t2.setSpacing(10)
ArcsLabel = QLabel('Begin Arcs Calibration Sequence')
ArcsLabel.setAlignment(Qt.AlignVCenter | Qt.AlignHCenter)
ArcsButton = QPushButton("ARCS LONG")
ArcsButton.clicked.connect(run_NIHTS_Arcs)
grid_t2.addWidget(ArcsLabel, 1, 1, 1, 4)
grid_t2.addWidget(ArcsButton, 2, 2, 1, 1)
ArcsButton = QPushButton("ARCS SHORT")
ArcsButton.clicked.connect(run_NIHTS_Arcs_short)
grid_t2.addWidget(ArcsLabel, 1, 1, 1, 4)
grid_t2.addWidget(ArcsButton, 2, 3, 1, 1)
FlatsLabel = QLabel('Begin Dome Flats Calibration Sequence')
FlatsLabel.setAlignment(Qt.AlignVCenter | Qt.AlignHCenter)
FlatsButtonOff = QPushButton("DOME DARKS")
FlatsButtonOn = QPushButton("DOME FLATS")
grid_t2.addWidget(FlatsLabel, 3, 1, 1, 4)
grid_t2.addWidget(FlatsButtonOff, 4, 2, 1, 1)
grid_t2.addWidget(FlatsButtonOn, 4, 3, 1, 1)
FlatsButtonOff.clicked.connect(DarksStatus)
FlatsButtonOn.clicked.connect(FlatsStatus)
ExitButton = QPushButton("Exit")
ExitButton.clicked.connect(run_Exit)
#grid_t2.addWidget(ExitButton, 6, 4, 1, 1)
#global Progress_t2
#Progress_t2 = QProgressBar(self)
#grid_t2.addWidget(Progress_t2, 6, 1, 1, 3)
grid_t2.addWidget(self.createSlitOptions(), 5, 1, 1, 4)
CheckBox_Comm = QCheckBox("Command Line")
CheckBox_Comm.stateChanged.connect(run_toggleCommandLine)
grid_t2.addWidget(CheckBox_Comm, 7, 1, 1, 1)
self.tab2.setLayout(grid_t2)
##
# FOCUS TAB
##
grid_t3 = QGridLayout()
grid_t3.setSpacing(10)
ExposureFButton = QPushButton("Take Exposure") #XCAM Exposure for Focus
grid_t3.addWidget(ExposureFButton, 1, 3, 1, 1)
ExposureFButton.clicked.connect(run_NIHTS_XFExp)
ExposureTime = QLabel('Exp Time')
ExposureTime.setAlignment(Qt.AlignVCenter | Qt.AlignRight)
ExposureTimeEdit = QDoubleSpinBox()
ExposureTimeEdit.setDecimals(2)
ExposureTimeEdit.setValue(3)
ExposureTimeEdit.valueChanged.connect(self.textchangedExpTime)
grid_t3.addWidget(ExposureTimeEdit, 1, 2, 1, 1)
grid_t3.addWidget(ExposureTime, 1, 1, 1, 1)
grid_t3.addWidget(self.createFocusSetup1(), 2, 1, 1, 4)
grid_t3.addWidget(self.createFocusSetup2(), 3, 1, 1, 4)
FocusButton = QPushButton("RUN FOCUS")
FocusButton.clicked.connect(self.run_NIHTS_Focus)
grid_t3.addWidget(FocusButton, 4, 1, 1, 2)
FocusOffset = QLabel('Best Guess Focus')
FocusOffset.setAlignment(Qt.AlignVCenter | Qt.AlignRight)
FocusOffsetEdit = QDoubleSpinBox()
FocusOffsetEdit.setDecimals(0)
FocusOffsetEdit.setMaximum(10000)
FocusOffsetEdit.setValue(700)
FocusOffsetEdit.valueChanged.connect(self.textchangedFOffset)
grid_t3.addWidget(FocusOffsetEdit, 4, 4, 1, 1)
grid_t3.addWidget(FocusOffset, 4, 3, 1, 1)
CheckBox_Comm = QCheckBox("Command Line")
CheckBox_Comm.stateChanged.connect(run_toggleCommandLine)
grid_t3.addWidget(CheckBox_Comm, 6, 1, 1, 1)
ExitButton = QPushButton("Exit")
ExitButton.clicked.connect(run_Exit)
#grid_t3.addWidget(ExitButton, 5, 4, 1, 1)
#global Progress_t3
#Progress_t3 = QProgressBar(self)
#grid_t3.addWidget(Progress_t3, 5, 1, 1, 3)
self.tab3.setLayout(grid_t3)
##
# XCAM TAB
##
grid_t4 = QGridLayout()
grid_t4.setSpacing(10)
XExpTime = QLabel('Exposure Time')
XExpTime.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
Coadds = QLabel('# Coadds')
Coadds.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
grid_t4.addWidget(XExpTime, 1, 1, 1, 1)
XExpTimeBox = QDoubleSpinBox(self)
grid_t4.addWidget(XExpTimeBox, 1, 2, 1, 1)
XExpTimeBox.setDecimals(2)
XExpTimeBox.setValue(1)
XExpTimeBox.valueChanged.connect(self.CurrentXExpTime)
grid_t4.addWidget(Coadds, 1, 3, 1, 1)
CoaddsBox = QSpinBox(self)
grid_t4.addWidget(CoaddsBox, 1, 4, 1, 1)
CoaddsBox.setValue(1)
CoaddsBox.valueChanged.connect(self.CurrentCoadds)
XExpButton = QPushButton("XCAM GO")
XExpButton.clicked.connect(self.run_NIHTS_XExp)
grid_t4.addWidget(XExpButton, 2, 2, 1, 2)
HomeButton = QPushButton("Target is at HOME")
HomeButton.clicked.connect(run_NIHTS_Home)
grid_t4.addWidget(HomeButton, 4, 1, 1, 1)
ReHomeButton = QPushButton("Return to HOME")
ReHomeButton.clicked.connect(run_NIHTS_ReturnHome)
grid_t4.addWidget(ReHomeButton, 5, 1, 1, 1)
MoveSlit = QLabel('Move to Slit/Pos:')
MoveSlit.setAlignment(Qt.AlignVCenter | Qt.AlignRight)
grid_t4.addWidget(MoveSlit, 4, 2, 1, 1)
Slit2Box = QComboBox(self)
Slit2Box.addItem("SED1")
Slit2Box.addItem("1.34")
Slit2Box.addItem("0.81")
Slit2Box.addItem("0.27")
Slit2Box.addItem("0.54")
Slit2Box.addItem("1.07")
Slit2Box.addItem("1.61")
Slit2Box.addItem("SED2")
Slit2Box.setCurrentIndex(1)
Slit2Box.currentIndexChanged.connect(self.SlitCurrent)
Pos2Box = QComboBox(self)
Pos2Box.addItem("A")
Pos2Box.addItem("B")
Pos2Box.addItem("Center")
Pos2Box.setCurrentIndex(0)
Pos2Box.currentIndexChanged.connect(self.SlitPosCurrent)
#print('Current Slit', str(CurrentSlit[-1]))
#print('Current Slit Pos', str(CurrentSlitPos[-1]))
grid_t4.addWidget(Slit2Box, 4, 3, 1, 1)
grid_t4.addWidget(Pos2Box, 4, 4, 1, 1)
MoveButton = QPushButton("MOVE")
MoveButton.clicked.connect(self.run_NIHTS_Move)
grid_t4.addWidget(MoveButton, 5, 3, 1, 2)
CheckBox_Comm = QCheckBox("Command Line")
CheckBox_Comm.stateChanged.connect(run_toggleCommandLine)
grid_t4.addWidget(CheckBox_Comm, 7, 1, 1, 1)
ExitButton = QPushButton("Exit")
ExitButton.clicked.connect(run_Exit)
#grid_t4.addWidget(ExitButton, 6, 4, 1, 1)
#global Progress_t4
#Progress_t4 = QProgressBar(self)
#grid_t4.addWidget(Progress_t4, 7, 1, 1, 3)
self.tab4.setLayout(grid_t4)
##
# NIHTS TAB
##
grid_t5 = QGridLayout()
grid_t5.setSpacing(10)
grid_t5.addWidget(self.createNIHTSSetup1(), 1, 1, 1, 4)
NIHTSTestButton = QPushButton("NIHTS Test")
NIHTSTestButton.clicked.connect(self.run_NIHTS_NTest)
grid_t5.addWidget(NIHTSTestButton, 2, 1, 1, 2)
NIHTSButton = QPushButton("NIHTS")
NIHTSButton.clicked.connect(self.run_NIHTS_NExp)
grid_t5.addWidget(NIHTSButton, 2, 3, 1, 2)
ABButton = QPushButton("AB")
ABButton.clicked.connect(self.run_NIHTS_AB)
grid_t5.addWidget(ABButton, 3, 1, 1, 2)
ABBAButton = QPushButton("ABBA")
ABBAButton.clicked.connect(self.run_NIHTS_ABBA)
grid_t5.addWidget(ABBAButton, 3, 3, 1, 2)
grid_t5.addWidget(self.createNIHTSSetup2(), 4, 1, 1, 4)
CenOffButton = QPushButton("CEN-SKY")
CenOffButton.clicked.connect(self.run_NIHTS_CenSky)
grid_t5.addWidget(CenOffButton, 5, 3, 1, 2)
CenOffButton = QPushButton("OFFSET TARGET")
CenOffButton.clicked.connect(self.run_NIHTS_Offset)
grid_t5.addWidget(CenOffButton, 5, 1, 1, 2)
CheckBox_Comm = QCheckBox("Command Line")
CheckBox_Comm.stateChanged.connect(run_toggleCommandLine)
grid_t5.addWidget(CheckBox_Comm, 7, 1, 1, 1)
ExitButton = QPushButton("Exit")
ExitButton.clicked.connect(run_Exit)
#grid_t5.addWidget(ExitButton, 6, 4, 1, 1)
#global Progress_t5
#Progress_t5 = QProgressBar(self)
#grid_t5.addWidget(Progress_t5, 6, 1, 1, 3)
self.tab5.setLayout(grid_t5)
##
# LMI ACQUISITION TAB
##
grid_t6 = QGridLayout()
grid_t6.setSpacing(10)
CurrLMIXPos = QLabel('Current X Position')
CurrLMIXPos.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
CurrLMIYPos = QLabel('Current Y Position')
CurrLMIYPos.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
DesLMIXPos = QLabel('HOME X Position')
DesLMIXPos.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
DesLMIYPos = QLabel('HOME Y Position')
DesLMIYPos.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
CurrLMIXPosEdit = QDoubleSpinBox(self)
CurrLMIXPosEdit.setMaximum(3000)
CurrLMIXPosEdit.setValue(100)
CurrLMIXPosEdit.setDecimals(2)
CurrLMIXPosEdit.valueChanged.connect(self.CurrXPosChanged)
CurrLMIYPosEdit = QDoubleSpinBox(self)
CurrLMIYPosEdit.setMaximum(3000)
CurrLMIYPosEdit.setValue(100)
CurrLMIYPosEdit.setDecimals(2)
CurrLMIYPosEdit.valueChanged.connect(self.CurrYPosChanged)
DesLMIXPosEdit = QDoubleSpinBox(self)
DesLMIXPosEdit.setMaximum(3000)
DesLMIXPosEdit.setValue(100)
DesLMIXPosEdit.setDecimals(2)
DesLMIXPosEdit.valueChanged.connect(self.DesXPosChanged)
DesLMIYPosEdit = QDoubleSpinBox(self)
DesLMIYPosEdit.setMaximum(3000)
DesLMIYPosEdit.setValue(100)
DesLMIYPosEdit.setDecimals(2)
DesLMIYPosEdit.valueChanged.connect(self.DesYPosChanged)
Binning = QLabel('LMI Binning:')
Binning.setAlignment(Qt.AlignVCenter | Qt.AlignRight)
grid_t6.addWidget(Binning, 1, 3, 1, 1)
BinningBox = QComboBox(self)
BinningBox.addItem("1x1")
BinningBox.addItem("2x2")
BinningBox.addItem("3x3")
BinningBox.addItem("4x4")
BinningBox.setCurrentIndex(1)
BinningBox.currentIndexChanged.connect(self.BinningCurrent)
#print('Current Binning', str(CurrentBinning[-1]))
grid_t6.addWidget(BinningBox, 1, 4, 1, 1)
grid_t6.addWidget(DesLMIXPos, 3, 1, 1, 1)
grid_t6.addWidget(DesLMIXPosEdit, 3, 2, 1, 1)
grid_t6.addWidget(DesLMIYPos, 3, 3, 1, 1)
grid_t6.addWidget(DesLMIYPosEdit, 3, 4, 1, 1)