Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
marc
dtObsGUI
Commits
0ac2a6ce
Commit
0ac2a6ce
authored
Oct 29, 2017
by
marc
Browse files
included backend in DTObs
parent
bfcfd5a7
Changes
5
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
0ac2a6ce
telescope
measurements
ui/__pycache__
backend
metadata
ui/__pycache__/
DTObs.py
View file @
0ac2a6ce
...
...
@@ -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
.
myDT
=
telescope
(
setmode
=
'J2000'
,
consoleHost
=
'consoledemo.dmz.camras.nl'
)
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,26 +180,27 @@ 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
):
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
.
TelescopeEnabled
==
True
:
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
)
oneSetpointCompleteSignal
.
emit
(
setpoint_nr
,
'Completed'
)
...
...
@@ -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
):
...
...
@@ -257,10 +269,29 @@ class DTObservationProgram(Ui_mainWindow):
remainstring
+=
"{:02}"
.
format
((
self
.
integrationTime
-
sec
)
%
60
)
progressSignal
.
emit
(
measnum
,
int
(
float
(
sec
)
/
self
.
integrationTime
*
100
),
remainstring
)
time
.
sleep
(
1
)
measFile
.
close
()
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
)
...
...
dtobsgui.ini
View file @
0ac2a6ce
[Application]
LogLevel:
INFO
[TestConfig]
myDT:
False
\ No newline at end of file
ui/dtobswindow.py
View file @
0ac2a6ce
...
...
@@ -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
(
Tru
e
)
self
.
checkBoxHI
.
setChecked
(
Fals
e
)
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
.
checkBox
DTModel
.
setText
(
_translate
(
"mainWindow"
,
"Refraction enabled"
))
self
.
checkBox
RefractionEnabled
.
setText
(
_translate
(
"mainWindow"
,
"DT Model ena
g
led"
))
self
.
checkBox
Refraction
.
setText
(
_translate
(
"mainWindow"
,
"Refraction enabled"
))
self
.
checkBox
DTModel
.
setText
(
_translate
(
"mainWindow"
,
"DT Model ena
b
led"
))
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"
))
...
...
ui/dtobswindow.ui
View file @
0ac2a6ce
...
...
@@ -427,16 +427,16 @@
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_2"
>
<item>
<widget
class=
"QCheckBox"
name=
"checkBox
DTModel
"
>
<widget
class=
"QCheckBox"
name=
"checkBox
Refraction
"
>
<property
name=
"text"
>
<string>
Refraction enabled
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QCheckBox"
name=
"checkBox
RefractionEnabled
"
>
<widget
class=
"QCheckBox"
name=
"checkBox
DTModel
"
>
<property
name=
"text"
>
<string>
DT Model ena
g
led
</string>
<string>
DT Model ena
b
led
</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=
"checkBox
Pulsar
"
>
<widget
class=
"QCheckBox"
name=
"checkBox
SDR
"
>
<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>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment