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  2020  <20212022  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  2020  <20212022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Python Script call from Button press, module not found
From: Ben Franksen via Tech-talk <tech-talk at aps.anl.gov>
To: "Johnson, Andrew N." <anj at anl.gov>, "Manoussakis, Adamandios" <manoussakis1 at llnl.gov>
Cc: EPICS tech-talk <tech-talk at aps.anl.gov>
Date: Fri, 16 Apr 2021 10:37:58 +0200
Am 15.04.21 um 18:46 schrieb Johnson, Andrew N. via Tech-talk:
> On Apr 15, 2021, at 11:26 AM, Manoussakis, Adamandios 
> <manoussakis1 at llnl.gov> wrote:
>> I was looking mostly into the epics.camonitor or the auto_monitor 
>> parameter (seems like camonitor just when you create the pv you
>> can set this?) in pyepics.  The python script is just a small file 
>> generator that does some basic calculations.  I was trying to have 
>> CSS just call it to run to avoid having another application to
>> deal with.  Either by pressing a button (execute command works fine
>> but cannot get the execute to trigger based off a rule that I know
>> of) or by a pv changing value and css calling the script (jython 
>> doesn’t work with numpy/pandas).
> 
> You might want to take a look at the separate Kryten program 
> available from https://github.com/andrewstarritt/kryten which can 
> monitor PVs and run specified commands or scripts on conditions 
> related to those PVs. Since this wouldn’t be running inside your GUI 
> it isn’t subject to the problems related to running multiple 
> instances which Michael mentioned.
I recently had a case where I needed that functionality for a simple
test script. I resorted to plain shell scripting, see below. As written
the code works only for a single PV but I guess it wouldn't be hard to
add some filtering / case distinctions in the loop body in case you need
to monitor more PVs.

```
sel=0
caput BPMMUXCB:sel $sel
camonitor -t n BPMMUXCB:st | while read line; do
  st=$(echo -n "$line"|cut -b 33-)
  echo "st=$st"
  if test $sel = $st; then
    sel=$(( ($st + 1) % 32 ))
    caput BPMMUXCB:sel $sel >/dev/null
    echo "sel=$sel"
  fi
done
```

Ben
-- 
I would rather have questions that cannot be answered, than answers that
cannot be questioned.  -- Richard Feynman


Attachment: signature.asc
Description: OpenPGP digital signature


Replies:
RE: Python Script call from Button press, module not found Layne (US), William C via Tech-talk
References:
Python Script call from Button press, module not found Manoussakis, Adamandios via Tech-talk
Re: Python Script call from Button press, module not found Kasemir, Kay via Tech-talk
RE: Python Script call from Button press, module not found Manoussakis, Adamandios via Tech-talk
Re: Python Script call from Button press, module not found Matt Newville via Tech-talk
Re: Python Script call from Button press, module not found Johnson, Andrew N. via Tech-talk
RE: Python Script call from Button press, module not found Manoussakis, Adamandios via Tech-talk
Re: Python Script call from Button press, module not found Johnson, Andrew N. via Tech-talk

Navigate by Date:
Prev: Re: PVA crossing network segments Hu, Yong via Tech-talk
Next: WIN_32 Marty Kraimer 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  2020  <20212022  2023  2024 
Navigate by Thread:
Prev: RE: Python Script call from Button press, module not found Manoussakis, Adamandios via Tech-talk
Next: RE: Python Script call from Button press, module not found Layne (US), William C 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  2020  <20212022  2023  2024 
ANJ, 16 Apr 2021 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·