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: Matt Newville via Tech-talk <tech-talk at aps.anl.gov>
To: Michael Davidsaver <mdavidsaver at gmail.com>
Cc: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Thu, 15 Apr 2021 13:04:57 -0500
Hi Michael, 

For completeness, something like this would be a "more minimal" example:

import time
import numpy
import epics

needs_calc = False

def onButtonPush(pvname, value, **kws):
    needs_calc = (value = 1)

button_pv = epics.PV('Button:bo', callback=onButtonPush)
image_pv = epics.PV('AreaDetector:image1:ArrayData')

while True:
    time.sleep(0.025)
    if needs_calc:
        needs_calc = False
        button_pv.put(0)
        print("Do real calculation here ", numpy.sum(image_pv.get())


--Matt


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 Michael Davidsaver via Tech-talk

Navigate by Date:
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 Matt Newville 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 Michael Davidsaver via Tech-talk
Next: Re: Python Script call from Button press, module not found Johnson, Andrew N. 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, 15 Apr 2021 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·