EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  <20222023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  <20222023  2024 
<== Date ==> <== Thread ==>

Subject: Re: pypva, PvObject and NTTable
From: "Veseli, Sinisa via Tech-talk" <tech-talk at aps.anl.gov>
To: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>, Kuldeep Joshi <kuldeep.joshi at gmail.com>
Date: Thu, 11 Aug 2022 13:57:08 +0000
Hi,

I want to use a different number of columns depending upon the user configuration.
I have the following queries

1) Can I change the structDict to another struct2Dict and update the PV. The API getIntrospectionDict or getStructureDict can only get the existing structure. Is there any API to modify/update the structure of the pv object at runtime?

You cannot change record structure definition at runtime, but you can easily remove old record and add new one:

>>> from pvapy import *
>>> nt = NtTable(3, DOUBLE)
>>> print(nt)
epics:nt/NTTable:1.0
    string[] labels []
    structure value
        double[] column0 []
        double[] column1 []
        double[] column2 []
    string descriptor
    alarm_t alarm
        int severity 0
        int status 0
        string message
    time_t timeStamp
        long secondsPastEpoch 0
        int nanoseconds 0
        int userTag 0

>>> s = PvaServer()
>>> s.addRecord('t', nt)
>>> c = Channel('t')
>>> pv = c.get()
>>> print(pv)
structure
    structure value
        double[] column0 []
        double[] column1 []
        double[] column2 []

>>> nt2 = NtTable(5, INT)
>>> s.update('t', nt2)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: structure definitions do not match

>>> s.removeRecord('t')
>>> s.addRecord('t', nt2)
>>> pv = c.get()
>>> print(pv)
structure
    structure value
        int[] column0 []
        int[] column1 []
        int[] column2 []
        int[] column3 []
        int[] column4 []


2) In the epics:nt/NTTable:1.0" object all the columns should have the same number of elements/rows. Is it possible to have different number elements/rows in different columns. Presently I am filling the empty ones with null string.

Yes, something like this will work:

>>> nt2.setColumn(1, [1,2,3])
>>> nt2.setColumn(2, [1,2,3,4,5,6])
>>> print(nt2)
epics:nt/NTTable:1.0
    string[] labels []
    structure value
        int[] column0 []
        int[] column1 [1,2,3]
        int[] column2 [1,2,3,4,5,6]
        int[] column3 []
        int[] column4 []

3) Is it possible to have the number of columns of the NTTable PvObject  to be programmable at run time. similar to as in C functions printf(char*, ...)

Yes, you can add/remove records at runtime, and hence you can change it however you like.

I hope this helps,

Sinisa

--
Siniša Veseli
Scientific Software Engineering & Data Management
Advanced Photon Source
Argonne National Laboratory
sveseli at anl.gov
(630)252-9182


From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of Kuldeep Joshi via Tech-talk <tech-talk at aps.anl.gov>
Sent: Thursday, August 11, 2022 6:35 AM
To: tech-talk at aps.anl.gov <tech-talk at aps.anl.gov>
Subject: Re: pypva, PvObject and NTTable
 
2) In the epics:nt/NTTable:1.0" object all the columns should have the same number of elements/rows. Is it possible to have different number elements/rows in different columns. Presently I am filling the empty ones with null string.

Regarding this point, it seems the limitation is due to the Phoebus table widget.



On Thu, Aug 11, 2022 at 4:55 AM Kuldeep Joshi <kuldeep.joshi at gmail.com> wrote:
Hello,
I am using a pypva server and publishing a NTTable object. This object is being displayed using the table widget of phoebus
   tablePV = PvObject(structDict, "epics:nt/NTTable:1.0")

I want to use a different number of columns depending upon the user configuration.
I have the following queries

1) Can I change the structDict to another struct2Dict and update the PV. The API getIntrospectionDict or getStructureDict can only get the existing structure. Is there any API to modify/update the structure of the pv object at runtime?

2) In the epics:nt/NTTable:1.0" object all the columns should have the same number of elements/rows. Is it possible to have different number elements/rows in different columns. Presently I am filling the empty ones with null string.

3) Is it possible to have the number of columns of the NTTable PvObject  to be programmable at run time. similar to as in C functions printf(char*, ...)

Presently I am deleting the PvObject and adding one with modified the structure Dictionary.

Thank you in advance.

Regards,
Kuldeep

Replies:
Re: pypva, PvObject and NTTable Veseli, Sinisa via Tech-talk
References:
pypva, PvObject and NTTable Kuldeep Joshi via Tech-talk
Re: pypva, PvObject and NTTable Kuldeep Joshi via Tech-talk

Navigate by Date:
Prev: Re: Scan overflow issue Ralph Lange via Tech-talk
Next: Re: pypva, PvObject and NTTable Veseli, Sinisa via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  <20222023  2024 
Navigate by Thread:
Prev: Re: pypva, PvObject and NTTable Kuldeep Joshi via Tech-talk
Next: Re: pypva, PvObject and NTTable Veseli, Sinisa via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  <20222023  2024 
ANJ, 14 Sep 2022 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·