Experimental Physics and
| |||||||||||||||||
|
Palak, If the idea is to capture values and timestamps for a few PVs to an external file outside of CSS, I would suggest using pyepics and a script like this:from time import sleep from epics import PV pvs = [PV('PVNAME1'), PV('PVNAME2'), PV('PVNAME3') fout = open('PVlist.txt', 'w') header = ['# Time '] for pv in pvs: header.append(pv.pvname) header = ' '.join(header) fout.write("%s\n" % header) while True: try: thisline = [str(datetime.now())] for pv in pvs: thisline.append(pv.get(as_ thisline = ' '.join(thisline) fout.write("%s\n" % thisline) fout.flush() sleep(0.01) except KeyboardInterrupt: break fout.close() #### You definitely want a short "sleep()" in your loop. If you're really worried about missing events (or if you're worried that you will be capturing too many repeated values) It might be better to use a more sophisticated approach using monitor callbacks so that values are written to a file every time they change, but only when they change. A few comments on your script: On Fri, Sep 30, 2016 at 12:47 AM, palak shimpee <[email protected]> wrote:
what is pv0, and for that matter what is TRUE?
what is pvs[1]?
redefining sys.stdout has the disadvantage that this is done for all output for the entire process. All you really want is to print some output to a file.
Hope that helps, --Matt Newville
| ||||||||||||||||
ANJ, 02 Oct 2016 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing · |