p4p
p4p copied to clipboard
add support to initialise NTTable like NTScalar
When initialising NTTable, it is assumed that the dict will only contain entries values and labels. NTTable is also unwrapped as an ordered dictionary, preventing its raw value from being accessed with commands such as pv.current().raw.get(...). This PR aims to make the NTTable implementation consistent with NTScalar and NTEnum (#154) by allowing NTTable to be initialised with other fields, and altering unwrap behaviour to return an ntwrappercommon object like NTScalar.
pv = SharedPV(
nt=NTTable(columns=[('idx', 'i'), ('units', 'd'), ('temperature', 'd')], display=True),
initial={
'display.description': "Table of values for instrument temperature curve."
'value': [{'idx': x, 'units': 0, 'temperature': 0} for x in range(1, 201)],
}
)