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  <20152016  2017  2018  2019  2020  2021  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  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: how to write array data to waveform record in cothread?
From: <[email protected]>
To: <[email protected]>, <[email protected]>
Date: Thu, 9 Jul 2015 06:24:58 +0000

Hy Geyang,

 

I think I may have made the description here too confusing.  Certainly caput can write arrays, but the description here is confusing because it can also write arrays of arrays – there is some overloading, depending on whether pvs is a string or a list of strings.  Let me try and be clearer.

 

caput has two variants:

 

1.       caput(pv, value, …)

 

Here pv must be a string (naming the PV to be written) and value can be pretty well anything that can be written over epics and that numpy understands.  In particular you can write the following to write 5 elements to an array:

 

                caput(pv, [1,2,3,4,5])

 

This is the basic form of caput.

 

In this variant  repeat_value argument has no meaning and will raise an error.

 

2.1   caput(pvs, values, repeat_value=False, …)

 

This is almost certainly the case which was confusing you.  Here pvs is a list of PV names, in which case values must be an array of the same length as pvs.  Now, it can be an array of arrays (or a numpy 2-d array) if you want to write to a list of array PVs, for example:

 

                caput([pv1, pv2], [1, 2])                # Writes 1 to pv1, 2 to pv2

                caput([pv1, pv2], [[1, 2], [3, 4]])                # Writes [1,2] to pv1, [3,4] to pv2

 

2.2   caput(pvs, value, repeat_value=True, …)

 

This is the most obsure variant.  Again pvs is a list of PV names, and now value is a single value (or a possibly an array) which is written to all pvs.  For example:

 

                caput([pv1, pv2], ‘a string’, repeat_value=True)                # Writes ‘a string’ to pv1 and pv2

 

 

You might well ask why I have implemented variants 2.1 and 2.2 above when all they do is call caput on each pv.  The reason is, it’s much more efficient to write multiple pvs in parallel.  You might also ask why I didn’t give the two variants different names.  Um.  I was trying to make the API simple.  Huh.

 

In fact there are two functions, caput_one and caput_array inside catools.py, and caput figures out which one to call.

 

Let me know if this works for you or if you have any further problems.

 

 

From: [email protected] [mailto:[email protected]] On Behalf Of Silver
Sent: 09 July 2015 04:11
To: tech-talk
Subject: how to write array data to waveform record in cothread?

 

hi, all:

 

I want to use cothread to write array data to a waveform record, but can't find how to do this.

In the manual of cothread as following:

cothread.catools.caput(pvsvaluesrepeat_value=Falsedatatype=Nonewait=Falsetimeout=5callback=Nonethrow=True)[source]

Writes values to one or more PVs. If pvs is a single string then values is treated as a single value to be written to the named process variable, otherwise pvs must be iterable, and unless repeat_value=True is set, values must also be an iterable of the same length in which case values[i]is written to pvs[i]. Otherwise, if a single value is given or if repeat_value=True is specified, values is written to all PVs.

seems can only get array data, can't write array data?

thanks a lot in advance.  

 

 

 

 


Best wishes

Geyang 2015-07-09

 

 

 

-- 

This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.
Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd.
Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.
Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom
 


References:
how to write array data to waveform record in cothread? Silver

Navigate by Date:
Prev: how to write array data to waveform record in cothread? Silver
Next: RE: how NOT to update the record Mooney, Tim M.
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: how to write array data to waveform record in cothread? Silver
Next: Sequencer on Windows: co-maintainer needed Benjamin Franksen
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 16 Dec 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·