Experimental Physics and Industrial Control System
From: [email protected] [mailto:tech-talk-
> I'm not a user of cothread.catools either, but I think it might be
> useful to have cothreads.catools and pyepics have similar behaviors
> whenever possible. I've been confused about what the correct
> behavior for waveforms should be too.
Hi Matt!
> >> QUESTION: What should be the correct *default* result length when
> >> using cothread to perform caget() or camonitor() on a waveform?
> >>
> >> A. The "natural" length, encoded as zero: this returns NORD elements
> >> on a .12 and above server, but NELM elements on older version of
> >> EPICS. (This is the current default.)
> >
> > I think you should stick with this meaning.
> >
> >> B. The "full" length, which for a waveform is NELM elements.
> >>
> >>
> >> I am proposing to make the following *incompatible* change: the
> >> default result length (encoded by the 'count' parameter to 'caget'
> >> and 'camonitor') will change from 0 ("natural" length) to "full"
> >> length, and if the "natural" length is wanted it will be necessary to
> >> explicitly specify 'count=0' as an argument.
> >>
> >> Please shout if you think this is a bad idea...
> >
> > Shout!
>
> Oh, Micheal's proposal is (mostly) exactly what pyepics ca.get() does.
> It takes a count argument with a default value of None. That is
> interpreted as "use ca_element_count() to figure out count". One can
> pass in count=0 to get the natural length (NORD elements), but the
> default is the full array.
That's what I was in the middle of rewriting cothread to do when I sent this mail, but on reflection and thinking about Andrew's response, I've decided to keep cothread's current behaviour which is to default count to 0 with the behaviour we're discussion.
I also very much like Andrew's suggestion of making, in effect, this decision (a grotesque caricature of the real code):
if ca_element_count(channel) > 1:
return numpy.array(data)
else:
return scalar(data)
> Should the ca.get() be changed to have a default count of 0 (meaning,
> return NORD elements)? I think that would mean the user has to
> explicitly do a ca_element_count() to get the full array, which does
> seem reasonable.
>
> That is, if we know that elements NORD through NELM-1 are not valid
> data then it seems better to not return them, unless the user
> explicitly asks for it. Then again, I think it would be preferable to
> have uniform behavior. Looking forward to hearing what the best
> approach should be...
It's a tricky one. Looking like I'm probably sticking with count=0, which is going to disappoint my colleague with the array access problem!
--
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
- Replies:
- Re: Zero length length requests, EPICS upgrades, and cothread Matt Newville
- References:
- Zero length length requests, EPICS upgrades, and cothread michael.abbott
- Re: Zero length length requests, EPICS upgrades, and cothread Andrew Johnson
- Re: Zero length length requests, EPICS upgrades, and cothread Matt Newville
- Navigate by Date:
- Prev:
RE: Zero length length requests, EPICS upgrades, and cothread michael.abbott
- Next:
RE: Zero length length requests, EPICS upgrades, and cothread michael.abbott
- 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
- Navigate by Thread:
- Prev:
RE: Zero length length requests, EPICS upgrades, and cothread michael.abbott
- Next:
Re: Zero length length requests, EPICS upgrades, and cothread Matt Newville
- 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