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

Subject: Re: pilatus detecotr modify FileName problem
From: Matt Newville <[email protected]>
To: 洪春霞 <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Tue, 10 Dec 2013 22:10:02 -0600
On Tue, Dec 10, 2013 at 9:32 PM, 洪春霞 <[email protected]> wrote:
> Hello everyone,
>
>
> Now we use CSS(Control System Studio) to control a Pilatus Detector. The
> platform is base-3.14.12.3, synApps_5_6 and CSS_3.1.6, the driver of Pilatus
> Detector is from synApps_5_6.
>
> When I use the softioc and the CSS opi to control the Detector, it works
> well and no problem, but now I have a python script to modify the detector’s
> Filename and Filename readback for exposing some different samples. That is,
> when I execute the python script it can modify the record
> X16B:EH:13PIL1:cam1:Filename and X16B:EH:13PIL1:cam1:Filename_RBV
> automaticly, the python is as follows(sample.py):
>
>
>
> #!/usr/bin/env python
>
> from epics import caget,caput
>
> caput(' X16B:EH:13PIL1:cam1:FileName',sample_name)
>
> caput(' X16B:EH:13PIL1:cam1:FileName_RBV',sample_name)
>
> ……
>
>
> The sample_name is from the css opi for different sample’s name, for
> example,in a experiment you can do six samples, that is, the sample.py will
> be run for six times.
>
> The problem is, if the first sample name is sample1, the python can modify
> the two record, and the detector file name will be sample1_0001.tif, it
> works well. But when I set the second sample’s name is s2, the detector file
> name will be s2mple1_0002.tif, which is not I wanted. That is , the first
> two letter is replaced by s2, but the sample’s name is not replaced all. I
> don’t know why.
>
> When I open a terminal in linux, and input python, and then run statement of
> the sample.py line by line, the problems is the same. That is to say, if the
> next sample’s name is shorter than former, the question is exist, on the
> contrary, it’s ok.
>
>
> I don't know how to solve the problem. Thank you.
>
>
> ---------------------------------------------
> hongchunxia
> Shanghai Synchrotron Radiation Facility
> Shanghai Institute of Applied Physics
> Chinese Academy of Sciences

Can you check which version of python-epics interface you're using?
A bug like this used to exist in pyepics long ago, but has been fixed
for a very long time now.  The behavior you see does not happen for
me.  Also with base-3.14.12.2,  I get:

  >>> from epics import caget, caput
  >>> caput('13IDEPS1:cam1:FileName', 'Sample1.tiff')
  >>> print caget('13IDEPS1:cam1:FileName', as_string=True)
  Sample1.tiff
  >>> caput('13IDEPS1:cam1:FileName', 'S2.tiff')
  >>> print caget('13IDEPS1:cam1:FileName', as_string=True)
  S2.tiff

For completeness, the FileName PVs for areaDetector are character
waveforms so as to handle long strings.    This means Python strings
have to be converted to arrays of bytes, and NULL terminated.   If it
is not NULL terminated, and you've only written to the first few
bytes, data in remaining bytes may still be interpreted as part of the
string.  Anyway, this problem should have been resolved long ago, so
I'm not sure why it would show up for you.

Hope that helps,

--Matt Newville


References:
pilatus detecotr modify FileName problem 洪春霞

Navigate by Date:
Prev: pilatus detecotr modify FileName problem 洪春霞
Next: Mclennan PM600 motor controller Peter Linardakis
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: pilatus detecotr modify FileName problem 洪春霞
Next: RE: pilatus detecotr modify FileName problem nick.rees
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 20 Apr 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·