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  <20202021  2022  2023  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  <20202021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Displaying string Waveform in CaQtDM
From: Jaroslav Adam via Tech-talk <tech-talk at aps.anl.gov>
To: "Johnson, Andrew N." <anj at anl.gov>
Cc: EPICS tech-talk <tech-talk at aps.anl.gov>
Date: Tue, 19 May 2020 22:53:57 -0400 (EDT)
Hi all,

the waveform must be of type FTVL="CHAR" like this:

  myW = builder.Waveform("myW",length=999, FTVL="CHAR")


Then after iocInit is is possible to do:

  msg = "This is a long string that is supposed to exceed 40 characters in length"

  myW.set(numpy.array([ord(i) for i in msg]))

Please note the ord() function to convert to ascii numbers.


And then it is seen by caget:

  $ caget -S myW
  myW This is a long string that is supposed to exceed 40 characters in length


For caput to work the waveform would have to be of out type, builder.WaveformOut


Hope it helps, cheers,
Jarda


On Tue, 19 May 2020, Johnson, Andrew N. via Tech-talk wrote:

Okay, now that you have an empty array try writing to it and see how caQtDm displays the result:
caput -S name "This is a long string that is supposed to exceed 40 characters in length"

- Andrew


      On May 19, 2020, at 4:57 PM, Paul Nord via Tech-talk <tech-talk at aps.anl.gov> wrote:

Good thought, Andrew.

I changed np.str to np.uint8 and now I get:

caget -S name
name
$ cainfo name
name
    State:            connected
    Host:             xyzzy.gov:5064
    Access:           read, write
    Native data type: DBF_CHAR
    Request type:     DBR_CHAR
    Element count:    999


On Tue, May 19, 2020 at 4:47 PM Johnson, Andrew N. <anj at anl.gov> wrote:
      I agree with Mark, I suspect the problem is the datatype you’re giving the waveform, i.e. this:
      a_PV = builder.Waveform("name",length=999,datatype=np.str)


That np.str should probably be some kind of a character type, not a string type.

Most EPICS developers don’t use the python softioc builder so we don’t recognize what that’s doing very well.

- Andrew




      On May 19, 2020, at 4:43 PM, Mark Rivers via Tech-talk <tech-talk at aps.anl.gov> wrote:

OK, so it looks like the problem is the server, not the client.  caget and caQtDM agree, correct?
 
What does cainfo show?
 
Mark
 
 
From: Tech-talk <tech-talk-bounces at aps.anl.gov> On Behalf Of Paul Nord via Tech-talk
Sent: Tuesday, May 19, 2020 4:35 PM
To: tech-talk <tech-talk at aps.anl.gov>
Subject: Re: Displaying string Waveform in CaQtDM
 
That's exactly the same.

$ caget -S name
name 999                                                                                                                      
                                                                                                                             
                                                                                                                             
                                                                                                                             
                                                                                                                             
                                                                                                                             
                                                                                                                             
                                                                                                                            
$ 
 
On Tue, May 19, 2020 at 4:31 PM Mark Rivers <rivers at cars.uchicago.edu> wrote:
      You used a lowercase –s, it should be uppercase.
 
caget –S name
 
Mark
 
 
From: Tech-talk <tech-talk-bounces at aps.anl.gov> On Behalf Of Paul Nord via Tech-talk
Sent: Tuesday, May 19, 2020 4:26 PM
To: EPICS tech-talk <tech-talk at aps.anl.gov>
Subject: Re: Displaying string Waveform in CaQtDM
 
$ caget -s name
name 999                                                                                                                
                                                                                                                       
                                                                                                                       
                                                                                                                       
                                                                                                                       
                                                                                                                       
                                                                                                                       
                                                                                                                       
                                              
$
 
It appears that there are probably 999 blank spaces.
 
Paul
 
 
On Tue, May 19, 2020 at 4:17 PM Mark Rivers <rivers at cars.uchicago.edu> wrote:

      What happens if you do:

      caget -S name

      from the Linux or Windows shell?

      Mark


      ________________________________
      From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of Paul Nord via Tech-talk <tech-talk at aps.anl.gov>
      Sent: Tuesday, May 19, 2020 3:59 PM
      To: EPICS tech-talk
      Subject: Re: Displaying string Waveform in CaQtDM

      Thanks, Mark.

      But that doesn't work.  I don't see any of my text appear.

      Is there an example using the python ioc that works?

      Or, can you make a CaQtDM window work with the code I included?

      Paul


      On Tue, May 19, 2020 at 1:44 PM Mark Rivers <rivers at cars.uchicago.edu<mailto:rivers at cars.uchicago.edu>>
      wrote:
      Hi Paul,


      areaDetector has lots of caQtDM files that are autoconverted from medm.  These can display waveforms as
      strings.


      This is an example of a text entry widget to input the file path from
      areaDetector/ADCore/ADApp/op/ui/autoconvert/NDFileBase.ui.


              <widget class="caTextEntry" name="caTextEntry_3">
                  <property name="geometry">
                      <rect>
                          <x>166</x>
                          <y>33</y>
                          <width>500</width>
                          <height>20</height>
                      </rect>
                  </property>
                  <property name="fontScaleMode">
                      <enum>caLineEdit::WidthAndHeight</enum>
                  </property>
                  <property name="channel">
                      <string>$(P)$(R)FilePath</string>
                  </property>
                  <property name="foreground">
                      <color alpha="255">
                          <red>0</red>
                          <green>0</green>
                          <blue>0</blue>
                      </color>
                  </property>
                  <property name="background">
                      <color alpha="255">
                          <red>115</red>
                          <green>223</green>
                          <blue>255</blue>
                      </color>
                  </property>
                  <property name="limitsMode">
                      <enum>caLineEdit::Channel</enum>
                  </property>
                  <property name="limitsMode">
                      <enum>caLineEdit::Channel</enum>
                  </property>
                  <property name="precisionMode">
                      <enum>caLineEdit::Channel</enum>
                  </property>
                  <property name="minValue">
                      <double>0.0</double>
                  </property>
                  <property name="maxValue">
                      <double>1.0</double>
                  </property>
                  <property name="colorMode">
                      <enum>caLineEdit::Static</enum>
                  </property>
                  <property name="formatType">
                      <enum>string</enum>
                  </property>
              </widget>

      The readback field (non-editable) is generated as this:

              <widget class="caLineEdit" name="caLineEdit_5">
                  <property name="geometry">
                      <rect>
                          <x>166</x>
                          <y>10</y>
                          <width>385</width>
                          <height>18</height>
                      </rect>
                  </property>
                  <property name="fontScaleMode">
                      <enum>caLineEdit::WidthAndHeight</enum>
                  </property>
                  <property name="channel">
                      <string>$(P)$(R)FilePath_RBV</string>
                  </property>
                  <property name="foreground">
                      <color alpha="255">
                          <red>10</red>
                          <green>0</green>
                          <blue>184</blue>
                      </color>
                  </property>
                  <property name="background">
                      <color alpha="255">
                          <red>187</red>
                          <green>187</green>
                          <blue>187</blue>
                      </color>
                  </property>
                  <property name="limitsMode">
                      <enum>caLineEdit::Channel</enum>
                  </property>
                  <property name="limitsMode">
                      <enum>caLineEdit::Channel</enum>
                  </property>
                  <property name="precisionMode">
                      <enum>caLineEdit::Channel</enum>
                  </property>
                  <property name="minValue">
                      <double>0.0</double>
                  </property>
                  <property name="maxValue">
                      <double>1.0</double>
                  </property>
                  <property name="alignment">
                      <set>Qt::AlignAbsolute|Qt::AlignLeft|Qt::AlignVCenter</set>
                  </property>
                  <property name="formatType">
                      <enum>string</enum>
                  </property>
                  <property name="colorMode">
                      <enum>caLineEdit::Static</enum>
                  </property>
              </widget>

      Mark





      ________________________________
      From: Tech-talk <tech-talk-bounces at aps.anl.gov<mailto:tech-talk-bounces at aps.anl.gov>> on behalf of Paul Nord
      via Tech-talk <tech-talk at aps.anl.gov<mailto:tech-talk at aps.anl.gov>>
      Sent: Tuesday, May 19, 2020 1:21 PM
      To: tech-talk at aps.anl.gov<mailto:tech-talk at aps.anl.gov>
      Subject: Displaying string Waveform in CaQtDM

      I'm stumped on finding a working example.

      I would like to put a long text string into a waveform PV and simply display it using CaQtDM.  I believe
      that I've got the string working since I can access it from other parts of the program.  The
      caMultiLineString widget suggests that it can display a waveform character string as text.  But it's not
      working out.

      I'm using the python softioc builder.

      from softioc import builder
      import numpy as np
      a_PV = builder.Waveform("name",length=999,datatype=np.str)
      a_PV.set("This is some text")
      print(bytes(bytearray(a_PV.get())).decode('ascii'))

      But it's not clear how to make that string display in CaQtDM.

      Any suggestions?  Is there a complete example I could look at?

      Paul


-- 
Complexity comes for free, simplicity you have to work for.


-- 
Complexity comes for free, simplicity you have to work for.



Replies:
Re: Displaying string Waveform in CaQtDM Paul Nord via Tech-talk
References:
Displaying string Waveform in CaQtDM Paul Nord via Tech-talk
Re: Displaying string Waveform in CaQtDM Mark Rivers via Tech-talk
Re: Displaying string Waveform in CaQtDM Paul Nord via Tech-talk
Re: Displaying string Waveform in CaQtDM Mark Rivers via Tech-talk
Re: Displaying string Waveform in CaQtDM Paul Nord via Tech-talk
RE: Displaying string Waveform in CaQtDM Mark Rivers via Tech-talk
Re: Displaying string Waveform in CaQtDM Paul Nord via Tech-talk
RE: Displaying string Waveform in CaQtDM Mark Rivers via Tech-talk
Re: Displaying string Waveform in CaQtDM Johnson, Andrew N. via Tech-talk
Re: Displaying string Waveform in CaQtDM Paul Nord via Tech-talk
Re: Displaying string Waveform in CaQtDM Johnson, Andrew N. via Tech-talk

Navigate by Date:
Prev: Re: Displaying string Waveform in CaQtDM Johnson, Andrew N. via Tech-talk
Next: Re: PVI Prototype - a framework for specifying the interface to an EPICS driver in a single YAML file Yendell, Gary (DLSLtd, RAL, LSCI) 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  <20202021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Displaying string Waveform in CaQtDM Johnson, Andrew N. via Tech-talk
Next: Re: Displaying string Waveform in CaQtDM Paul Nord 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  <20202021  2022  2023  2024 
ANJ, 20 May 2020 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·