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
d75bca56
Commit
d75bca56
authored
Oct 09, 2017
by
marc
Browse files
store meas results into files
parent
e682f755
Changes
4
Hide whitespace changes
Inline
Side-by-side
DTObs.py
View file @
d75bca56
...
...
@@ -156,18 +156,40 @@ class DTObservationProgram(Ui_mainWindow):
def
doMeasurement
(
self
,
measnum
,
progressSignal
=
None
):
""" Dumping data into file including meta-data"""
print
(
"start dump-wide"
)
"""
Dumping data into file including meta-data
measProgramm: cli command read from comboBoxProgramma
integrationTime: string read from spinBoxIntTime
measprog: result of measurement of which
data: is the stdout result which need to be stored line by line
measFile: result file stroing the stdout results including meta data
"""
measFile
=
open
(
"Obs/DT-"
+
str
(
measnum
)
+
"-"
+
time
.
strftime
(
"%Y%m%d"
)
+
".dat"
,
'w'
)
print
(
"Output to file:"
,
measFile
)
integrationTime
=
self
.
spinBoxIntTime
.
value
()
#self.measprog = subprocess.Popen(["cat","/home_local/camrasdemo/test-001.txt"], stdout=subprocess.PIPE)
self
.
measprog
=
subprocess
.
Popen
([
"sleep"
,
str
(
integrationTime
)],
stdout
=
subprocess
.
PIPE
)
measProgramme
=
self
.
comboBoxProgramma
.
currentText
()
""" Write meta data into measFile"""
measFile
.
write
(
"#Time: "
+
time
.
strftime
(
"%h%m%s"
)
+
"
\n
"
)
measFile
.
write
(
"#Observer: CAMRAS
\n
"
)
measFile
.
write
(
"#RA: xyz
\n
"
)
measFile
.
write
(
"#Dec: xyz
\n
"
)
measFile
.
write
(
"#Integration time: "
+
str
(
integrationTime
)
+
"
\n
"
)
measFile
.
write
(
"#Programme: "
+
measProgramme
+
"
\n
"
)
self
.
measprog
=
subprocess
.
Popen
([
"cat"
,
"test.dat"
,
str
(
integrationTime
)],
stdout
=
subprocess
.
PIPE
)
for
sec
in
range
(
integrationTime
):
remainstring
=
str
(
int
((
integrationTime
-
sec
)
/
60
))
+
":"
remainstring
+=
"{:02}"
.
format
((
integrationTime
-
sec
)
%
60
)
progressSignal
.
emit
(
measnum
,
int
(
float
(
sec
)
/
integrationTime
*
100
),
remainstring
)
time
.
sleep
(
1
)
self
.
measprog
.
wait
()
data
=
self
.
measprog
.
stdout
measResults
=
self
.
measprog
.
stdout
""" Write results into file"""
for
line
in
measResults
:
measFile
.
write
(
str
(
line
))
measFile
.
close
()
def
startMeasurement
(
self
):
print
(
"Measurement started"
)
...
...
temp.dat
0 → 100644
View file @
d75bca56
0 4.992030787927024 37.76875
1 5.624550511490688 37.76875
2 6.257070235054353 37.76875
3 6.889589958618016 37.76875
4 7.52210968218168 37.76875
test.dat
0 → 100644
View file @
d75bca56
1 100
2 200
3 100
4 123
5 122
6 678
7 111
8 645
9 345
ui/__pycache__/dtobswindow.cpython-34.pyc
View file @
d75bca56
No preview for this file type
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