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 <2022> 2023 2024 2025 | 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 <2022> 2023 2024 2025 |
<== 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>, "Veseli, Sinisa" <sveseli at anl.gov> |
Date: | Thu, 11 Aug 2022 14:10:47 +0000 |
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 []
If you prefer the dot notation, this also works:
>>> nt2['value.column0'] = [1,2,3,5,6,7]
>>> nt2['value.column1'] = [1,2,3,5,6,7,8,9]
>>> print(nt2)
epics:nt/NTTable:1.0
string[] labels []
structure value
int[] column0 [1,2,3,5,6,7]
int[] column1 [1,2,3,5,6,7,8,9]
...
--
Siniša Veseli
Scientific Software Engineering & Data Management
Advanced Photon Source
Argonne National Laboratory
sveseli at anl.gov
(630)252-9182From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of Veseli, Sinisa via Tech-talk <tech-talk at aps.anl.gov>
Sent: Thursday, August 11, 2022 8:57 AM To: tech-talk at aps.anl.gov <tech-talk at aps.anl.gov>; Kuldeep Joshi <kuldeep.joshi at gmail.com> Subject: Re: pypva, PvObject and NTTable
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-9182From: 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.
On Thu, Aug 11, 2022 at 4:55 AM Kuldeep Joshi <kuldeep.joshi at gmail.com> wrote:
|