File: func_camonitor.py

package info (click to toggle)
python-pyepics 3.4.1%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,080 kB
  • sloc: python: 11,184; makefile: 106; javascript: 104; sh: 1
file content (32 lines) | stat: -rw-r--r-- 708 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from __future__ import print_function

import epics
import time
import pvnames
pvname1 = pvnames.updating_pvlist[0]
pvname2 = pvnames.updating_pvlist[1]

def wait(t=30):
    t0 = time.time()
    while time.time()-t0 < t:
        time.sleep(0.01)

def onChange(pvname,  value=None, char_value=None, timestamp=None, **kw):
    print('  new value: %s = %s (%s) ' % ( pvname, char_value, time.ctime(timestamp)))

epics.camonitor(pvname1, callback=onChange)
epics.camonitor(pvname2, callback=onChange)


print('## Monitor 2 PVs with epics.camonitor for 10sec')

wait(10)

print('## clear monitor for ', pvname2)

epics.camonitor_clear(pvname2)

print('## Monitor remaining PV for 10sec')
wait(10)

print('done!')