Commit 192d741f authored by marc's avatar marc
Browse files

Merge branch 'master' of https://gitlab.camras.nl/marc/dtObsGUI

Conflicts:
	.gitignore
parents 55bbd683 421700d6
telescope telescope
Obs
ui/__pycache__ ui/__pycache__
...@@ -16,6 +16,7 @@ from PyQt5.QtWidgets import (QFileDialog, QApplication, QMainWindow, QTableWidge ...@@ -16,6 +16,7 @@ from PyQt5.QtWidgets import (QFileDialog, QApplication, QMainWindow, QTableWidge
from ui.dtobswindow import Ui_mainWindow from ui.dtobswindow import Ui_mainWindow
from telescope import telescope from telescope import telescope
from measurements import measurements
from astropy import units as u from astropy import units as u
from astropy.coordinates import SkyCoord from astropy.coordinates import SkyCoord
...@@ -81,6 +82,8 @@ class Worker(QRunnable): ...@@ -81,6 +82,8 @@ class Worker(QRunnable):
class DTObservationProgram(Ui_mainWindow): class DTObservationProgram(Ui_mainWindow):
def __init__(self, mainWindow): def __init__(self, mainWindow):
logging.info('Initialization of DTObsGUI') logging.info('Initialization of DTObsGUI')
self.myDT = telescope(setmode='J2000', consoleHost='consoledemo.dmz.camras.nl')
self.myMeas = measurements()
self.radec = None self.radec = None
Ui_mainWindow.__init__(self) Ui_mainWindow.__init__(self)
self.setupUi(mainWindow) self.setupUi(mainWindow)
...@@ -92,7 +95,13 @@ class DTObservationProgram(Ui_mainWindow): ...@@ -92,7 +95,13 @@ class DTObservationProgram(Ui_mainWindow):
self.pushButtonOutputDirectory.clicked.connect(self.selectOutputDirectory) self.pushButtonOutputDirectory.clicked.connect(self.selectOutputDirectory)
self.homedir = os.environ['HOME'] self.homedir = os.environ['HOME']
self.lineEditOutputDir.setText(self.homedir) self.lineEditOutputDir.setText(self.homedir)
self.myDT = telescope(setmode='J2000', consoleHost='consoledemo.dmz.camras.nl') '''
Read the available tools from measuremnet Class and store them in the
comboBoxProgramma for selection.
'''
indexNR=0
for tool in self.myMeas.getTools():
self.comboBoxProgramma.setItemText(indexNR, tool)
self.threadpool = QThreadPool() self.threadpool = QThreadPool()
...@@ -137,7 +146,7 @@ class DTObservationProgram(Ui_mainWindow): ...@@ -137,7 +146,7 @@ class DTObservationProgram(Ui_mainWindow):
def allCompleted(self): def allCompleted(self):
""" Callback function when all pointings completed """ """ Callback function when all pointings completed """
print("All pointings completed") loging.info("All pointings completed")
def measCompleted(self, meas_num, status): def measCompleted(self, meas_num, status):
""" Make the meas_num-th row of the table green """ """ Make the meas_num-th row of the table green """
...@@ -185,7 +194,7 @@ class DTObservationProgram(Ui_mainWindow): ...@@ -185,7 +194,7 @@ class DTObservationProgram(Ui_mainWindow):
def doMeasurement(self, measnum, progressSignal=None): def doMeasurement(self, measnum, progressSignal=None):
""" """
Dumping data into file including meta-data Dumping data into file including meta-data
measProgramm: cli command read from comboBoxProgramma measProgramme: cli command read from comboBoxProgramma
integrationTime: string read from spinBoxIntTime integrationTime: string read from spinBoxIntTime
measurement: result of measurement of which measurement: result of measurement of which
data: is the stdout result which need to be stored line by line data: is the stdout result which need to be stored line by line
...@@ -195,30 +204,16 @@ class DTObservationProgram(Ui_mainWindow): ...@@ -195,30 +204,16 @@ class DTObservationProgram(Ui_mainWindow):
measProgramme = self.comboBoxProgramma.currentText() measProgramme = self.comboBoxProgramma.currentText()
outputDir = self.lineEditOutputDir.text() outputDir = self.lineEditOutputDir.text()
measFile = open(outputDir + '/DT-' + '{:03d}'.format(measnum) + "-" + time.strftime("%Y%m%d") + ".dat",'w') measFile = open(outputDir + '/DT-' + '{:03d}'.format(measnum) + "-" + time.strftime("%Y%m%d") + ".dat",'w')
print("Output to file:", measFile) logging.info("Output to file: {}".format(measFile))
""" Write meta data into measFile"""
measFile.write("#Observer: CAMRAS\n")
measFile.write("#Date: " + time.strftime("%Y%m%d-%h%m%s") + "\n")
measFile.write("#RA: xyz\n")
measFile.write("#Dec: xyz\n")
measFile.write("#Integration time: " + str(integrationTime) + "\n")
measFile.write("#Programme: " + measProgramme + "\n")
measCLI = measProgramme +" "+ str(integrationTime)
logging.info(measCLI) logging.info(measCLI)
print(measCLI) myMeas.startMeasurement(measProgramme, integrationTime, measFile, metaData=None)
self.measurement = subprocess.Popen(measProgramme, stdout=subprocess.PIPE)
for sec in range(integrationTime): for sec in range(integrationTime):
remainstring = str(int((integrationTime-sec)/60)) + ":" remainstring = str(int((integrationTime-sec)/60)) + ":"
remainstring += "{:02}".format((integrationTime-sec)%60) remainstring += "{:02}".format((integrationTime-sec)%60)
progressSignal.emit(measnum, int(float(sec)/integrationTime*100), remainstring) progressSignal.emit(measnum, int(float(sec)/integrationTime*100), remainstring)
time.sleep(1) time.sleep(1)
self.measurement.wait() self.measurement.wait()
measResults = self.measurement.stdout
""" Write results into file"""
for line in measResults:
measFile.write(str(line))
measFile.close() measFile.close()
def startMeasurement(self): def startMeasurement(self):
......
...@@ -49,7 +49,7 @@ class Ui_mainWindow(object): ...@@ -49,7 +49,7 @@ class Ui_mainWindow(object):
self.gridLayout.addWidget(self.pushButtonStopMeasurement, 8, 0, 1, 1) self.gridLayout.addWidget(self.pushButtonStopMeasurement, 8, 0, 1, 1)
self.tableWidgetPointings = QtWidgets.QTableWidget(self.centralwidget) self.tableWidgetPointings = QtWidgets.QTableWidget(self.centralwidget)
self.tableWidgetPointings.setObjectName("tableWidgetPointings") self.tableWidgetPointings.setObjectName("tableWidgetPointings")
self.tableWidgetPointings.setColumnCount(3) self.tableWidgetPointings.setColumnCount(4)
self.tableWidgetPointings.setRowCount(0) self.tableWidgetPointings.setRowCount(0)
item = QtWidgets.QTableWidgetItem() item = QtWidgets.QTableWidgetItem()
item.setTextAlignment(QtCore.Qt.AlignCenter) item.setTextAlignment(QtCore.Qt.AlignCenter)
...@@ -75,6 +75,14 @@ class Ui_mainWindow(object): ...@@ -75,6 +75,14 @@ class Ui_mainWindow(object):
item.setFont(font) item.setFont(font)
item.setBackground(QtGui.QColor(255, 170, 127)) item.setBackground(QtGui.QColor(255, 170, 127))
self.tableWidgetPointings.setHorizontalHeaderItem(2, item) self.tableWidgetPointings.setHorizontalHeaderItem(2, item)
item = QtWidgets.QTableWidgetItem()
item.setTextAlignment(QtCore.Qt.AlignCenter)
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
item.setFont(font)
item.setBackground(QtGui.QColor(255, 170, 127))
self.tableWidgetPointings.setHorizontalHeaderItem(3, item)
self.gridLayout.addWidget(self.tableWidgetPointings, 6, 1, 1, 1) self.gridLayout.addWidget(self.tableWidgetPointings, 6, 1, 1, 1)
self.toolBox = QtWidgets.QToolBox(self.centralwidget) self.toolBox = QtWidgets.QToolBox(self.centralwidget)
self.toolBox.setEnabled(True) self.toolBox.setEnabled(True)
...@@ -83,7 +91,7 @@ class Ui_mainWindow(object): ...@@ -83,7 +91,7 @@ class Ui_mainWindow(object):
self.toolBox.setFrameShape(QtWidgets.QFrame.NoFrame) self.toolBox.setFrameShape(QtWidgets.QFrame.NoFrame)
self.toolBox.setObjectName("toolBox") self.toolBox.setObjectName("toolBox")
self.toolBoxMetaData = QtWidgets.QWidget() self.toolBoxMetaData = QtWidgets.QWidget()
self.toolBoxMetaData.setGeometry(QtCore.QRect(0, 0, 96, 26)) self.toolBoxMetaData.setGeometry(QtCore.QRect(0, 0, 280, 426))
self.toolBoxMetaData.setObjectName("toolBoxMetaData") self.toolBoxMetaData.setObjectName("toolBoxMetaData")
self.groupBox_3 = QtWidgets.QGroupBox(self.toolBoxMetaData) self.groupBox_3 = QtWidgets.QGroupBox(self.toolBoxMetaData)
self.groupBox_3.setGeometry(QtCore.QRect(10, 10, 271, 351)) self.groupBox_3.setGeometry(QtCore.QRect(10, 10, 271, 351))
...@@ -159,7 +167,7 @@ class Ui_mainWindow(object): ...@@ -159,7 +167,7 @@ class Ui_mainWindow(object):
self.verticalLayout_2.addWidget(self.checkBoxCorrection) self.verticalLayout_2.addWidget(self.checkBoxCorrection)
self.toolBox.addItem(self.toolBoxMeasurement, "") self.toolBox.addItem(self.toolBoxMeasurement, "")
self.toolBoxBackEnd = QtWidgets.QWidget() self.toolBoxBackEnd = QtWidgets.QWidget()
self.toolBoxBackEnd.setGeometry(QtCore.QRect(0, 0, 96, 26)) self.toolBoxBackEnd.setGeometry(QtCore.QRect(0, 0, 280, 426))
self.toolBoxBackEnd.setObjectName("toolBoxBackEnd") self.toolBoxBackEnd.setObjectName("toolBoxBackEnd")
self.groupBox = QtWidgets.QGroupBox(self.toolBoxBackEnd) self.groupBox = QtWidgets.QGroupBox(self.toolBoxBackEnd)
self.groupBox.setEnabled(True) self.groupBox.setEnabled(True)
...@@ -309,6 +317,8 @@ class Ui_mainWindow(object): ...@@ -309,6 +317,8 @@ class Ui_mainWindow(object):
item.setText(_translate("mainWindow", "Dec")) item.setText(_translate("mainWindow", "Dec"))
item = self.tableWidgetPointings.horizontalHeaderItem(2) item = self.tableWidgetPointings.horizontalHeaderItem(2)
item.setText(_translate("mainWindow", "Status")) item.setText(_translate("mainWindow", "Status"))
item = self.tableWidgetPointings.horizontalHeaderItem(3)
item.setText(_translate("mainWindow", "Result File"))
self.groupBox_3.setTitle(_translate("mainWindow", "GroupBox")) self.groupBox_3.setTitle(_translate("mainWindow", "GroupBox"))
self.label_5.setText(_translate("mainWindow", "Observer(s):")) self.label_5.setText(_translate("mainWindow", "Observer(s):"))
self.label_8.setText(_translate("mainWindow", "Desciption: ")) self.label_8.setText(_translate("mainWindow", "Desciption: "))
......
...@@ -175,6 +175,27 @@ ...@@ -175,6 +175,27 @@
</color> </color>
</property> </property>
</column> </column>
<column>
<property name="text">
<string>Result File</string>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="textAlignment">
<set>AlignCenter</set>
</property>
<property name="background">
<color>
<red>255</red>
<green>170</green>
<blue>127</blue>
</color>
</property>
</column>
</widget> </widget>
</item> </item>
<item row="6" column="0"> <item row="6" column="0">
...@@ -205,8 +226,8 @@ ...@@ -205,8 +226,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>96</width> <width>280</width>
<height>26</height> <height>426</height>
</rect> </rect>
</property> </property>
<attribute name="label"> <attribute name="label">
...@@ -404,8 +425,8 @@ ...@@ -404,8 +425,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>96</width> <width>280</width>
<height>26</height> <height>426</height>
</rect> </rect>
</property> </property>
<attribute name="label"> <attribute name="label">
......
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