Commit 4f79d184 authored by marc's avatar marc

added demo parameter to ignore telescope class and extended metadata

parent c5491a31
......@@ -88,7 +88,10 @@ class DTObservationProgram(Ui_mainWindow):
def __init__(self, mainWindow):
logger.info('Initialization of DTObsGUI')
self.myDT = telescope(setmode='J2000', consoleHost='consoledemo.dmz.camras.nl')
self.demo = config.getboolean('TestConfig','demo')
logging.debug('Demo status is: {}'.format(self.demo))
if self.demo == False:
self.myDT = telescope(setmode='J2000', consoleHost='consoledemo.dmz.camras.nl')
self.myMeas = Measurements()
self.myMetaData = MetaData()
......@@ -128,7 +131,7 @@ class DTObservationProgram(Ui_mainWindow):
indexNR+=1
self.threadpool = QThreadPool()
def openFileNameDialog(self):
'''
Clear tableWidget and read pointings from file
......@@ -136,6 +139,7 @@ class DTObservationProgram(Ui_mainWindow):
self.inputFile,_ = QFileDialog.getOpenFileName(None, 'Open File', "templates","Meas Files (*.dat);;All Files (*)")
if self.inputFile:
self.loadPointingsInTable(self.inputFile)
logging.info('Selected data file is: {}'.format(self.inputFile))
def loadPointingsInTable(self,fileName):
reader = csv.reader(open(self.inputFile),delimiter='\t')
......@@ -195,18 +199,19 @@ class DTObservationProgram(Ui_mainWindow):
def goToSetpoints(self, setpoints, oneSetpointCompleteSignal=None, progressSignal=None):
""" Send a list of setpoints to the telescope """
for setpoint_nr, setpoint in enumerate(setpoints):
self.myDT.setRaDec(setpoint)
oneSetpointCompleteSignal.emit(setpoint_nr, 'Slewing')
time.sleep(3)
dist = np.sqrt(self.myDT.dist_el**2+self.myDT.dist_az**2)
firstDist = dist
while not dist < 0.01*u.deg:
percentSlew = max(100 - dist/firstDist*100, 0)
progressSignal.emit(setpoint_nr, percentSlew, "{:.3f}°".format(dist.value))
#print("{:.3f}".format(dist))
#print("{:2.0f}".format(percentSlew.value))
self.myDT.getDistance(waitForUpdate=True)
if self.demo == False:
self.myDT.setRaDec(setpoint)
oneSetpointCompleteSignal.emit(setpoint_nr, 'Slewing')
time.sleep(3)
dist = np.sqrt(self.myDT.dist_el**2+self.myDT.dist_az**2)
firstDist = dist
while not dist < 0.01*u.deg:
percentSlew = max(100 - dist/firstDist*100, 0)
progressSignal.emit(setpoint_nr, percentSlew, "{:.3f}°".format(dist.value))
#print("{:.3f}".format(dist))
#print("{:2.0f}".format(percentSlew.value))
self.myDT.getDistance(waitForUpdate=True)
dist = np.sqrt(self.myDT.dist_el**2+self.myDT.dist_az**2)
oneSetpointCompleteSignal.emit(setpoint_nr, 'Measuring')
self.doMeasurement(setpoint_nr, progressSignal=progressSignal)
......@@ -236,7 +241,11 @@ class DTObservationProgram(Ui_mainWindow):
self.myMetaData.integrationTime = self.integrationTime
self.myMetaData.outputDirectory = self.outputDir
self.myMetaData.outputFile = self.outputFile
self.myMetaData.RaDEC = self.radec
self.myMetaData.radecSetpoint = self.radec
self.myMetaData.radecActual = self.radec
'''
TODO: read radec Actual from telescope class
'''
self.myMetaData.refractionEnabled = self.checkBoxRefraction.isChecked()
logging.debug('checkBoxRefraction Setting is {}:'.format(self.checkBoxRefraction.isChecked()))
self.myMetaData.DTModelEnabled = self.checkBoxDTModel.isChecked()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment