Improved snapshot interface with saving snapshot files in the OP configuration. Added app support for stabilizing XTCAV. Added a BSacquisition based on BSCache

This commit is contained in:
2023-07-05 09:16:18 +02:00
parent a54abd383e
commit 0c928a8bb1
7 changed files with 79 additions and 11 deletions

View File

@ -1,13 +1,12 @@
import numpy as np
import yaml
import os
import datetime
import epics
# things to do:
# 1. Read a snapshot file (not request file)
# 2. Save a snapshot file
# 3. add parameters and performance channels (e.g. AT photon energies)
# 2. add parameters and performance channels (e.g. AT photon energies)
def parseSnapShotReqYAML(filename):
# read the snapshot request file
@ -63,6 +62,18 @@ def getSnap(pvs=None):
epics.ca.clear_cache()
return ret
def saveSnap(pvs={},label="", comment = "generated by application"):
filename = datetime.datetime.now().strftime('/sf/data/applications/snapshot/SF_settings_%Y%m%d_%H%M%S.snap')
with open(filename,'w') as fid:
fid.write('#{"labels":["%s"],"comment":"%s", "machine_parms":{}, "save_time": 0.0, "req_file_name": "SF_settings.yaml"}\n' % (label,comment))
for key in pvs.keys():
if isinstance(pvs[key],int):
fid.write('%s,{"val": %d}\n' % (key,pvs[key]))
elif isinstance(pvs[key],float):
fid.write('%s,{"val": %f}\n' % (key,pvs[key]))
elif isinstance(pvs[key],str):
fid.write('%s,{"val": %s}\n' % (key,pvs[key]))