Ejemplo n.º 1
0
 def init(self):
     self.connectCallbacksignal.connect(self.connectionCallback)
     self.monitorCallbacksignal.connect(self.monitorCallback)
     self.callbackDoneEvent = Event()
     self.callbackDoneEvent.set()
     self.channel = Channel(getDynamicRecordName())
     self.channel.setConnectionCallback(self.pvapyconnectioncallback)
Ejemplo n.º 2
0
 def start(self) :
     self.ctxt = Context('pva')
     self.firstCallback = True
     self.isClosed = False
     self.subscription = self.ctxt.monitor(
           getDynamicRecordName(),
           self.p4pcallback,
           request='field()',
           notify_disconnect=True)
Ejemplo n.º 3
0
    data.name = curveData["name"]
    data.computeLimits()
    print('name=', data.name, ' xmin=', data.xmin, ' xmax=', data.xmax,
          ' ymin=', data.ymin, ' ymax=', data.ymax)
    npts = len(x)
    timestart = time.time()
    for ind in range(npts):
        xarr = np.empty([ind])
        yarr = np.empty([ind])
        for i in range(ind):
            xarr[i] = x[i]
            yarr[i] = y[i]
        data.x = xarr
        data.y = yarr
        if ind == 0:
            putdata = {
                "name": data.name,
                "xmin": data.xmin,
                "xmax": data.xmax,
                "ymin": data.ymin,
                "ymax": data.ymax,
                "x": x,
                "y": y
            }
        else:
            putdata = {"x": xarr, "y": yarr}
        ctxt.put(getDynamicRecordName(), putdata)
    timenow = time.time()
    timediff = timenow - timestart
    print('putrate=', str(round(npts / timediff)), ' per second')
Ejemplo n.º 4
0
#!/usr/bin/env python
from Dynamic_Common import getAddRecordName,getDynamicRecordName
from p4p.client.thread import Context,Type,Value
import numpy as np
ctxt = Context('pva')
pvAddRecord = ctxt.get(getAddRecordName())
print('pvAddRecord=',pvAddRecord)

struct = Value(Type([
   ('name', 's'),
   ('x', 'ad'),
   ('y', 'ad'),
   ('xmin', 'd'),
   ('xmax', 'd'),
   ('ymin', 'd'),
   ('ymax', 'd'),
]))

pvAddRecord['argument']['recordName'] = getDynamicRecordName()
pvAddRecord['argument']['union'] = struct
ctxt.put(getAddRecordName(),pvAddRecord)


Ejemplo n.º 5
0
#!/usr/bin/env python
from Dynamic_Common import getAddRecordName, getDynamicRecordName
from pvaccess import *
import numpy as np

chan = Channel(getAddRecordName())
pvAddRecord = chan.get('field(argument)')
print('pvAddRecord=', pvAddRecord)
struct = PvObject(\
      {   'name':STRING\
          ,'x':[DOUBLE]\
          ,'y':[DOUBLE]\
          ,'xmin':DOUBLE\
          ,'xmax':DOUBLE\
          ,'ymin':DOUBLE\
          ,'ymax':DOUBLE\
      })
structValue = PvObject({'value': struct})
addRecordValue = PvObject({'argument': {'recordName': STRING, 'union': ()}})
addRecordValue['argument.union'] = structValue
chan = Channel("TPYaddRecord")
addRecordValue['argument.recordName'] = getDynamicRecordName()
result = chan.putGet(addRecordValue, 'putField(argument)getField(result)')
print(result)