Example #1
0
def make_mock_table():
    cols = {"column0": [DOUBLE], "column1": [DOUBLE], "column2": [DOUBLE]}
    colstruct = OrderedDict(sorted(cols.items(), key=lambda t: t[0]))
    struct = OrderedDict([("labels", [STRING]), ("value", colstruct)])
    pvobj = PvObject(struct)
    pvobj.setScalarArray("labels", ["x", "y", "z"])
    return pvobj
Example #2
0
    def test_ScalarArray(self):
        value = TestUtility.getRandomInt()
        size = TestUtility.getRandomListSize()
        valueList = [value] * size
        pv = PvObject({'vl': [INT]}, {'vl': valueList})
        vl = pv['vl']
        assert (len(vl) == len(valueList))
        assert (vl[0] == valueList[0])
        assert (vl[-1] == valueList[-1])

        value = TestUtility.getRandomInt()
        size = TestUtility.getRandomListSize()
        valueList = [value] * size
        pv['vl'] = valueList
        vl = pv['vl']
        assert (len(vl) == len(valueList))
        assert (vl[0] == valueList[0])
        assert (vl[-1] == valueList[-1])

        value = TestUtility.getRandomInt()
        size = TestUtility.getRandomListSize()
        valueList = [value] * size
        pv.setScalarArray(valueList)
        vl = pv.getScalarArray()
        assert (len(vl) == len(valueList))
        assert (vl[0] == valueList[0])
        assert (vl[-1] == valueList[-1])
Example #3
0
from pvaccess import PvObject, STRING, DOUBLE, NtTable

import pvaccess

pvObject = PvObject({
    'labels': [STRING],
    'value': {
        'column0': [DOUBLE],
        'column1': [DOUBLE],
        'column2': [DOUBLE]
    }
})

pvObject.setScalarArray('labels', ['x', 'y', 'z'])
pvObject.setStructure(
    'value', {
        'column0': [0.1, 0.2, 0.3],
        'column1': [1.1, 1.2, 1.3],
        'column2': [2.1, 2.2, 2.3]
    })
table3 = NtTable(pvObject)

print table3

rpc = pvaccess.RpcClient('table')
request = table3

rpc.invoke(request)
Example #4
0
from pvaccess import PvObject, STRING, DOUBLE, NtTable

import pvaccess

pvObject = PvObject({'labels' : [STRING], 'value' : {'column0' : [DOUBLE], 'column1' : [DOUBLE], 'column2' : [DOUBLE]}})

pvObject.setScalarArray('labels', ['x', 'y', 'z'])
pvObject.setStructure('value', {'column0' : [0.1, 0.2, 0.3], 'column1' : [1.1, 1.2, 1.3], 'column2' : [2.1, 2.2, 2.3]})
table3 = NtTable(pvObject)

print table3

rpc = pvaccess.RpcClient('table')
request = table3

rpc.invoke(request)