This repository was archived by the owner on Aug 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathstart_gui.py
More file actions
executable file
·2668 lines (2263 loc) · 123 KB
/
start_gui.py
File metadata and controls
executable file
·2668 lines (2263 loc) · 123 KB
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
#!/usr/bin/env python3
import sys
if sys.version_info.major != 3 or sys.version_info.minor<8:
sys.exit("This software is expecting Python >3.8")
from matplotlib import cm
import os, subprocess, time, datetime, socket, struct, threading, shutil
from fnmatch import fnmatch
import json
from pyqtgraph import QtCore, QtGui, GraphicsLayoutWidget, GraphicsLayout
from PyQt5.QtWebEngineWidgets import QWebEngineView
from PyQt5.QtWidgets import QSizePolicy
import pyqtgraph as Qt
import numpy as np
from astropy import units as u
from astropy.time import Time as thetime
import pyqtgraph as pg
import random as rm
from termcolor import colored
import multiprocessing as mp
from hanging_threads import start_monitoring
from matplotlib import cm
from coms import kms_socket, tel_tracker
from main import append_data, append_hk, read_hk, fake_tel
from main.tel_box import draw_box
from scans import raster_script_1d, raster_planet_1d, raster_script_2d, bowtie_scan, point_cross, do_nothing
# from make_iv_curve_nc import *
from config import init, directory, coordinates
import time
import config.utils as ut
sys.path.append('loadcurves')
from gui_loadcurve import *
config_path = '/home/time/TIME_Catalogs/'
#class of all components of GUI
class MainWindow(QtGui.QMainWindow):
#initializes mcegui class and calls other init functions
def __init__(self, parent = None):
self.telescope_initialized = False
self.showmcedata = None
self.startwindow = None
self.browser = None
self.newwindow = None
self.heatmapwindow = None
self.telescopewindow = None
self.updater = None
self.tel_updater = None
self.kms_updater = None
super(MainWindow, self).__init__(parent)
self.setWindowTitle('TIME Live Data Visualization Suite')
# self.setAutoFillBackground(true)
self.getparameters()
p = QtGui.QPalette()
# p.setBrush(QtGui.QPalette.Window, QtGui.QBrush(QtGui.QColor(114,160,240)))
p.setBrush(QtGui.QPalette.Window, QtGui.QBrush(QtGui.QColor(255,255,255)))
self.logo = QtGui.QImage(directory.master_dir + "/timelogo.png")
self.logopal = QtGui.QPalette()
self.logopal.setBrush(QtGui.QPalette.Window,QtGui.QBrush(self.logo))
# start the main input window to specify observing parameters
self.startwindow = QtGui.QWidget()
self.startgrid = QtGui.QGridLayout()
self.startgrid.addLayout(self.parametersquit,1,1,QtCore.Qt.AlignBottom)
self.startwindow.setGeometry(10, 10, 800, 600)
self.startwindow.setLayout(self.startgrid)
# self.startwindow.setPalette(self.logopal)
self.startwindow.setPalette(p)
self.startwindow.closeEvent = self.on_quitbutton_clicked
self.startwindow.show()
''' ######################################################################## '''
# subprocess.Popen(['ssh -T -X -n obs@corona "cd /home/corona/cactus/status; ./status -n"'],shell=True)
# subprocess.Popen(['ssh -T -X -n obs@modelo "cd /home/corona/cactus/catalog; ./catalog"'],shell=True)
# subprocess.Popen(['ssh -T -Y -n obs@corona "cd /home/corona/cactus/APA/display; ./tsd_client --geometry 864x487"'],shell=True)
# subprocess.Popen(['ssh -T -Y -n oper12m@corona "cd /home/corona/cactus/xhchat; ./xhchat :1.0"'],shell=True)
# subprocess.Popen(['ssh -T -X -n obs@modelo "cd /home/corona/cactus/weather; ./weather"'],shell=True)
''' ######################################################################## '''
self.init_mce()
self.qt_connections()
self.clear_temp_files()
#sets all of the variables for mce/graph, deletes old gui_data_test files
def init_mce(self):
self.timeinterval = 1
self.observer = ''
self.datamode = ''
self.readoutcard = ''
self.framenumber = ''
self.frameperfile = 100
self.totaltimeinterval = 120
self.channel1 = 0
self.channel2 = 0
self.row1 = 0
self.row2 = 0
self.oldch1 = 0
self.oldch2 = 0
self.graphdata1 = []
self.z1 = 0
self.n_interval = 0
self.flags = mp.Array('i',ut.flags,lock=True)
self.offset = mp.Value('d',ut.offset,lock=True)
# self.netcdfdir = directory.netcdf_dir
self.netcdfdir = directory.netcdf_dir + str(int(time.time()))
if not os.path.isdir(self.netcdfdir) :
# oldmask = os.umask(000)
os.makedirs(self.netcdfdir,0o755)
# os.umask(oldmask)
#reacts to button presses and other GUI user input
def qt_connections(self):
self.quitbutton.clicked.connect(self.on_quitbutton_clicked)
self.submitbutton.clicked.connect(self.on_submitbutton_clicked)
self.starttel.clicked.connect(self.on_starttel_clicked)
self.changechan.clicked.connect(self.on_set_chan_clicked)
self.helpbutton.clicked.connect(self.on_help_clicked)
self.load_config_file_button.clicked.connect(self.on_load_config_file_clicked)
# self.useinit.clicked.connect(self.on_useinit_clicked)
self.kms_stop.clicked.connect(self.onkmsstop_clicked)
self.kms_restart.clicked.connect(self.onkmsrestart_clicked)
self.set_bias.clicked.connect(self.bias_bool)
self.load_cat_button.clicked.connect(self.on_loadcat_clicked)
self.select_cat_button.clicked.connect(self.on_selectcat_clicked)
def bias_bool(self):
self.bias_ready = True
def onkmsrestart_clicked(self):
subprocess.Popen(['ssh -T pi@kms python /home/pi/kms-dev/manual_sick_reset.py'],shell=True)
def onkmsstop_clicked(self):
subprocess.Popen(['ssh -T pi@kms python /home/pi/kms-dev/stop.py'],shell=True)
def on_help_clicked(self):
self.browser = QWebEngineView()
local_url = QtCore.QUrl.fromLocalFile(directory.master_dir + "help_doc.html")
self.browser.load(local_url)
self.browser.show()
def on_quitbutton_clicked(self, event=None):
print("Running quit function")
print('=== Setting Exit Flags ===')
ut.mce_exit.set()
ut.tel_exit.set()
ut.kms_exit.set()
ut.hk_exit.set()
print('=== Stopping MCEs ===')
# stop all of the mces with their own command
if self.showmcedata == 'Yes' and self.mceson != 'MCE SIM':
rc = self.readoutcard
if self.readoutcard == 'All':
rc = 's'
for mce_index in range(2):
if ut.which_mce[mce_index] == 1 :
subprocess.call('./coms/mce_stop.sh %i %s' % (mce_index, rc), shell=True)
subprocess.call('./coms/mce_stop_rsync.sh %i' % (mce_index), shell=True)
# # stop the file transfer process to time-master
# ~ if self.mceson != 'MCE SIM':
# ~ subprocess.Popen(['./coms/hk_stop_sftp.sh'], shell=True)
print('=== Closing Windows ===')
for window in [self.startwindow, self.browser, self.newwindow, self.heatmapwindow, self.telescopewindow]:
if window is not None:
window.close()
print('=== Closing Processes ===')
for proc, name in zip([self.updater, self.tel_updater,self.kms_updater],['MCE','Telescope','KMS']):
if proc is not None:
while proc.isRunning():
print("Still waiting on " + name + " updater process...")
proc.wait(2000)
print(name + " updater process ended")
else:
print(name + " updater process was not used")
print('=== Application Exit ===')
app.exit()
print("=== System Exit ===")
sys.exit()
def clear_temp_files(self):
print("Clearing out local temp files...")
tmp_dirs = [
directory.mce0_dir + 'temp.*',
directory.mce1_dir + 'temp.*',
directory.temp_dir + 'tele*',
directory.hk_dir + 'syncframes*',
directory.temp_dir + 'kms*'
]
for td in tmp_dirs:
# os.remove doesn't support wildcards
subprocess.call('rm ' + td, shell=True)
def on_loadcat_clicked(self):
self.select_cat.clear()
catalog_name = self.load_cat.currentText()
self.catalog = np.genfromtxt(config_path+catalog_name,dtype=[('ra','U15'),('dec','U15'),('epoch','U8'),('name','U20')],usecols=[0,1,2,3])
self.select_cat.addItems(self.catalog['name'])
def on_selectcat_clicked(self):
target = self.select_cat.currentText()
index = np.nonzero(self.catalog['name'] == target)[0][0]
self.tel_coord1.setText(self.catalog[index]['ra'])
self.unit4.setCurrentIndex(self.list_of_coord1_options.index('RA'))
self.tel_coord2.setText(self.catalog[index]['dec'])
self.unit5.setCurrentIndex(self.list_of_coord2_options.index('DEC'))
if self.catalog[index]['epoch'] in self.list_of_epochs:
self.tel_epoch.setCurrentIndex(self.list_of_epochs.index(self.catalog[index]['epoch']))
else:
print("WARNING: Epoch not recognized/accepted - setting to J2000.0")
self.tel_epoch.setCurrentIndex(self.list_of_epochs.index("J2000.0"))
self.tel_object.setText(self.catalog[index]['name'])
def on_starttel_clicked(self):
if self.init_tel.currentText() == 'Yes':
if self.telescan.currentText() == '2D Raster':
int_time = float(self.tel_sec.text()) * float(self.tel_map_len.text())/float(self.tel_step.text()) * 2
elif self.telescan.currentText() == '1D Raster' or self.telescan.currentText() == '1D Planet Raster':
int_time = float(self.tel_sec.text()) * int(self.numloop.text()) * 2
else:
int_time = 0
self.int_time = int_time/60
print("ESTIMATED INTEGRATION TIME: {:.1f} minutes".format(self.int_time))
else:
self.int_time = np.nan
if self.starttel_error_check():
print("TELESCOPE NOT INITIALIZED, please correct errors")
else:
self.num_loop = self.numloop.text()
self.sec = self.tel_sec.text()
# rpk: Convert all units into degrees so they don't make a mess later
if self.unit1.currentText() == 'arcmin':
self.tel_map_size.setText(str(float(self.tel_map_size.text())/60.0))
self.unit1.setCurrentIndex(self.list_of_angle_units.index['deg'])
if self.unit1.currentText() == 'arcsec':
self.tel_map_size.setText(str(float(self.tel_map_size.text())/3600.0))
self.unit1.setCurrentIndex(self.list_of_angle_units.index['deg'])
self.map_size = self.tel_map_size.text()
self.map_size_unit = self.unit1.currentText()
if self.unit6.currentText() == 'arcmin':
self.tel_map_len.setText(str(float(self.tel_map_len.text())/60.0))
self.unit6.setCurrentIndex(self.list_of_angle_units.index['deg'])
if self.unit6.currentText() == 'arcsec':
self.tel_map_len.setText(str(float(self.tel_map_len.text())/3600.0))
self.unit6.setCurrentIndex(self.list_of_angle_units.index['deg'])
self.map_len = self.tel_map_len.text()
self.map_len_unit = self.unit6.currentText()
if self.unit2.currentText() == 'arcmin':
self.tel_map_angle.setText(str(float(self.tel_map_angle.text())/60.0))
self.unit2.setCurrentIndex(self.list_of_angle_units.index['deg'])
if self.unit2.currentText() == 'arcsec':
self.tel_map_angle.setText(str(float(self.tel_map_angle.text())/3600.0))
self.unit2.setCurrentIndex(self.list_of_angle_units.index['deg'])
self.map_angle = self.tel_map_angle.text()
self.map_angle_unit = self.unit2.currentText()
if self.unit3.currentText() == 'arcmin':
self.tel_step.setText(str(float(self.tel_step.text())/60.0))
self.unit2.setCurrentIndex(self.list_of_angle_units.index['deg'])
if self.unit3.currentText() == 'arcsec':
self.tel_step.setText(str(float(self.tel_step.text())/3600.0))
self.unit3.setCurrentIndex(self.list_of_angle_units.index['deg'])
self.step = self.tel_step.text()
self.step_unit = self.unit3.currentText()
self.coord1 = self.tel_coord1.text()
self.coord2 = self.tel_coord2.text()
self.epoch = self.tel_epoch.currentText()
self.object = self.tel_object.text()
self.inittel = self.init_tel.currentText()
self.kmsonoff = self.kmsonofftext.currentText()
self.coord_space = self.map_space.currentText()
self.coord1_unit = self.unit4.currentText()
self.coord2_unit = self.unit5.currentText()
self.telescope_initialized = True
if self.inittel == 'Yes':
self.tel_scan = self.telescan.currentText()
scans = ['2D Raster','1D Raster','1D Planet Raster','Bowtie (constant el)','Pointing Cross','Watch']
script = [raster_script_2d,raster_script_1d,raster_planet_1d,bowtie_scan,point_cross,do_nothing]
for scan in scans :
if self.tel_scan == scan :
self.tel_script = script[scans.index(scan)]
tel_message = 'TELESCOPE INITIALIZED , %s' %(self.tel_scan)
self.off = False
elif self.inittel == 'No' :
if self.kmsonoff == 'No':
self.tel_script = ' '
self.off = True
tel_message = 'NO TELESCOPE SELECTED'
if self.kmsonoff == 'Yes':
self.tel_script = 'Tracker'
self.off = True
tel_message = 'KMS ONLY'
elif self.inittel == 'Sim' :
tel_message = 'TEL SIM SELECTED'
self.tel_script = 'Sim'
self.off = False
else :
tel_message = 'TRACKER DATA ONLY'
self.tel_script = 'Tracker'
self.off = False
print(tel_message)
# Checks input parameters for various errors and prints them out. Returns True if problems found
# False otherwise
def starttel_error_check(self):
# rpk: Adding error checking to inputs and then putting them in a predictable format
# to reduce problems with unit conversion later
check_error_found = False
check_error_message = ''
numeric_p = set('0123456789:;.+-')
numeric = set('0123456789.+-')
if set(self.numloop.text()) > numeric:
check_error_found = True
check_error_message += 'ERROR: Number of Scans contain invalid characters\n'
elif '.' in self.numloop.text():
check_error_found = True
check_error_message += 'ERROR: Number of Scans must be an integer\n'
if set(self.tel_sec.text()) > numeric:
check_error_found = True
check_error_message += 'ERROR: Time to Traverse Scan Length contain invalid characters\n'
elif float(self.tel_sec.text()) <= 0:
check_error_found = True
check_error_message += 'ERROR: Time to Traverse Scan Length <= 0\n'
if set(self.tel_map_size.text()) > numeric:
check_error_found = True
check_error_message += 'ERROR: Map Size contains invalid characters\n'
elif float(self.tel_map_size.text()) <= 0:
check_error_found = True
check_error_message += 'ERROR: Map Size <= 0\n'
if self.telescan.currentText() == '2D Raster' or self.telescan.currentText() == '2D Planet Raster':
if set(self.tel_map_size.text()) > numeric:
check_error_found = True
check_error_message += 'ERROR: Map Length contains invalid characters\n'
elif float(self.tel_map_len.text()) <= 0:
check_error_found = True
check_error_message += 'ERROR: Map Size <= 0\n'
if set(self.tel_map_size.text()) > numeric:
check_error_found = True
check_error_message += 'ERROR: Angle of Map Offset contains invalid characters\n'
if ';' in self.tel_coord1.text():
self.tel_coord1.setText(self.tel_coord1.text().replace(';',':'))
print("WARNING: Source Coords 1 contain semicolons, these will be replaced with colons")
if ';' in self.tel_coord2.text():
self.tel_coord2.setText(self.tel_coord2.text().replace(';',':'))
print("WARNING: Source Coords 2 contain semicolons, these will be replaced with colons")
if set(self.tel_coord1.text()) > numeric_p or set(self.tel_coord1.text()) > numeric_p:
check_error_found = True
check_error_message += 'ERROR: Source Coords contains an invalid character\n'
if self.init_tel.currentText() == 'Yes' and self.telescan.currentText() not in ['2D Planet Raster', '1D Planet Raster']:
if self.tel_coord1.text().count(':')+self.tel_coord1.text().count(';') != 2 or self.tel_coord2.text().count(':')+self.tel_coord2.text().count(';') != 2:
check_error_found = True
check_error_message += 'ERROR: Source Coords are not in hh:mm:ss or dd:mm:ss format\n'
elif self.tel_coord1.text().count('.') > 1 or self.tel_coord2.text().count('.') > 1:
check_error_found = True
check_error_message += 'ERROR: Source Coords are not in hh:mm:ss or dd:mm:ss format\n'
if set(self.tel_step.text()) > numeric:
check_error_found = True
check_error_message += 'ERROR: Size of 2D Vertical Step contain invalid characters\n'
if self.telescan.currentText() not in ['2D Planet Raster', '1D Planet Raster']:
bad_names = [['Mercury','mercury'],['Venus','venus'],['Mars','mars'],['Jupiter','jupiter'],['Saturn','saturn'],['Uranus','uranus'],['Neptune','neptune']]
replacements = ['Hermes','Aphrodite','Ares','Zeus','Cronus','Ouranos','Poseidon']
for i in range(len(bad_names)):
if self.tel_object.text() in bad_names[i]:
self.tel_object.setText(replacements[i])
print("WARNING: Cannot observe objects with planet names, we've renamed the target {}".format(replacements[i]))
else:
if self.tel_object.text() not in ['Mercury','Venus','Mars','Jupiter','Saturn','Neptune','Uranus','mercury','venus','mars','jupiter','saturn','neptune','uranus']:
check_error_found = True
check_error_message += 'ERROR: Planet Raster mode only works with planets. Make sure the object name is a planet\n'
print("WARNING: Planet coordinates have been updated - these are approximate")
coords = raster_planet_1d.get_planet_info(thetime(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')) + 7*u.h,self.tel_object.text())
strcoords = coords.to_string('hmsdms').split(' ')
self.tel_coord1.setText(strcoords[0][:-1].replace('h',':').replace('m',':'))
self.unit4.setCurrentIndex(self.list_of_coord1_options.index('RA'))
self.tel_coord2.setText(strcoords[1][:-1].replace('d',':').replace('m',':'))
self.unit5.setCurrentIndex(self.list_of_coord2_options.index('DEC'))
self.tel_epoch.setCurrentIndex(self.list_of_epochs.index('Apparent'))
if check_error_found:
print(check_error_message)
return True
else:
return False
def on_load_config_file_clicked(self):
with open(config_path+self.load_config_file.currentText()) as f:
config = json.load(f)
for key in config.keys():
if key in self.text_keys.keys():
self.text_keys[key].setText(str(config[key]))
elif key in self.drop_keys.keys():
if config[key] in self.drop_keys[key][1]:
self.drop_keys[key][0].setCurrentIndex(self.drop_keys[key][1].index(config[key]))
else:
print("WARNING: Value for '{}' not accepted".format(key))
elif key == "Observer Log":
self.logtext.setText(str(config[key]))
else:
print("WARNING: Configuration key '{}' not recognized".format(key))
# RPK: This init setup is deprecated in favor of loading from a .json file. Keeping here in case it is needed for dev
# def on_useinit_clicked(self):
# # RPK: I'm altering this to fill in the GUI from the config file,
# # then user still has to initialize telescope and click submit. This
# # will make the error checking and input formatting work for both
# # entry modes.
# # Enter telescope parameters:
# self.numloop.setText(init.tel_dict["num_loop"])
# self.tel_sec.setText(init.tel_dict["sec"])
# self.unit1.setCurrentIndex(self.list_of_angle_units.index(init.tel_dict["map_size_unit"]))
# self.tel_map_size.setText(init.tel_dict["map_size"])
# self.unit6.setCurrentIndex(self.list_of_angle_units.index(init.tel_dict["map_len_unit"]))
# self.tel_map_len.setText(init.tel_dict["map_len"])
# self.unit2.setCurrentIndex(self.list_of_angle_units.index(init.tel_dict["map_angle_unit"]))
# self.tel_map_angle.setText(init.tel_dict["map_angle"])
# self.unit3.setCurrentIndex(self.list_of_angle_units.index(init.tel_dict["step_unit"]))
# self.tel_step.setText(init.tel_dict["step"])
# self.tel_coord1.setText(init.tel_dict["coord1"])
# self.unit4.setCurrentIndex(self.list_of_coord1_options.index(init.tel_dict["coord1_unit"]))
# self.tel_coord2.setText(init.tel_dict["coord2"])
# self.unit5.setCurrentIndex(self.list_of_coord2_options.index(init.tel_dict["coord2_unit"]))
# self.tel_epoch.setCurrentIndex(self.list_of_epochs.index(init.tel_dict["epoch"]))
# self.tel_object.setText(init.tel_dict["object"])
# self.init_tel.setCurrentIndex(self.list_of_init_tels.index(init.tel_dict["inittel"]))
# self.kmsonofftext.setCurrentIndex(self.list_of_kms_onoffs.index(init.tel_dict["kmsonoff"]))
# self.map_space.setCurrentIndex(self.list_of_map_space_options.index(init.tel_dict["coord_space"]))
# self.telescan.setCurrentIndex(self.list_of_scan_options.index(init.tel_dict["tel_scan"]))
# # mce params ========================
# self.enterobserver.setText(init.mce_dict["observer"])
# self.whichmces.setCurrentIndex(self.list_of_mce_options.index(init.mce_dict["mceson"]))
# self.enterdatamode.setCurrentIndex(self.list_of_datamode_options.index(init.mce_dict["datamode"]))
# self.enterreadoutcard.setCurrentIndex(self.list_of_readoutcard_options.index(init.mce_dict["readoutcard"]))
# self.enterframenumber.setText(init.mce_dict["framenumber"])
# self.heatalpha.setText(init.mce_dict["alpha"])
# self.entertimeinterval.setText(init.mce_dict["timeinterval"])
# self.enterchanneldelete.setCurrentIndex(self.list_of_channeldelete_options.index(init.mce_dict["channeldelete"]))
# self.entershowmcedata.setCurrentIndex(self.list_of_showmcedata_options.index(init.mce_dict["showmcedata"]))
#sets parameter variables to user input and checks if valid - will start MCE
#and live graphing if they are
def on_submitbutton_clicked(self):
self.timestarted = datetime.datetime.utcnow().isoformat()
# check if telescope has been started first
if not self.telescope_initialized:
print("Please Initialize Telescope First")
self.warningbox('gui')
return
#set variables to user input
# observer ---------------------------------------
self.observer = self.enterobserver.text()
# which mces are active --------------------------
self.mceson = self.whichmces.currentText()
#set channel to plot
if self.entertype0.currentText() == 'RC':
if 0 <= int(self.enterrowfeed0.text()) <= 32 and 0 <= int(self.entercolchan0.text()) <= 31:
self.row1 = int(self.enterrowfeed0.text())
self.channel1 = int(self.entercolchan0.text())
self.oldch1 = int(self.entercolchan0.text())
else:
raise ValueError("RC/XF values invalid")
elif self.entertype0.currentText() == 'XF':
if int(self.enterrowfeed0.text()) < 16 and int(self.entercolchan0.text()) < 60:
cr = coordinates.xf_to_muxcr(int(self.enterrowfeed0.text()),int(self.entercolchan0.text()),p=0)
self.row1 = cr[1]
self.channel1 = cr[0]
self.oldch1 = cr[0]
else:
raise ValueError("RC/XF values invalid")
else:
raise ValueError("RC type not recognized")
if self.entertype1.currentText() == 'RC':
if 0 <= int(self.enterrowfeed1.text()) <= 32 and 0 <= int(self.entercolchan1.text()) <= 31:
self.row2 = int(self.enterrowfeed1.text())
self.channel2 = int(self.entercolchan1.text())
self.oldch2 = int(self.entercolchan1.text())
else:
raise ValueError("RC/XF values invalid")
elif self.entertype1.currentText() == 'XF':
if int(self.enterrowfeed1.text()) < 16 and int(self.entercolchan1.text()) < 60:
cr = coordinates.xf_to_muxcr(int(self.enterrowfeed1.text()),int(self.entercolchan1.text()),p=0)
self.row2 = cr[1]
self.channel2 = cr[0]
self.oldch2 = cr[0]
else:
raise ValueError("RC/XF values invalid")
else:
raise ValueError("RC type not recognized")
# data mode --------------------------------------
self.datamode = self.enterdatamode.currentText()
if self.datamode == 'Load Curves':
self.loadcurve_flag = True
else:
self.loadcurve_flag = False
mce_states = ['Error', 'SQ1 Feedback', 'Raw', 'Filtered SQ1 Feedback', 'Debugging', 'Mixed Mode (25:7)','Mixed Mode (22:10)','Mixed Mode (24:8)','Mixed mode (18:14)', 'Load Curves']
#want loadcurve to be the same as ??
#for now I'm going to say that the load curve is the same as RAw or SQ1 Feedback
mce_states2 = [0,1,12,2,11,10,7,5,4, 12]
for state in mce_states :
if self.datamode == state :
self.datamode = mce_states2[mce_states.index(state)]
# readout card ---------------------------------------------
self.readoutcard = self.enterreadoutcard.currentIndex() - 1
if self.readoutcard < 0:
self.readoutcard = 'All'
self.currentreadoutcard = 2
self.currentreadoutcarddisplay = 'MCE 1 RC 2'
# frame number ----------------------------------------------
self.framenumber = self.enterframenumber.text()
# heatmap error function ------------------------------------
self.alpha = float(self.heatalpha.text())
# how much data to view on screen at once -------------------
self.timeinterval = self.entertimeinterval.text()
# keep old channel data on graph ----------------------------
self.channeldelete = self.enterchanneldelete.currentText()
# keep mce data on screen -----------------------------------
self.showmcedata = self.entershowmcedata.currentText()
if self.inittel == 'Yes':
if self.kmsonoff == 'Yes':
self.kms_on_off = 2
print('kms on off is 2')
else :
self.kms_on_off = 1
self.tel_scan = self.telescan.currentText()
scans = ['2D Raster','1D Raster','1D Planet Raster','Bowtie (constant el)','Pointing Cross','Watch']
script = [raster_script_2d,raster_script_1d,raster_planet_1d,bowtie_scan,point_cross,do_nothing]
for scan in scans :
if self.tel_scan == scan :
self.tel_script = script[scans.index(scan)]
print(self.tel_script)
tel_message = 'TELESCOPE INITIALIZED'
self.off = False
elif self.inittel == 'No' :
if self.kmsonoff == 'Yes':
self.kms_on_off = 2
else :
self.kms_on_off = 0
self.tel_script = ' '
self.off = True
tel_message = 'NO TELESCOPE SELECTED'
elif self.inittel == 'Sim' :
tel_message = 'TEL SIM SELECTED'
self.tel_script = 'Sim'
self.off = False
if self.kmsonoff == 'Yes':
self.kms_on_off = 2
else :
self.kms_on_off = 0
else :
if self.kmsonoff == 'Yes':
self.kms_on_off = 3
else :
self.kms_on_off = 1
tel_message = 'TRACKER DATA ONLY'
self.tel_script = 'Tracker'
self.off = False
print(tel_message)
# -----------------------------------------------------------
if self.mceson == 'MCE0':
ut.which_mce[0] = 1
ut.which_mce[1] = 0
ut.which_mce[2] = 0
elif self.mceson == 'MCE1':
ut.which_mce[0] = 0
ut.which_mce[1] = 1
ut.which_mce[2] = 0
elif self.mceson == 'MCE SIM':
ut.which_mce[0] = 0
ut.which_mce[1] = 0
ut.which_mce[2] = 1
else :
ut.which_mce[0] = 1
ut.which_mce[1] = 1
ut.which_mce[2] = 0
#check if parameters are valid - will create warning box if invalid
if self.observer == '' or self.framenumber == '' or self.framenumber == '0'\
or self.timeinterval == ''\
or self.timeinterval == '0':
self.warningbox('gui') # throw up a warning box
# restart the gui window
ex = MainWindow()
elif self.showmcedata == 'No':
self.submitbutton.setEnabled(False)
else:
dir = directory.master_dir
if os.path.exists(dir + 'tempfiles/tempparameters.txt') :
parafile = open(dir + 'tempfiles/tempparameters.txt', 'w')
parafile.write('observer: {}\n'.format(self.observer))
parafile.write('data mode: {}\n'.format(str(self.datamode)))
parafile.write('readout card: {}\n'.format(str(self.readoutcard)))
parafile.write('frame number: {}\n'.format(self.framenumber))
parafile.write('time interval: {}\n'.format(self.timeinterval))
parafile.write('delete old columbs: {}\n'.format(self.channeldelete))
parafile.write('time started: {}\n'.format(self.timestarted))
# DTC: adding in telescope parameters too 2022/01/26
if self.inittel == 'Yes':
parafile.write('\n'+'-'*42+'\n')
parafile.write('inittel: {}\n'.format(self.inittel))
parafile.write('kmsonoff: {}\n'.format(self.kmsonoff))
parafile.write('tel_scan: {}\n'.format(self.tel_scan))
parafile.write('coord_space: {}\n'.format(self.coord_space))
parafile.write('num_loop: {}\n'.format(self.num_loop))
parafile.write('sec: {}\n'.format(self.sec))
parafile.write('map_size: {} {}\n'.format(self.map_size,self.map_size_unit))
parafile.write('map_len: {} {}\n'.format(self.map_len,self.map_len_unit))
parafile.write('map_angle: {} {}\n'.format(self.map_angle,self.map_angle_unit))
parafile.write('coord1: {} {}\n'.format(self.coord1,self.coord1_unit))
parafile.write('coord2: {} {}\n'.format(self.coord2,self.coord2_unit))
parafile.write('step: {} {}\n'.format(self.step,self.step_unit))
parafile.write('epoch: {}\n'.format(self.epoch))
parafile.write('object: {}\n'.format(self.object))
parafile.write('\n'+'-'*42+'\n')
# DTC: end of changes 2022/01/26
parafile.write(self.logtext.toPlainText())
parafile.close()
new_tempfile = shutil.copy(dir + 'tempfiles/tempparameters.txt',self.netcdfdir + '/log.txt')
print(colored('Time Started: %s' % (self.timestarted),'magenta'))
# self.p = int((50 * 10 ** 6) / (33 * 90 * ut.german_freq)) #calculation taken from UBC MCE Wiki
# prevents user from re-activating everything
self.submitbutton.setEnabled(False)
if self.mceson != "MCE SIM" :
#set the data mode for both mces and start them running
rc = self.readoutcard
if self.readoutcard == 'All':
rc = 's'
# Remote location to copy the mce sync script to
SYNC_SCRIPT_DEST = '/data/cryo/mce_rsync.py'
for mce_index in range(2):
if ut.which_mce[mce_index] == 1 :
print("Copying mce_rsync.py to mce%i..." % mce_index)
subprocess.call('scp ./coms/mce_rsync.py time@time-mce-%i:%s' % (mce_index, SYNC_SCRIPT_DEST), shell = True)
print("Changing data_mode on mce%i..." % mce_index)
subprocess.call('./coms/mce_cdm.sh %i a %s' % (mce_index, self.datamode), shell = True)
print("Clearing remote temp files on mce%i..." % mce_index)
subprocess.call('./coms/mce_del.sh %i' % (mce_index), shell=True)
for mce_index in range(2):
if ut.which_mce[mce_index] == 1 :
print("Starting acquision on mce%i..." % mce_index)
cmd = './coms/mce_run.sh %i %s %s %s' % (mce_index, self.framenumber, rc, self.frameperfile)
# print(cmd)
subprocess.Popen([cmd], shell = True)
# start file transfer scripts
for mce_index in range(2):
if ut.which_mce[mce_index] == 1 :
dirname = directory.mce_dir_template % mce_index
subprocess.Popen(['ssh -T time@time-mce-%i python3 %s time@time-master:%s' % (mce_index, SYNC_SCRIPT_DEST, dirname)], shell=True)
time.sleep(2.0)
subprocess.Popen(['ssh -T time@time-hk python /home/time/TIME_Software/coms/hk_sftp.py'], shell=True)
if self.loadcurve_flag == True:
data = np.zeros((33,32))
self.startwindow.hide()
self.newwindow = QtGui.QWidget()
self.newwindow.setWindowTitle('TIME Live Data Viewer')
self.newgrid = QtGui.QGridLayout()
self.newgraphs = QtGui.QVBoxLayout()
self.newwindow.setGeometry(10, 10, 800, 600)
self.newwindow.setLayout(self.newgrid)
self.newgrid.addLayout(self.newgraphs, 0,3,8,8)
p = QtGui.QPalette()
p.setBrush(QtGui.QPalette.Window, QtGui.QBrush(QtGui.QColor(255,255,255)))
self.newwindow.setPalette(p)
self.newquitbutton = QtGui.QVBoxLayout()
self.newquitbutton.addWidget(self.quitbutton)
# self.newgrid.addLayout(self.newquitbutton, 9,0,1,2)
self.setnewrc = QtGui.QVBoxLayout()
self.setnewrc.addWidget(self.changechan)
self.newgrid.addLayout(self.setnewrc, 8,0,1,2)
self.kmsstop = QtGui.QVBoxLayout()
self.kmsstop.addWidget(self.kms_stop)
self.newgrid.addLayout(self.kmsstop,6,0,1,2)
self.kmsrestart = QtGui.QVBoxLayout()
self.kmsrestart.addWidget(self.kms_restart)
self.newgrid.addLayout(self.kmsrestart,7,0,1,2)
self.bias_button = QtGui.QVBoxLayout()
self.bias_button.addWidget(self.set_bias)
self.newgrid.addLayout(self.bias_button, 9,0,1,2)
# self.bias_ready = True
self.init_lc_plots()
self.channelselection()
self.set_bias_levels()
# self.initheatmap(data,data) # give first values for heatmap to create image scale
# self.initfftgraph()
# self.inittelescope()
# self.initkmirrordata()
sys.stdout.flush()
sys.stderr.flush()
self.newwindow.closeEvent = self.on_quitbutton_clicked
self.newwindow.show()
else:
data = np.zeros((33,32))
self.startwindow.hide()
self.newwindow = QtGui.QWidget()
self.newwindow.setWindowTitle('TIME Live Data Viewer')
self.newgrid = QtGui.QGridLayout()
self.newgraphs = QtGui.QVBoxLayout()
self.newwindow.setGeometry(10, 10, 800, 600)
self.newwindow.setLayout(self.newgrid)
self.newgrid.addLayout(self.newgraphs, 0,2,8,8)
p = QtGui.QPalette()
p.setBrush(QtGui.QPalette.Window, QtGui.QBrush(QtGui.QColor(255,255,255)))
self.newwindow.setPalette(p)
self.newquitbutton = QtGui.QVBoxLayout()
self.newquitbutton.addWidget(self.quitbutton)
self.newgrid.addLayout(self.newquitbutton, 9,0,1,2)
self.setnewrc = QtGui.QVBoxLayout()
self.setnewrc.addWidget(self.changechan)
self.newgrid.addLayout(self.setnewrc, 8,0,1,2)
self.kmsstop = QtGui.QVBoxLayout()
self.kmsstop.addWidget(self.kms_stop)
self.newgrid.addLayout(self.kmsstop,6,0,1,2)
self.kmsrestart = QtGui.QVBoxLayout()
self.kmsrestart.addWidget(self.kms_restart)
self.newgrid.addLayout(self.kmsrestart,7,0,1,2)
#start other plot making processes
self.initplot()
self.channelselection()
self.initheatmap(data,data) # give first values for heatmap to create image scale
self.initfftgraph()
self.inittelescope()
self.initkmirrordata()
sys.stdout.flush()
sys.stderr.flush()
self.newwindow.closeEvent = self.on_quitbutton_clicked
self.newwindow.show()
# Write this observation to "previous_config.json"
config_dict = {}
for key in self.text_keys.keys():
config_dict[key] = self.text_keys[key].text()
for key in self.drop_keys.keys():
config_dict[key] = self.drop_keys[key][0].currentText()
config_dict["Observer Log"] = self.logtext.toPlainText()
json.dump(config_dict,open(config_path+'previous_config.json','w'))
#resets parameter variables after warning box is read
def on_warningbutton_clicked(self):
self.on_quitbutton_clicked()
#creates inputs for user to enter parameters and creates 'Quit' button
def on_set_chan_clicked(self):
self.changechannel()
self.changerow()
def getparameters(self):
# RPK: New config file system
self.load_config_file_box = QtGui.QGroupBox()
self.load_config_file_layout = QtGui.QFormLayout()
self.load_config_file = QtGui.QComboBox()
self.load_config_file.addItems(['previous_config.json'])
self.load_config_file.addItems(sorted([f for f in os.listdir(config_path) if fnmatch(f,'*.json') and f != 'previous_config.json']))
self.load_config_file_button = QtGui.QPushButton('Load')
self.load_config_file_button.setStyleSheet("background-color: orange")
self.load_config_file_layout.addRow(self.load_config_file)
self.load_config_file_layout.addRow(self.load_config_file_button)
self.load_config_file_box.setLayout(self.load_config_file_layout)
#creating user input boxes
self.enterobserver = QtGui.QLineEdit('TIME_obs')
# self.enterobserver.setMaxLength(3) # observer shouldn't have to be initials
self.enterdatamode = QtGui.QComboBox()
self.list_of_datamode_options = ['Mixed Mode (25:7)', 'Error', 'SQ1 Feedback', 'Raw', 'Filtered SQ1 Feedback', 'Debugging', 'Mixed Mode (22:10)','Mixed Mode (24:8)','Mixed mode (18:14)', 'Load Curves']
self.enterdatamode.addItems(self.list_of_datamode_options)
self.whichmces = QtGui.QComboBox()
self.list_of_mce_options = ['MCE0','MCE1','Both','MCE SIM']
self.whichmces.addItems(self.list_of_mce_options)
self.enterreadoutcard = QtGui.QComboBox()
self.list_of_readoutcard_options = ['All'] + ['MCE 0 RC {}'.format(i+1) for i in range(4)] + ['MCE 1 RC {}'.format(i+1) for i in range(4)]
self.enterreadoutcard.addItems(self.list_of_readoutcard_options)
self.enterframenumber = QtGui.QLineEdit('1350000')
self.enterframenumber.setMaxLength(9)
self.heatalpha = QtGui.QLineEdit('0.1')
# self.enterdatarate = QtGui.QLineEdit('45')
self.entertimeinterval = QtGui.QLineEdit('120')
self.enterchanneldelete = QtGui.QComboBox()
self.list_of_channeldelete_options = ['No','Yes']
self.enterchanneldelete.addItems(self.list_of_channeldelete_options)
self.entershowmcedata = QtGui.QComboBox()
self.list_of_showmcedata_options = ['Yes','No']
self.entershowmcedata.addItems(self.list_of_showmcedata_options)
self.list_of_rowchan_options = ['RC','XF']
self.enterrowfeed0 = QtGui.QLineEdit('0')
self.entercolchan0 = QtGui.QLineEdit('0')
self.entertype0 = QtGui.QComboBox()
self.entertype0.addItems(self.list_of_rowchan_options)
self.enterrowfeed1 = QtGui.QLineEdit('0')
self.entercolchan1 = QtGui.QLineEdit('0')
self.entertype1 = QtGui.QComboBox()
self.entertype1.addItems(self.list_of_rowchan_options)
self.det0_widget = QtGui.QHBoxLayout()
self.det0_widget.addWidget(self.enterrowfeed0)
self.det0_widget.addWidget(self.entercolchan0)
self.det0_widget.addWidget(self.entertype0)
self.det1_widget = QtGui.QHBoxLayout()
self.det1_widget.addWidget(self.enterrowfeed1)
self.det1_widget.addWidget(self.entercolchan1)
self.det1_widget.addWidget(self.entertype1)
self.mceGroupBox = QtGui.QGroupBox()
self.parameters = QtGui.QFormLayout()
self.mcetitle = QtGui.QLabel(self)
self.mcetitle.setAlignment(QtCore.Qt.AlignCenter)
self.mcetitle.setText('MCE Parameters')
self.parameters.addRow(self.mcetitle)
self.parameters.addRow('Observer', self.enterobserver)
self.parameters.addRow("Active MCE's", self.whichmces)
self.parameters.addRow('Datamode', self.enterdatamode)
self.parameters.addRow('Readout Card', self.enterreadoutcard)
self.parameters.addRow('Frame Number', self.enterframenumber)
self.parameters.addRow('Heatmap Alpha', self.heatalpha)
# self.parameters.addRow('Data Rate', self.enterdatarate)
self.parameters.addRow('Delete Old Columns', self.enterchanneldelete)
self.parameters.addRow('Time Interval (sec)', self.entertimeinterval)
self.parameters.addRow('Show MCE Data', self.entershowmcedata)
self.parameters.addRow('MCE0 Detector:', self.det0_widget)
self.parameters.addRow('MCE1 Detector:', self.det1_widget)
self.mceGroupBox.setLayout(self.parameters)
# telescope options =================================================
self.telescan = QtGui.QComboBox()
self.list_of_scan_options = ['2D Raster','1D Raster','1D Planet Raster','BowTie (constant el)','Pointing Cross','Watch']
self.telescan.addItems(self.list_of_scan_options)
self.numloop = QtGui.QLineEdit('2')
self.tel_delay = QtGui.QLineEdit('0')
self.init_tel = QtGui.QComboBox()
self.list_of_init_tels = ['No','Yes','Sim','Tracker']
self.init_tel.addItems(self.list_of_init_tels)
self.list_of_kms_onoffs = ['No','Yes']
self.kmsonofftext = QtGui.QComboBox()
self.kmsonofftext.addItems(self.list_of_kms_onoffs)
self.tel_sec = QtGui.QLineEdit('6')
self.tel_map_len = QtGui.QLineEdit('1')
self.tel_map_size = QtGui.QLineEdit('1')
self.tel_step = QtGui.QLineEdit('0.001')
self.tel_map_angle = QtGui.QLineEdit('0')
self.tel_coord1 = QtGui.QLineEdit()
self.tel_coord2 = QtGui.QLineEdit()
self.tel_epoch = QtGui.QComboBox()
self.list_of_epochs = ['J2000.0','Apparent']
self.tel_epoch.addItems(self.list_of_epochs)
self.tel_object = QtGui.QLineEdit('???')
self.unit1 = QtGui.QComboBox()
self.unit2 = QtGui.QComboBox()
self.unit3 = QtGui.QComboBox()
self.unit6 = QtGui.QComboBox()
self.list_of_angle_units = ['deg','arcsec','arcmin'] # Leave 'deg' as default
self.unit1.addItems(self.list_of_angle_units)
self.unit2.addItems(self.list_of_angle_units)
self.unit3.addItems(self.list_of_angle_units)
self.unit6.addItems(self.list_of_angle_units)
self.unit4 = QtGui.QComboBox()
self.list_of_coord1_options = ['RA','AZ']
self.unit4.addItems(self.list_of_coord1_options)
self.unit5 = QtGui.QComboBox()
self.list_of_coord2_options = ['DEC','ALT']
self.unit5.addItems(self.list_of_coord2_options)
self.map_space = QtGui.QComboBox()
self.list_of_map_space_options = ['RA','DEC','AZ','ALT']
self.map_space.addItems(self.list_of_map_space_options)
# RPK: implementing catalog tool
self.load_cat = QtGui.QComboBox()
self.load_cat.addItems(sorted([f for f in os.listdir(config_path) if fnmatch(f,'*.cat')]))
self.load_cat_button = QtGui.QPushButton('Load')
self.select_cat = QtGui.QComboBox()
self.select_cat_button = QtGui.QPushButton('Load')
self.telGroupBox = QtGui.QGroupBox()
self.telparams = QtGui.QFormLayout()
self.teltitle = QtGui.QLabel(self)
self.teltitle.setAlignment(QtCore.Qt.AlignCenter)
self.teltitle.setText('Telescope Parameters')
self.telparams.addRow(self.teltitle)
self.telparams.addRow('Activate Telescope', self.init_tel)
self.telparams.addRow('Activate KMS', self.kmsonofftext)
self.telparams.addRow('Scan Strategy', self.telescan)
self.telparams.addRow('Variable Coordinate', self.map_space)
self.telparams.addRow('Delayed Start (sec)', self.tel_delay)
self.telparams.addRow('Scan Traversal Time (sec)', self.tel_sec)
self.maplen_widget = QtGui.QHBoxLayout ()
self.maplen_widget.addWidget(self.tel_map_len)
self.maplen_widget.addWidget(self.unit6)
self.numloop_widget = QtGui.QHBoxLayout()
self.numloop_widget.addWidget(self.numloop)
self.telparams.addRow('Number of Scans (1D Only)',self.numloop_widget)