Commit d75bca56 authored by marc's avatar marc
Browse files

store meas results into files

parent e682f755
......@@ -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")
......
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
1 100
2 200
3 100
4 123
5 122
6 678
7 111
8 645
9 345
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