CStemplog.py
From Ug11bm
Jump to navigationJump to search
#!/APSshare/bin/python import sys import time import os import ca_util fp = open("CryoStat_Templog.txt",'a') #----- read temp -----# def readtemp(): temp1 = ca_util.caget("11bmb:ITC:S1_RBV") temp2 = ca_util.caget("11bmb:ITC:S2_RBV") temp3 = ca_util.caget("11bmb:ITC:S3_RBV") time.sleep(0.1) t1 = "%.2f" %temp1 t2 = "%.2f" %temp2 t3 = "%.2f" %temp3 sensortemps = " "+t1 + ", "+ t2 + ", "+ t3 return sensortemps #---------------------------# def readfile(): filename = ca_util.caget("11bmb:saveData_message") filename = filename.rstrip('mda') filename = "scan#: " + filename.strip('Wrote data to 11bmb_') return filename #---------------------------# # #def timestamp(): # timestr = time.strptime("%H") # return timestr # #---------------------------# def read2T(): tth = ca_util.caget("11bmb:m28.RBV") time.sleep(0.1) tth = "%.2f" %tth return tth #---------------------------# def monitor(): counts = ca_util.caget("11bmb:scaler1.S3") time.sleep(0.1) countsstring = "%.0f" %counts return countsstring #---------------------------# def EPICStime(): epicstime = ca_util.caget("S:IOC:timeOfDayForm2SI") time.sleep(0.1) return epicstime #---------------------------# n = 0 secs_start = time.time() fp.write("timestamp, mins elapsed, 2T, monitor, filename, S1, S2, S3\n") print("timestamp, mins elapsed, 2T, monitor, filename, S1, S2, S3") while n < 100000: n = n + 1 mins = (time.time() - secs_start)/60 elapsed = "%.2f" %mins log = EPICStime() + ', ' + elapsed + ', ' + read2T() + ', ' + monitor() + ', ' + readfile() + "," + readtemp() print log fp.write(log+"\n") time.sleep(10) print "\nDone -----------------------" fp.write("\nDone -----------------------") fp.close()