I am having a problem with signal.lsim. Here is a script that recreates my problem: from scipy import * from pylab import plot t=arange(0,10,0.01) u=ones(shape(t)) sys=signal.lti([1.0],[1.0,1.0]) out=signal.lsim(sys,u,t) plot(out[0],out[1]) Here is the error message: I:\lsim_test.py 5 u=ones(shape(t)) 6 sys=signal.lti([1.0],[1.0,1.0]) ----> 7 out=signal.lsim(sys,u,t) 8 plot(out[0],out[1]) 9 c:\python24\lib\site-packages\scipy\signal\ltisys.py in lsim(system, U, T, X0, i nterp) 403 vt = transpose(v) 404 vti = linalg.inv(vt) --> 405 GT = dot(dot(vti,diag(numpy.exp(dt*lam))),vt).astype(xout.dtype.char ) 406 ATm1 = linalg.inv(AT) 407 ATm2 = dot(ATm1,ATm1) C:\Python24\Lib\site-packages\numpy\lib\twodim_base.py in diag(v, k) 66 i = arange(0,n+k) 67 fi = i+(i-k)*n ---> 68 res.flat[fi] = v 69 return res 70 elif len(s)==2: TypeError: can't convert complex to float; use abs(z) WARNING: Failure executing file: <lsim_test.py> My script is also attached if someone wants to run it. How do I fix this? Thanks, Ryan
For what it's worth, this code runs fine on a Ubuntu machine running numpy rc1 and a Windows machine running numpy 1.0b5. The machine that has the problem is running Windows and numpy rc2. All are running scipy 0.5.1. Ryan On 11/27/06, Ryan Krauss <ryanlists@gmail.com> wrote:
I am having a problem with signal.lsim. Here is a script that recreates my problem:
from scipy import * from pylab import plot
t=arange(0,10,0.01) u=ones(shape(t)) sys=signal.lti([1.0],[1.0,1.0]) out=signal.lsim(sys,u,t) plot(out[0],out[1])
Here is the error message: I:\lsim_test.py 5 u=ones(shape(t)) 6 sys=signal.lti([1.0],[1.0,1.0]) ----> 7 out=signal.lsim(sys,u,t) 8 plot(out[0],out[1]) 9
c:\python24\lib\site-packages\scipy\signal\ltisys.py in lsim(system, U, T, X0, i nterp) 403 vt = transpose(v) 404 vti = linalg.inv(vt) --> 405 GT = dot(dot(vti,diag(numpy.exp(dt*lam))),vt).astype(xout.dtype.char ) 406 ATm1 = linalg.inv(AT) 407 ATm2 = dot(ATm1,ATm1)
C:\Python24\Lib\site-packages\numpy\lib\twodim_base.py in diag(v, k) 66 i = arange(0,n+k) 67 fi = i+(i-k)*n ---> 68 res.flat[fi] = v 69 return res 70 elif len(s)==2:
TypeError: can't convert complex to float; use abs(z) WARNING: Failure executing file: <lsim_test.py>
My script is also attached if someone wants to run it.
How do I fix this?
Thanks,
Ryan
I was hoping that updating my versions would fix this problem, but after wrestling with building from source under windows (and mostly getting it working), I still get: In [2]: run lsim_test.py --------------------------------------------------------------------------- exceptions.TypeError Traceback (most recent call last) e:\lsim_test.py 5 u=ones(shape(t)) 6 sys=signal.lti([1.0],[1.0,1.0]) ----> 7 out=signal.lsim(sys,u,t) 8 plot(out[0],out[1]) 9 C:\Python24\Lib\site-packages\scipy\signal\ltisys.py in lsim(system, U, T, X0, i nterp) 400 vt = transpose(v) 401 vti = linalg.inv(vt) --> 402 GT = dot(dot(vti,diag(numpy.exp(dt*lam))),vt).astype(xout.dtype) 403 ATm1 = linalg.inv(AT) 404 ATm2 = dot(ATm1,ATm1) C:\Python24\Lib\site-packages\numpy\lib\twodim_base.py in diag(v, k) 66 i = arange(0,n+k) 67 fi = i+(i-k)*n ---> 68 res.flat[fi] = v 69 return res 70 elif len(s)==2: TypeError: can't convert complex to float; use abs(z) WARNING: Failure executing file: <lsim_test.py> where the script contains: from scipy import * from pylab import plot t=arange(0,10,0.01) u=ones(shape(t)) sys=signal.lti([1.0],[1.0,1.0]) out=signal.lsim(sys,u,t) plot(out[0],out[1]) Ryan On 11/28/06, Ryan Krauss <ryanlists@gmail.com> wrote:
For what it's worth, this code runs fine on a Ubuntu machine running numpy rc1 and a Windows machine running numpy 1.0b5. The machine that has the problem is running Windows and numpy rc2. All are running scipy 0.5.1.
Ryan
On 11/27/06, Ryan Krauss <ryanlists@gmail.com> wrote:
I am having a problem with signal.lsim. Here is a script that recreates my problem:
from scipy import * from pylab import plot
t=arange(0,10,0.01) u=ones(shape(t)) sys=signal.lti([1.0],[1.0,1.0]) out=signal.lsim(sys,u,t) plot(out[0],out[1])
Here is the error message: I:\lsim_test.py 5 u=ones(shape(t)) 6 sys=signal.lti([1.0],[1.0,1.0]) ----> 7 out=signal.lsim(sys,u,t) 8 plot(out[0],out[1]) 9
c:\python24\lib\site-packages\scipy\signal\ltisys.py in lsim(system, U, T, X0, i nterp) 403 vt = transpose(v) 404 vti = linalg.inv(vt) --> 405 GT = dot(dot(vti,diag(numpy.exp(dt*lam))),vt).astype(xout.dtype.char ) 406 ATm1 = linalg.inv(AT) 407 ATm2 = dot(ATm1,ATm1)
C:\Python24\Lib\site-packages\numpy\lib\twodim_base.py in diag(v, k) 66 i = arange(0,n+k) 67 fi = i+(i-k)*n ---> 68 res.flat[fi] = v 69 return res 70 elif len(s)==2:
TypeError: can't convert complex to float; use abs(z) WARNING: Failure executing file: <lsim_test.py>
My script is also attached if someone wants to run it.
How do I fix this?
Thanks,
Ryan
Ryan Krauss wrote:
I was hoping that updating my versions would fix this problem, but after wrestling with building from source under windows (and mostly getting it working), I still get:
This was a problem with NumPy. It is now fixed in SVN and should be in the 1.0.1 release of NumPy. -Travis
Sweet. This is working for me now. I am running numpy/scipy built from source under windows and all is well. It is almost like running Linux. On 12/1/06, Travis Oliphant <oliphant.travis@ieee.org> wrote:
Ryan Krauss wrote:
I was hoping that updating my versions would fix this problem, but after wrestling with building from source under windows (and mostly getting it working), I still get:
This was a problem with NumPy. It is now fixed in SVN and should be in the 1.0.1 release of NumPy.
-Travis
_______________________________________________ SciPy-user mailing list SciPy-user@scipy.org http://projects.scipy.org/mailman/listinfo/scipy-user
Hello everyone, I am using python/scipy to control some hardware using ctypes and some self written dlls. Now I have the need to display some data online while doing other things. Until now I used matplotlib to plot everything, but this is too slow for the online display. What do you recommend? What I would like to do as a start is a small simple oscilloscope. I read data from a data acquisition card and plot it to a simple 2d-plot. I would like to reach roughly 5 frames per second but *being able to do something else at the same time*. As I said, I tried matplotlib. At the moment I am playing around with VTK. I read about chaco. I know that there is gnuplot. Certainly there is also wx or something equivalent. Is there anyone doing something similar? What do you recommend? Thanks for every comment Lars Friedrich -- Dipl.-Ing. Lars Friedrich Optical Measurement Technology Department of Microsystems Engineering -- IMTEK University of Freiburg Georges-Köhler-Allee 102 D-79110 Freiburg Germany phone: +49-761-203-7531 fax: +49-761-203-7537 room: 01 088 email: lfriedri@imtek.de
On Thu, Jan 04, 2007 at 11:10:35AM +0100, Lars Friedrich wrote:
As I said, I tried matplotlib. At the moment I am playing around with VTK. I read about chaco. I know that there is gnuplot. Certainly there is also wx or something equivalent.
Is there anyone doing something similar? What do you recommend?
MPL was good enough for me, but I was told that chaco is much fast then MPL (it is part of its design goals). I doubt gnuplot will help much, here. I suggest you try chaco (and report you experience here, please). Gaël
If you want I have written an osciloscope for mpl and pyqt4. But the code is really dirty. I have tested it with a usb2 Mesurment Computing Card. It works quite good for low sampling rate (16 channel 200Hz) and small window (5s.) And I am doing something else at the same time (recording to a file and trigger detection) So for me mpl is good enough too. What is the size of data you to refresh 5 frames per second ? Sam Lars Friedrich wrote:
Hello everyone,
I am using python/scipy to control some hardware using ctypes and some self written dlls. Now I have the need to display some data online while doing other things. Until now I used matplotlib to plot everything, but this is too slow for the online display. What do you recommend?
What I would like to do as a start is a small simple oscilloscope. I read data from a data acquisition card and plot it to a simple 2d-plot. I would like to reach roughly 5 frames per second but *being able to do something else at the same time*.
As I said, I tried matplotlib. At the moment I am playing around with VTK. I read about chaco. I know that there is gnuplot. Certainly there is also wx or something equivalent.
Is there anyone doing something similar? What do you recommend?
Thanks for every comment
Lars Friedrich
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Samuel Garcia Universite Claude Bernard LYON 1 CNRS - UMR5020, Laboratoire des Neurosciences et Systemes Sensoriels 50, avenue Tony Garnier 69366 LYON Cedex 07 FRANCE Tél : 04 37 28 74 64 Fax : 04 37 28 76 01 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Samuel, I would be interested in you code. I plan to buy some of the hardware you mentioned and set something up for a teaching lab. Thanks. Barry Drake Samuel GARCIA wrote: If you want I have written an osciloscope for mpl and pyqt4. But the code is really dirty. I have tested it with a usb2 Mesurment Computing Card. It works quite good for low sampling rate (16 channel 200Hz) and small window (5s.) And I am doing something else at the same time (recording to a file and trigger detection) So for me mpl is good enough too. What is the size of data you to refresh 5 frames per second ? Sam Lars Friedrich wrote:
Hello everyone,
I am using python/scipy to control some hardware using ctypes and some self written dlls. Now I have the need to display some data online while doing other things. Until now I used matplotlib to plot everything, but this is too slow for the online display. What do you recommend?
What I would like to do as a start is a small simple oscilloscope. I read data from a data acquisition card and plot it to a simple 2d-plot. I would like to reach roughly 5 frames per second but *being able to do something else at the same time*.
As I said, I tried matplotlib. At the moment I am playing around with VTK. I read about chaco. I know that there is gnuplot. Certainly there is also wx or something equivalent.
Is there anyone doing something similar? What do you recommend?
Thanks for every comment
Lars Friedrich
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Samuel Garcia Universite Claude Bernard LYON 1 CNRS - UMR5020, Laboratoire des Neurosciences et Systemes Sensoriels 50, avenue Tony Garnier 69366 LYON Cedex 07 FRANCE Tél : 04 37 28 74 64 Fax : 04 37 28 76 01 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _______________________________________________ SciPy-user mailing list SciPy-user@scipy.org http://projects.scipy.org/mailman/listinfo/scipy-user
John, Thank you! I just downloaded all the software and ordered the temperature and dew point sensor. It's certain I'll have questions after I get started. Cheers! Barry John Hassler <hasslerjc@adelphia.net> wrote: You might want to look at PyUniversalLibrary, too: http://www.its.caltech.edu/~astraw/pyul.html john Barry Drake wrote: Samuel, I would be interested in you code. I plan to buy some of the hardware you mentioned and set something up for a teaching lab. Thanks. Barry Drake Samuel GARCIA wrote: If you want I have written an osciloscope for mpl and pyqt4. But the code is really dirty. I have tested it with a usb2 Mesurment Computing Card. It works quite good for low sampling rate (16 channel 200Hz) and small window (5s.) And I am doing something else at the same time (recording to a file and trigger detection) So for me mpl is good enough too. What is the size of data you to refresh 5 frames per second ? Sam Lars Friedrich wrote:
Hello everyone,
I am using python/scipy to control some hardware using ctypes and some self written dlls. Now I have the need to display some data online while doing other things. Until now I used matplotlib to plot everything, but this is too slow for the online display. What do you recommend?
What I would like to do as a start is a small simple oscilloscope. I read data from a data acquisition card and plot it to a simple 2d-plot. I would like to reach roughly 5 frames per second but *being able to do something else at the same time*.
As I said, I tried matplotlib. At the moment I am playing around with VTK. I read about chaco. I know that there is gnuplot. Certainly there is also wx or something equivalent.
Is there anyone doing something similar? What do you recommend?
Thanks for every comment
Lars Friedrich
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Samuel Garcia Universite Claude Bernard LYON 1 CNRS - UMR5020, Laboratoire des Neurosciences et Systemes Sensoriels 50, avenue Tony Garnier 69366 LYON Cedex 07 FRANCE Tél : 04 37 28 74 64 Fax : 04 37 28 76 01 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _______________________________________________ SciPy-user mailing list SciPy-user@scipy.org http://projects.scipy.org/mailman/listinfo/scipy-user --------------------------------- _______________________________________________ SciPy-user mailing list SciPy-user@scipy.org http://projects.scipy.org/mailman/listinfo/scipy-user _______________________________________________ SciPy-user mailing list SciPy-user@scipy.org http://projects.scipy.org/mailman/listinfo/scipy-user
John Hassler wrote:
You might want to look at PyUniversalLibrary, too: http://www.its.caltech.edu/~astraw/pyul.html
john FWIW, I just switched the webpage to https://code.astraw.com/projects/PyUniversalLibrary/ (The old URL will just redirect you to the above.)
Also, I put the svn repo online at https://code.astraw.com/PyUniversalLibrary/trunk/ I hope that having the svn repo online will encourage people to send me patches against svn HEAD. I don't have a lot of time to maintain this myself... Also, I'll gladly give anyone write access once they've sent me a useful couple of patches. If anyone wants to build an oscilloscope app to go with PyUniversalLibrary, that would be pretty cool and I'd be happy to include it with PyUL. I have the start of such a thing at https://code.astraw.com/projects/PyUniversalLibrary/file/trunk/examples/pysc... This is matplotlib based, but I'm open to other toolkits. -Andrew
On 2007-01-04, Andrew Straw <strawman@astraw.com> wrote:
John Hassler wrote:
You might want to look at PyUniversalLibrary, too: http://www.its.caltech.edu/~astraw/pyul.html
FWIW, I just switched the webpage to https://code.astraw.com/projects/PyUniversalLibrary/ (The old URL will just redirect you to the above.)
A "universal library" that only works on one platform? 1/2 ;) -- Grant Edwards grante Yow! Everybody gets free at BORSCHT! visi.com
On Jan 4, 2007, at 4:10 AM, Lars Friedrich wrote:
I am using python/scipy to control some hardware using ctypes and some self written dlls. Now I have the need to display some data online while doing other things. Until now I used matplotlib to plot everything, but this is too slow for the online display. What do you recommend?
What I would like to do as a start is a small simple oscilloscope. I read data from a data acquisition card and plot it to a simple 2d- plot. I would like to reach roughly 5 frames per second but *being able to do something else at the same time*.
Hi Lars, Someone else asked a similar question about a data acquisition application on the enthought-dev a couple of weeks ago and I wrote up an example program using Chaco for him. Here is a link to his original email: https://mail.enthought.com/pipermail/enthought-dev/2006-December/ 003810.html Here is the source code of the application (140 lines): https://svn.enthought.com/enthought/browser/trunk/src/lib/enthought/ chaco2/examples/data_stream.py And finally, a screenshot: https://mail.enthought.com/pipermail/enthought-dev/attachments/ 20061221/63fa296e/attachment-0001.png Note that in this demo application, it's updating the screen 10 times per second, and it's plenty responsive. (It can easily do 50.) -Peter
In article <1167905435.4888.18.camel@localhost>, Lars Friedrich <lfriedri@imtek.de> wrote:
Hello everyone,
I am using python/scipy to control some hardware using ctypes and some self written dlls. Now I have the need to display some data online while doing other things. Until now I used matplotlib to plot everything, but this is too slow for the online display. What do you recommend?
When we ran into a similar problem we switched from matplotlib to HippoDraw. it is very nice and very fast, but uses Qt, which is a big package. -- Russell
Check out PLplot at http://plplot.sourceforge.net/index.html. It is a native C library with Python bindings. Dont' be put off by the rather crappy graphical examples on the home page. I don't know how fast it is but I'd say give it a try. It is a very active sourceforge project. BTW, gnuplot can only plot data that is first written to disk (other than that which it calculates itself) so it might be slower than you would like. Jerry On Jan 4, 2007, at 3:10 AM, Lars Friedrich wrote:
Hello everyone,
I am using python/scipy to control some hardware using ctypes and some self written dlls. Now I have the need to display some data online while doing other things. Until now I used matplotlib to plot everything, but this is too slow for the online display. What do you recommend?
What I would like to do as a start is a small simple oscilloscope. I read data from a data acquisition card and plot it to a simple 2d- plot. I would like to reach roughly 5 frames per second but *being able to do something else at the same time*.
As I said, I tried matplotlib. At the moment I am playing around with VTK. I read about chaco. I know that there is gnuplot. Certainly there is also wx or something equivalent.
Is there anyone doing something similar? What do you recommend?
Thanks for every comment
Lars Friedrich
Similarly, PGPLOT works great as well. Almost all of my published figures are generated using it. There is a python module called ppglot that works with numeric and numarray, and only minor changes are needed to make it work with numpy (I can send those changes if you want to check them out). It is a fortran library with C-wrappers and python around that, but it is still _very_ fast. I'm not sure how it handles Windows, though... http://www.astro.caltech.edu/~tjp/pgplot/ http://efault.net/npat/hacks/ppgplot/ Scott On Thursday 04 January 2007 17:11, Jerry wrote:
Check out PLplot at http://plplot.sourceforge.net/index.html. It is a native C library with Python bindings. Dont' be put off by the rather crappy graphical examples on the home page. I don't know how fast it is but I'd say give it a try. It is a very active sourceforge project.
BTW, gnuplot can only plot data that is first written to disk (other than that which it calculates itself) so it might be slower than you would like.
Jerry
On Jan 4, 2007, at 3:10 AM, Lars Friedrich wrote:
Hello everyone,
I am using python/scipy to control some hardware using ctypes and some self written dlls. Now I have the need to display some data online while doing other things. Until now I used matplotlib to plot everything, but this is too slow for the online display. What do you recommend?
What I would like to do as a start is a small simple oscilloscope. I read data from a data acquisition card and plot it to a simple 2d- plot. I would like to reach roughly 5 frames per second but *being able to do something else at the same time*.
As I said, I tried matplotlib. At the moment I am playing around with VTK. I read about chaco. I know that there is gnuplot. Certainly there is also wx or something equivalent.
Is there anyone doing something similar? What do you recommend?
Thanks for every comment
Lars Friedrich
_______________________________________________ SciPy-user mailing list SciPy-user@scipy.org http://projects.scipy.org/mailman/listinfo/scipy-user
-- Scott M. Ransom Address: NRAO Phone: (434) 296-0320 520 Edgemont Rd. email: sransom@nrao.edu Charlottesville, VA 22903 USA GPG Fingerprint: 06A9 9553 78BE 16DB 407B FFCA 9BFA B6FF FFD3 2989
On 2007-01-04, Jerry <lanceboyle@qwest.net> wrote:
BTW, gnuplot can only plot data that is first written to disk
Not really true 1) Gnuplot can be sent data through a pipe. 2) All decent OSes (and even a few crappy ones) cache filesystem data blocks in RAM, so small temp-files will rarely even hit a disk platter.
(other than that which it calculates itself) so it might be slower than you would like.
In my experience gnuplot (pygnuplot) is pretty fast. I'm able to smoothly animate rotation of 3-D wireframe plots containing undreds of line segments without any problems. -- Grant Edwards grante Yow! YOW!! I am having at FUN!! visi.com
Thanks for the quasi-correction and gnuplot speed report. Jerry On Jan 4, 2007, at 3:40 PM, Grant Edwards wrote:
On 2007-01-04, Jerry <lanceboyle@qwest.net> wrote:
BTW, gnuplot can only plot data that is first written to disk
Not really true
1) Gnuplot can be sent data through a pipe.
2) All decent OSes (and even a few crappy ones) cache filesystem data blocks in RAM, so small temp-files will rarely even hit a disk platter.
(other than that which it calculates itself) so it might be slower than you would like.
In my experience gnuplot (pygnuplot) is pretty fast. I'm able to smoothly animate rotation of 3-D wireframe plots containing undreds of line segments without any problems.
participants (13)
-
Andrew Straw
-
Barry Drake
-
Gael Varoquaux
-
Grant Edwards
-
Jerry
-
John Hassler
-
Lars Friedrich
-
Peter Wang
-
Russell E Owen
-
Ryan Krauss
-
Samuel GARCIA
-
Scott Ransom
-
Travis Oliphant