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 2025 | 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 2025 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: [Scopes] BMP image record?? |
From: | Pavel Masloff <[email protected]> |
To: | Matt Newville <[email protected]> |
Cc: | EPICS Tech Talk <[email protected]> |
Date: | Tue, 1 May 2012 00:20:33 +0400 |
Hi Pavel,
Since you mentioned pyepics and numpy, I'll jump in to recommend a
slightly different waveform -> Image conversion using these:
import Image
import epics
waveform_pv = epics.PV('xx:waveform.VAL')
waveform = waveform_pv.get() # will be a numpy array of unsigned ints
# to get a truncated waveform, pass in the length you'd like:
# waveform = waveform_pv.get(count=400)
width = ?? # that is, you'll have to assert this here.
height = len(waveform)/width
image = Image.frombuffer('L', (width, height), waveform, 'raw', 'L', 0, 1)
image.show()
where you'll have the know the image height and width somehow to
unravel the 1-d waveform. The Image.frombuffer() call is slightly
cryptic, but documented ('L' means 8-bit greyscale -- if you're
waveform held RGB data from a color camera, you'd change that here to
get a color image), and is faster than converting to a string and then
using Image.open().
--Matt