Skip to content

add support to initialise NTTable like NTScalar#185

Open
KaiAsaoka wants to merge 5 commits into
epics-base:masterfrom
KaiAsaoka:feature/add_support_for_nttable_value
Open

add support to initialise NTTable like NTScalar#185
KaiAsaoka wants to merge 5 commits into
epics-base:masterfrom
KaiAsaoka:feature/add_support_for_nttable_value

Conversation

@KaiAsaoka
Copy link
Copy Markdown

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)],
    }
)

Copy link
Copy Markdown
Member

@mdavidsaver mdavidsaver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a reasonable addition overall. Please make the logging change.

Comment thread src/p4p/nt/__init__.py Outdated
@KaiAsaoka KaiAsaoka requested a review from mdavidsaver August 14, 2025 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants