Commit 0ac2a6ce authored by marc's avatar marc
Browse files

included backend in DTObs

parent bfcfd5a7
telescope
measurements
ui/__pycache__
backend
metadata
ui/__pycache__/
......@@ -21,6 +21,7 @@ from astropy.coordinates import SkyCoord
from telescope import telescope
from measurements import Measurements
from metadata import MetaData
from backend import Backend
'''
Setup config ini
......@@ -87,15 +88,20 @@ class DTObservationProgram(Ui_mainWindow):
def __init__(self, mainWindow):
logger.info('Initialization of DTObsGUI')
self.TelescopeEnabled = config.get('TestConfig','myDT')
if self.TelescopeEnabled == True:
self.myDT = telescope(setmode='J2000', consoleHost='consoledemo.dmz.camras.nl')
self.myMeas = Measurements()
self.myMetaData = MetaData()
self.myBackend = Backend(setmode='Pulsar')
self.radec = None
self.measProgramma = None
self.integrationTime = None
self.outputDir = None
self.outputFile = None
self.GUIbackendMode = None
Ui_mainWindow.__init__(self)
self.setupUi(mainWindow)
......@@ -107,6 +113,7 @@ class DTObservationProgram(Ui_mainWindow):
self.pushButtonOutputDirectory.clicked.connect(self.selectOutputDirectory)
self.homedir = os.environ['HOME']
self.lineEditOutputDir.setText(self.homedir)
'''
Read the available tools from measurement Class and store them in the
comboBoxProgramma for selection.
......@@ -173,13 +180,14 @@ class DTObservationProgram(Ui_mainWindow):
'''
#self.tableWidgetPointings.item(meas_num, 3).setText(measFile.name))
for column in range(4):
for column in range(3):
self.tableWidgetPointings.item(meas_num,column).setBackground(colors[status])
self.tableWidgetPointings.resizeColumnsToContents()
def goToSetpoints(self, setpoints, oneSetpointCompleteSignal=None, progressSignal=None):
""" Send a list of setpoints to the telescope """
for setpoint_nr, setpoint in enumerate(setpoints):
if self.TelescopeEnabled == True:
self.myDT.setRaDec(setpoint)
oneSetpointCompleteSignal.emit(setpoint_nr, 'Slewing')
time.sleep(3)
......@@ -222,12 +230,16 @@ class DTObservationProgram(Ui_mainWindow):
self.myMetaData.outputDirectory = self.outputDir
self.myMetaData.outputFile = self.outputFile
self.myMetaData.RaDEC = self.radec
self.myMetaData.refactionEnabled = self.checkBoxRefractionEnabled.checkStateSet()
self.myMetaData.DTModelEnabled = self.checkBoxDTModel.checkStateSet()
self.myMetaData.refractionEnabled = self.checkBoxRefraction.isChecked()
logging.debug('checkBoxRefraction Setting is {}:'.format(self.checkBoxRefraction.isChecked()))
self.myMetaData.DTModelEnabled = self.checkBoxDTModel.isChecked()
self.myMetaData.mode = self.GUIbackendMode
self.myMetaData.LSREnabled = self.radioButtonLSR.isChecked()
def writeMetaData(self,file):
for key, value in self.myMetaData.getMetaData().items():
file.write('#' + str(key) + '\t' + str(value) + '\n')
#file.write('#' + str(key) + ':' + '\t' + str(value) + '\n')
file.write('#key: {}\t value: {}\n'.format(key,value))
logging.info('#key: {}\t value: {}'.format(key,value))
def doMeasurement(self, measnum, progressSignal=None):
......@@ -259,8 +271,27 @@ class DTObservationProgram(Ui_mainWindow):
time.sleep(1)
measFile.close()
def readGUIBackendMode(self):
'''
Read the selected Backend mode from the GUI backend checkbox group
'''
if self.checkBoxPulsar.isChecked():
self.GUIbackendMode = 'Pulsar'
if self.checkBoxHI.isChecked():
self.GUIbackendMode = 'Hydrogen'
if self.checkBoxSDR.isChecked():
self.GUIbackendMode = 'SDR'
if self.checkBoxRaw.isChecked():
self.GUIbackendMode = 'Raw'
def startMeasurement(self):
print("Measurement started")
'''
Put backend in proper mode
'''
logging.info('Start Measurement')
self.readGUIBackendMode()
self.myBackend.setMode(self.GUIbackendMode)
setpoints = []
for meas in range(0,self.tableWidgetPointings.rowCount()):
ra = self.tableWidgetPointings.item(meas, 0).text()
......@@ -278,7 +309,7 @@ class DTObservationProgram(Ui_mainWindow):
self.threadpool.start(worker)
def stopMeasurement(self):
print("Measurement stopped")
logging.info("Measurement stopped")
if __name__ == '__main__':
app = QApplication(sys.argv)
......
[Application]
LogLevel: INFO
[TestConfig]
myDT: False
\ No newline at end of file
......@@ -171,12 +171,12 @@ class Ui_mainWindow(object):
self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.checkBoxRefraction = QtWidgets.QCheckBox(self.verticalLayoutWidget)
self.checkBoxRefraction.setObjectName("checkBoxRefraction")
self.verticalLayout_2.addWidget(self.checkBoxRefraction)
self.checkBoxDTModel = QtWidgets.QCheckBox(self.verticalLayoutWidget)
self.checkBoxDTModel.setObjectName("checkBoxDTModel")
self.verticalLayout_2.addWidget(self.checkBoxDTModel)
self.checkBoxRefractionEnabled = QtWidgets.QCheckBox(self.verticalLayoutWidget)
self.checkBoxRefractionEnabled.setObjectName("checkBoxRefractionEnabled")
self.verticalLayout_2.addWidget(self.checkBoxRefractionEnabled)
self.toolBox.addItem(self.toolBoxMeasurement, "")
self.toolBoxBackEnd = QtWidgets.QWidget()
self.toolBoxBackEnd.setGeometry(QtCore.QRect(0, 0, 280, 426))
......@@ -191,9 +191,14 @@ class Ui_mainWindow(object):
self.horizontalLayout.setObjectName("horizontalLayout")
self.verticalLayout = QtWidgets.QVBoxLayout()
self.verticalLayout.setObjectName("verticalLayout")
self.checkBoxPulsar = QtWidgets.QCheckBox(self.groupBox)
self.checkBoxPulsar.setChecked(True)
self.checkBoxPulsar.setAutoExclusive(True)
self.checkBoxPulsar.setObjectName("checkBoxPulsar")
self.verticalLayout.addWidget(self.checkBoxPulsar)
self.checkBoxHI = QtWidgets.QCheckBox(self.groupBox)
self.checkBoxHI.setEnabled(True)
self.checkBoxHI.setChecked(True)
self.checkBoxHI.setChecked(False)
self.checkBoxHI.setAutoExclusive(True)
self.checkBoxHI.setObjectName("checkBoxHI")
self.verticalLayout.addWidget(self.checkBoxHI)
......@@ -201,10 +206,6 @@ class Ui_mainWindow(object):
self.checkBoxSDR.setAutoExclusive(True)
self.checkBoxSDR.setObjectName("checkBoxSDR")
self.verticalLayout.addWidget(self.checkBoxSDR)
self.checkBoxPulsar = QtWidgets.QCheckBox(self.groupBox)
self.checkBoxPulsar.setAutoExclusive(True)
self.checkBoxPulsar.setObjectName("checkBoxPulsar")
self.verticalLayout.addWidget(self.checkBoxPulsar)
self.checkBoxRaw = QtWidgets.QCheckBox(self.groupBox)
self.checkBoxRaw.setAutoExclusive(True)
self.checkBoxRaw.setTristate(False)
......@@ -346,14 +347,14 @@ class Ui_mainWindow(object):
self.comboBoxProgramma.setItemText(3, _translate("mainWindow", "rawrecord"))
self.label_3.setText(_translate("mainWindow", " Integration Time: "))
self.pushButtonOutputDirectory.setText(_translate("mainWindow", "Output Dir"))
self.checkBoxDTModel.setText(_translate("mainWindow", "Refraction enabled"))
self.checkBoxRefractionEnabled.setText(_translate("mainWindow", "DT Model enagled"))
self.checkBoxRefraction.setText(_translate("mainWindow", "Refraction enabled"))
self.checkBoxDTModel.setText(_translate("mainWindow", "DT Model enabled"))
self.toolBox.setItemText(self.toolBox.indexOf(self.toolBoxMeasurement), _translate("mainWindow", "Measurement Settings"))
self.groupBox.setTitle(_translate("mainWindow", "Mode"))
self.checkBoxPulsar.setText(_translate("mainWindow", "Pulsar (default)"))
self.checkBoxHI.setText(_translate("mainWindow", "Hydrogen Line"))
self.checkBoxSDR.setText(_translate("mainWindow", "SDR Mode"))
self.checkBoxPulsar.setText(_translate("mainWindow", "Pulsar Mode"))
self.checkBoxRaw.setText(_translate("mainWindow", "Raw Mode"))
self.checkBoxSDR.setText(_translate("mainWindow", "Software Defined Radio"))
self.checkBoxRaw.setText(_translate("mainWindow", "Raw"))
self.radioButtonLSR.setText(_translate("mainWindow", "Local &Standard of Rest Compensation"))
self.toolBox.setItemText(self.toolBox.indexOf(self.toolBoxBackEnd), _translate("mainWindow", "BackEnd Settings"))
self.menuFile.setTitle(_translate("mainWindow", "Fi&le"))
......
......@@ -427,16 +427,16 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QCheckBox" name="checkBoxDTModel">
<widget class="QCheckBox" name="checkBoxRefraction">
<property name="text">
<string>Refraction enabled</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxRefractionEnabled">
<widget class="QCheckBox" name="checkBoxDTModel">
<property name="text">
<string>DT Model enagled</string>
<string>DT Model enabled</string>
</property>
</widget>
</item>
......@@ -484,12 +484,9 @@
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="checkBoxHI">
<property name="enabled">
<bool>true</bool>
</property>
<widget class="QCheckBox" name="checkBoxPulsar">
<property name="text">
<string>Hydrogen Line</string>
<string>Pulsar (default)</string>
</property>
<property name="checked">
<bool>true</bool>
......@@ -500,9 +497,15 @@
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxSDR">
<widget class="QCheckBox" name="checkBoxHI">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>SDR Mode</string>
<string>Hydrogen Line</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="autoExclusive">
<bool>true</bool>
......@@ -510,9 +513,9 @@
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxPulsar">
<widget class="QCheckBox" name="checkBoxSDR">
<property name="text">
<string>Pulsar Mode</string>
<string>Software Defined Radio</string>
</property>
<property name="autoExclusive">
<bool>true</bool>
......@@ -522,7 +525,7 @@
<item>
<widget class="QCheckBox" name="checkBoxRaw">
<property name="text">
<string>Raw Mode</string>
<string>Raw</string>
</property>
<property name="autoExclusive">
<bool>true</bool>
......
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