[Newbie] High-performance plotting of large datasets
![](https://secure.gravatar.com/avatar/3a822f456118044475eede4f68650baa.jpg?s=120&d=mm&r=g)
Hi all, Using LabVIEW software for our data analysis at the moment, I'm currently looking for alternatives. Especially since LabVIEW's "graphical" programming language is somewhat cumbersome for some of the things we're doing --- an iterative language would often be much easier. (Actually, I personally don't like the graphical way of programming at all :) ) Python seems to be a great alternative, although I haven't been able yet to get things up & running the way I'd like. The main 'problem' is that LabVIEW contains a lot of high-performance library code for plotting data. I've been experimenting with SciPy and matplotlib, but those libraries are just *way* slower than LabVIEW when plotting large data sets (in our case, it's a current trace with a few MBs of data). I'd like to plot a current trace, so that the user can quickly zoom in & out, and pan using a horizontal scroll bar, but how should I do this? (I've looked around for examples a bit, but being a newbie, it can be hard to find your way around such a huge community). Another issue appears to be the creation of simple user interfaces. This is very intuitive in LabVIEW, but could someone here give some advice on a way to combine a UI and plot windows in a not-so-difficult to learn way in Python? What's your own experience? I've spent some time on looking at various packages and frameworks like Traits, Chaco and Envisage, but I just can't seem to wrap my head around them. I'm looking forward to any help; thank you very much in advance! Best regards, -- Onno Broekmans
![](https://secure.gravatar.com/avatar/95198572b00e5fbcd97fb5315215bf7a.jpg?s=120&d=mm&r=g)
On Thu, Feb 28, 2008 at 12:57 AM, <scipy-user@onnodb.com> wrote:
I've spent some time on looking at various packages and frameworks like Traits, Chaco and Envisage, but I just can't seem to wrap my head around them.
From your description, those three (esp. the first two) are probably your best bets. Have you tried playing with the examples and asking specific questions on the enthought-dev list? The developers there are typically very responsive to specific queries. You may also want to have a look at Vision:
http://mgltools.scripps.edu/packages/vision/overview though I don't know if it has 2-d plotting (it does have fancy OpenGL 3d features). Cheers, f
![](https://secure.gravatar.com/avatar/3a822f456118044475eede4f68650baa.jpg?s=120&d=mm&r=g)
Hi Fernando,
like Traits, Chaco and Envisage, but I just can't seem to wrap my head FP> From your description, those three (esp. the first two) are probably FP> your best bets. Have you tried playing with the examples and asking FP> specific questions on the enthought-dev list? The developers there FP> are typically very responsive to specific queries.
No, I haven't tried that yet, but I certainly will! FP> You may also want to have a look at Vision: FP> http://mgltools.scripps.edu/packages/vision/overview Looks very extensive, and worth experimenting with. Thanks! Best regards, -- Onno Broekmans
![](https://secure.gravatar.com/avatar/07a8f7b8193f92fa9f33f6a07691c48a.jpg?s=120&d=mm&r=g)
scipy-user@onnodb.com wrote:
Hi Fernando,
like Traits, Chaco and Envisage, but I just can't seem to wrap my head
FP> From your description, those three (esp. the first two) are probably FP> your best bets. Have you tried playing with the examples and asking FP> specific questions on the enthought-dev list? The developers there FP> are typically very responsive to specific queries.
No, I haven't tried that yet, but I certainly will!
FP> You may also want to have a look at Vision:
FP> http://mgltools.scripps.edu/packages/vision/overview
Looks very extensive, and worth experimenting with.
although I haven't worked with them both, I understand that Traits and Vision are each others opposite. So if you like them both, you should also take a look at everything in between ;-) * Orange <http://magix.fri.uni-lj.si/orange/screenshots.asp> * Elefant <https://elefant.developer.nicta.com.au/> * Enthought with Traits UI, they are developping it for a customer, and planned to show us something in december 2007, but I guess it's somewhat delayed. * Vision <http://www.scripps.edu/%7Esanner/python/viper/index.html> * Pyphant <http://www.fmf.uni-freiburg.de/service/Servicegruppen/sg_wissinfo/Software/Pyphant> * mathGUIde <http://www.math.uni-siegen.de/ring/mathGUIde/index.html> * PyLab_Works: http://oase.uci.kun.nl/~mientki/data_www/pylab_works/pw_animations_screensho... cheers, Stef
![](https://secure.gravatar.com/avatar/9ae4ce9eef0ed502005163f51792af3a.jpg?s=120&d=mm&r=g)
Hi, I'm an ex-LabView user, now using python for lab data-acquisition and analysis for some years now. It's well worth the switch. Your best bet is http://pyqwt.sourceforge.net/ You're right, matplotlib/chaco are too slow for "interactive real-time" type work. The strengths of these packages are their presentation-quality output (vector and anti-aliased bitmap graphics). For data-acquisition applications, I prefer wxPython to Qt (I may move to something based on Traits/ETS once I figure out how to install it). For GUIs I have a home-made plotting widget which is fast enough for real-time work. Unfortunately, I'm not yet in a position to post it publicly. If you need *really* high performance, it's not too hard to write a plot-widget using PyOpenGL directly. Bryan On Thu, 2008-02-28 at 09:57 +0100, scipy-user@onnodb.com wrote:
Hi all,
Using LabVIEW software for our data analysis at the moment, I'm currently looking for alternatives. Especially since LabVIEW's "graphical" programming language is somewhat cumbersome for some of the things we're doing --- an iterative language would often be much easier. (Actually, I personally don't like the graphical way of programming at all :) )
Python seems to be a great alternative, although I haven't been able yet to get things up & running the way I'd like. The main 'problem' is that LabVIEW contains a lot of high-performance library code for plotting data. I've been experimenting with SciPy and matplotlib, but those libraries are just *way* slower than LabVIEW when plotting large data sets (in our case, it's a current trace with a few MBs of data). I'd like to plot a current trace, so that the user can quickly zoom in & out, and pan using a horizontal scroll bar, but how should I do this? (I've looked around for examples a bit, but being a newbie, it can be hard to find your way around such a huge community).
Another issue appears to be the creation of simple user interfaces. This is very intuitive in LabVIEW, but could someone here give some advice on a way to combine a UI and plot windows in a not-so-difficult to learn way in Python? What's your own experience?
I've spent some time on looking at various packages and frameworks like Traits, Chaco and Envisage, but I just can't seem to wrap my head around them.
I'm looking forward to any help; thank you very much in advance!
Best regards,
![](https://secure.gravatar.com/avatar/0e31f673b2f054ea61da64e35bd52cc0.jpg?s=120&d=mm&r=g)
hi Bryan, unfortunately you're not able to post your code, (btw why not ?) but maybe you can answer a few questions .... Bryan Cole wrote:
Hi,
I'm an ex-LabView user, now using python for lab data-acquisition and analysis for some years now. It's well worth the switch.
I'm too a former MatLab / LabView user, and I'm quit happy with Python / Scipy / wxPython for now. At the moment I'm trying to write an open source LabView equivalent, first results can be seen here: http://oase.uci.kun.nl/~mientki/data_www/pylab_works/pw_animations_screensho...
Your best bet is http://pyqwt.sourceforge.net/
You're right, matplotlib/chaco are too slow for "interactive real-time" type work. The strengths of these packages are their presentation-quality output (vector and anti-aliased bitmap graphics).
For data-acquisition applications, I prefer wxPython to Qt (I may move to something based on Traits/ETS once I figure out how to install it). For GUIs I have a home-made plotting widget which is fast enough for real-time work. Unfortunately, I'm not yet in a position to post it publicly. If you need *really* high performance, it's not too hard to write a plot-widget using PyOpenGL directly.
I'm in the middle of writing a real time plot widget, based on direct canvas drawing, don't know yet how fast it is. I hope to make a video of it next week. But I wonder if you've a good data-acquisition module. I've one now (can use Soundcard , some NI-modules and several dedicated DAQ cards), but it's in fact a windows executable that I can control from Python. And of course I', looking for a more OS-indepedant solution. cheers, Stef
![](https://secure.gravatar.com/avatar/39916bae984cb93b797efd2b175f59c0.jpg?s=120&d=mm&r=g)
On Sat, 01 Mar 2008, Stef Mientki apparently wrote:
I'm too a former MatLab / LabView user, and I'm quit happy with Python / Scipy / wxPython for now. At the moment I'm trying to write an open source LabView equivalent, first results can be seen here: http://oase.uci.kun.nl/~mientki/data_www/pylab_works/pw_animations_screensho...
Looks promising. Please post updates as the project moves along. Thank you, Alan Isaac
![](https://secure.gravatar.com/avatar/0e31f673b2f054ea61da64e35bd52cc0.jpg?s=120&d=mm&r=g)
Alan G Isaac wrote:
On Sat, 01 Mar 2008, Stef Mientki apparently wrote:
I'm too a former MatLab / LabView user, and I'm quit happy with Python / Scipy / wxPython for now. At the moment I'm trying to write an open source LabView equivalent, first results can be seen here: http://oase.uci.kun.nl/~mientki/data_www/pylab_works/pw_animations_screensho...
Looks promising. Please post updates as the project moves along.
off course I will. cheers, Stef
![](https://secure.gravatar.com/avatar/9ae4ce9eef0ed502005163f51792af3a.jpg?s=120&d=mm&r=g)
Hi Stef,
unfortunately you're not able to post your code, (btw why not ?)
Although I started developing the plot-widget in my own time (I did publish this first version on my home web-site (now defunct due to lack of time)), development continued at my workplace over 2 years or more now so now the code ownership is ambiguous. The best plan is for me to get permission to release the code. Unfortunately, upper management are a bit suspicious of OSS at my workplace. I'm working on this...
but maybe you can answer a few questions ....
Bryan Cole wrote:
Hi,
I'm an ex-LabView user, now using python for lab data-acquisition and analysis for some years now. It's well worth the switch.
I'm too a former MatLab / LabView user, and I'm quit happy with Python / Scipy / wxPython for now. At the moment I'm trying to write an open source LabView equivalent, first results can be seen here:
http://oase.uci.kun.nl/~mientki/data_www/pylab_works/pw_animations_screensho...
Your best bet is
Nice work. I must confess, I'm not a huge fan of the "graphical programming" concept (otherwise I'd probably still be using labview). My wish would be a nice set of technical widgets (plots, knobs, sliders, gauges etc.) which are 1) documented and 2) integrated with a wxPython GUI-designer like wxGlade. In fact, a "technical edition" of wxGlade with such things integrated would make creating data-acquisition application easy to the newcomer without compromising flexibility.
I'm in the middle of writing a real time plot widget, based on direct canvas drawing, don't know yet how fast it is. I hope to make a video of it next week.
I'll look forward to checking it out.
But I wonder if you've a good data-acquisition module. I've one now (can use Soundcard , some NI-modules and several dedicated DAQ cards), but it's in fact a windows executable that I can control from Python.
Our data-acquisition modules are designed around the specific data/hardware we work with and hence are not particularly generic. I tend to write wrappers for C-based device drivers as required. We have a near-complete SWIG-generated wrapper-set for the (now obsolete) NI-DAQ drivers. Comedi (the linux DAQ-card drivers) already come with python wrappers. I couldn't get SWIG-wrappers for NI-DAQmx (the new driver API from NI) to build but now use a ctypes interface for the bits of the API we need. In fact, we've just migrated all our main driver-wrappers to ctypes. The benefit of not having to recompile C-code for each python version / platform outweighs the disadvantage of having to write/maintain the wrappers manually (as compared to auto-generation from header-files). I'm always happy to discuss this topic so if anyone want more details drop me an email. The NI-DAQmx drivers probably represent as good a data-acquisition API as you'll get. It's pretty much a 1:1 mapping to LabView nodes. The task-based approach is easy to work with although the NI documentation is far from perfect. You could make NI-DAQmx task nodes for your pylab_works framework. If you need cross-platform, re-implement the required functionality on linux with Comedi. The main recommendation I would make to anyone writing data-acquisition stuff in python is Use Traits/TraitsUI! The ability to auto-generate a GUI to configure hardware objects based on their Traits definitions is a *huge* productivity saving.
And of course I', looking for a more OS-indepedant solution.
Amen. cheers, Bryan
cheers, Stef
![](https://secure.gravatar.com/avatar/0e31f673b2f054ea61da64e35bd52cc0.jpg?s=120&d=mm&r=g)
Hi Stef,
unfortunately you're not able to post your code, (btw why not ?)
Although I started developing the plot-widget in my own time (I did publish this first version on my home web-site (now defunct due to lack of time)), development continued at my workplace over 2 years or more now so now the code ownership is ambiguous. The best plan is for me to get permission to release the code. Unfortunately, upper management are a bit suspicious of OSS at my workplace. I'm working on this...
but maybe you can answer a few questions ....
Bryan Cole wrote:
Hi,
I'm an ex-LabView user, now using python for lab data-acquisition and analysis for some years now. It's well worth the switch.
I'm too a former MatLab / LabView user, and I'm quit happy with Python / Scipy / wxPython for now. At the moment I'm trying to write an open source LabView equivalent, first results can be seen here:
http://oase.uci.kun.nl/~mientki/data_www/pylab_works/pw_animations_screensho...
Your best bet is
Nice work. I must confess, I'm not a huge fan of the "graphical programming" concept (otherwise I'd probably still be using labview). I don't think LabView and Visual Programming are identical. In my humble opinion, LabView violated against some vey basic rules,
Bryan Cole wrote: like flattness of information, and uniformity / simplicity.
My wish would be a nice set of technical widgets (plots, knobs, sliders, gauges etc.) which are 1) documented and 2) integrated with a wxPython GUI-designer like wxGlade. In fact, a "technical edition" of wxGlade with such things integrated would make creating data-acquisition application easy to the newcomer without compromising flexibility.
the you're lucky, ... ... I tried to get wxGlade running on 2 different machines, both failed ;-)
I'm in the middle of writing a real time plot widget, based on direct canvas drawing, don't know yet how fast it is. I hope to make a video of it next week.
The NI-DAQmx drivers probably represent as good a data-acquisition API as you'll get. It's pretty much a 1:1 mapping to LabView nodes. The task-based approach is easy to work with although the NI documentation is far from perfect. You could make NI-DAQmx task nodes for your pylab_works framework. If you need cross-platform, re-implement the required functionality on linux with Comedi.
NI-DAQmx would be a good standard, and I think I've even seen a Python wrapper for it, but I can't find it anymore. In fact the windows program I use in PyLab_Works also contains a NI-DAQmx wrapper.
The main recommendation I would make to anyone writing data-acquisition stuff in python is Use Traits/TraitsUI! The ability to auto-generate a GUI to configure hardware objects based on their Traits definitions is a *huge* productivity saving.
You might be quit right, I've heard this reasoning more than once, but .... ... I'm looking at the wrong documents or ... I'm simply too stupid or ... I'm a completely spoiled windows user but I really really don't understand one bit of Traits :-( cheers, Stef
![](https://secure.gravatar.com/avatar/5c9fb379c4e97b58960d74dcbfc5dee5.jpg?s=120&d=mm&r=g)
On Sun, Mar 02, 2008 at 06:24:12PM +0100, Stef Mientki wrote:
The main recommendation I would make to anyone writing data-acquisition stuff in python is Use Traits/TraitsUI! The ability to auto-generate a GUI to configure hardware objects based on their Traits definitions is a *huge* productivity saving.
You might be quit right, I've heard this reasoning more than once, but .... ... I'm looking at the wrong documents or ... I'm simply too stupid or ... I'm a completely spoiled windows user but I really really don't understand one bit of Traits :-(
Have you tried looking at: http://gael-varoquaux.info/computers/traits_tutorial I wrote it specificaly targetting someone with no prior knowledge of GUI developement or even object oriented programming. HTH, Gaël
![](https://secure.gravatar.com/avatar/0e31f673b2f054ea61da64e35bd52cc0.jpg?s=120&d=mm&r=g)
Gael Varoquaux wrote:
On Sun, Mar 02, 2008 at 06:24:12PM +0100, Stef Mientki wrote:
The main recommendation I would make to anyone writing data-acquisition stuff in python is Use Traits/TraitsUI! The ability to auto-generate a GUI to configure hardware objects based on their Traits definitions is a *huge* productivity saving.
You might be quit right, I've heard this reasoning more than once, but .... ... I'm looking at the wrong documents or ... I'm simply too stupid or ... I'm a completely spoiled windows user but I really really don't understand one bit of Traits :-(
Have you tried looking at: http://gael-varoquaux.info/computers/traits_tutorial I wrote it specificaly targetting someone with no prior knowledge of GUI developement or even object oriented programming.
thanks Gael, I didn't know these manuals, but I think I'm still missing the clue completely. What I understand is that traits is a smart replacement of "*arg, **kwargs" (which I've never used either). But being a smart replacement, it also makes it a complex / difficult replacement. As far as I understand, your presentation is about how you can easily create a GUI interface with Traits. Please don't understand me wrong, I don't want to upset you, I think you're very valuable contributor to both this list and the Python community, but as follower of the KISS principle, again I don't understand it. Please tell me in 2 lines what's the essential difference between TraitsUI in your presentation, and the lines below (note that with a little effort even "Types" can be removed), so maybe I can add those essentials to my code, or even might switch to traits ;-) Names = [ 'For All Signals', 'AutoScale', 'Upper Value', 'Lower Value' ] Values = [ False, True, 200, 20 ] Types = [ bool, bool ] OK, Values = MultiLineDialog ( Names, Values, Types, 'Set Border Values', width = 70 ) cheers, Stef
![](https://secure.gravatar.com/avatar/5c9fb379c4e97b58960d74dcbfc5dee5.jpg?s=120&d=mm&r=g)
On Mon, Mar 03, 2008 at 08:21:52PM +0100, Stef Mientki wrote:
What I understand is that traits is a smart replacement of "*arg, **kwargs" (which I've never used either). But being a smart replacement, it also makes it a complex / difficult replacement.
Well, its much more than that. Traits can be seen as three things: * Type validation of attributes: the attributes of an object can be given a type descriptor (more precisely a validation method) and the compliance of the attribute is checked at run-time when this attribute is set. This is very useful for complex codebase, but probably not for you. * Reactive/callback programming made easy. When you set the attribute of a HasTtraits object, a method of the object can be called to handle this change. This is known as reactive programming and is a great programming pattern that makes your code easier to read and more modular. I couldn't stress this more. * Visualization made easy: from the two bullet points above, TraitsUI can generate interactive dialogs. The automatic generation of dialogs combined with the reactive programming makes the codebase very light and nice to read.
but as follower of the KISS principle, again I don't understand it.
KISS is great, but remember: 1 month of hard work can save you one week end of learning. If you start doing interactive GUIs, you won't be able to get around learning a few things, and I think it is easier to learn Traits than the alternatives.
Please tell me in 2 lines what's the essential difference between TraitsUI in your presentation, and the lines below (note that with a little effort even "Types" can be removed), so maybe I can add those essentials to my code, or even might switch to traits ;-)
Names = [ 'For All Signals', 'AutoScale', 'Upper Value', 'Lower Value' ] Values = [ False, True, 200, 20 ] Types = [ bool, bool ] OK, Values = MultiLineDialog ( Names, Values, Types, 'Set Border Values', width = 70 )
No object oriented programming. I don't believe you can do complexe codebases without OOP. Yes you can fight to avoid it, but you are doing yourself more harm than good. And besides, it is not that hard. In addition you don't have any reactive programming: the code above cannot be interactive. This is what I call a "visual script". Going from program-driven logics, where the user is presented sequentially a set of dialogs, to user-driven logics, where the user (or an experiment) keeps interacting with the program, will require a paradigm shift. I believe that Traits will make this paradigm shifte easier than any alternative. I also believe your second best bet is PyQt. But Traits has a nice model/view separation in which you can get the reactive programming without the GUI event-loop, and that's really nice. In short, yes you do have to learn things, but you won't get an interactive program for free, sorry. Gaël
![](https://secure.gravatar.com/avatar/0e31f673b2f054ea61da64e35bd52cc0.jpg?s=120&d=mm&r=g)
hi Gael, I might even agree more with you than you or I thought at first sight ... Gael Varoquaux wrote:
Traits can be seen as three things:
* Type validation of attributes: good point, if you know how to handle the exceptions, instead of "error 1229: contact your distributor" * Reactive/callback programming made easy. very good point, should be done all the time ! * Visualization made easy: it's boring, but also a very good point, although I'm not a MS fan at all, all programs should be good as Excel at this point.
but as follower of the KISS principle, again I don't understand it.
KISS is great, but remember: 1 month of hard work can save you one week end of learning. If you start doing interactive GUIs, you won't be able to get around learning a few things, and I think it is easier to learn Traits than the alternatives.
I'll hope the future will change that: simple programming for everyone !
No object oriented programming. I don't believe you can do complexe codebases without OOP. agreed. In addition you don't have any reactive programming: the code above cannot be interactive. This is what I call a "visual script". Going from program-driven logics, where the user is presented sequentially a set of dialogs, to user-driven logics, where the user (or an experiment) keeps interacting with the program, will require a paradigm shift. More than agree, my adagiao: "the best programs are written by users", unfortunately programming is yet too difficult for most domain experts. I believe that Traits will make this paradigm shifte easier than any alternative. I also believe your second best bet is PyQt. But Traits has a nice model/view separation in which you can get the reactive programming without the GUI event-loop, and that's really nice.
In short, yes you do have to learn things, but you won't get an interactive program for free, sorry.
And now I get a strange feeling, ... ... that I'm working on some kind of traits, maybe a lot less sophisticated, but on the other hand much easier ;-) thanks for the explanation, cheers, Stef
![](https://secure.gravatar.com/avatar/5c9fb379c4e97b58960d74dcbfc5dee5.jpg?s=120&d=mm&r=g)
On Mon, Mar 03, 2008 at 09:29:11PM +0100, Stef Mientki wrote:
And now I get a strange feeling, ... ... that I'm working on some kind of traits, maybe a lot less sophisticated, but on the other hand much easier ;-)
Neware, you might be reinventing the wheel. As you try to take your ideas further, you will probably end up with the same problems Traits ahd to face three years ago. I don't believe in the "this is too complicated for me, let me reinvent something similar but different" approach. Anyhow, I which you good luck. I am interested in what might come out, however I'll stick with Traits, because I know it has been used for years in real-world large project and is now at its third major version, with many changes benefiting from experience. Gaël
![](https://secure.gravatar.com/avatar/07a8f7b8193f92fa9f33f6a07691c48a.jpg?s=120&d=mm&r=g)
hi Gael, Gael Varoquaux wrote:
On Mon, Mar 03, 2008 at 09:29:11PM +0100, Stef Mientki wrote:
And now I get a strange feeling, ... ... that I'm working on some kind of traits, maybe a lot less sophisticated, but on the other hand much easier ;-)
Neware, you might be reinventing the wheel. Don't think so, let's say I'm trying to make an octagon, not as well as a wheel, but better than a square. (or am I creating a hoovercraft ;-)
We started this discussion in november last year, I had the plan to use Vision to develop a LabView like environment. You were the one who told me that Enthought's product based on TraitsUI would be the best. I agreed with you, but as nobody has seen the Enthought product, and it would last to the end of 2007 before it was made public, I decided that it didn't fit my time schedule. (And by now I still haven't seen anything from Enthought ;-) Going for thé best, is not always thé best choice, if we would go for fusion now, you wouldn't be able to read this mail ;-)
As you try to take your ideas further, you will probably end up with the same problems Traits ahd to face three years ago. I don't believe in the "this is too complicated for me, let me reinvent something similar but different" approach.
Anyhow, I which you good luck. I am interested in what might come out, however I'll stick with Traits, because I know it has been used for years in real-world large project and is now at its third major version, with many changes benefiting from experience.
I agree, Traits might be a very good choice (once you've mastered it), so again I fully agree there's no single argument to leave Traits, but there are a few obstacles to start with Traits. cheers, Stef
![](https://secure.gravatar.com/avatar/39916bae984cb93b797efd2b175f59c0.jpg?s=120&d=mm&r=g)
On Tue, 04 Mar 2008, Stef Mientki apparently wrote:
there are a few obstacles to start with Traits.
I have not really played with Traits yet, but at first approach it seems pretty natural. What are the obstacles? Cheers, Alan Isaac
![](https://secure.gravatar.com/avatar/0e31f673b2f054ea61da64e35bd52cc0.jpg?s=120&d=mm&r=g)
Alan G Isaac wrote:
On Tue, 04 Mar 2008, Stef Mientki apparently wrote:
there are a few obstacles to start with Traits.
I have not really played with Traits yet, but at first approach it seems pretty natural. What are the obstacles?
Don't let you stop by my remarks ! But for a non-programmer like me, it doesn't feel natural at all, so my learning curve is just too steep. Although I'll certainly will look at it when I've some more time. cheers, Stef
![](https://secure.gravatar.com/avatar/39916bae984cb93b797efd2b175f59c0.jpg?s=120&d=mm&r=g)
On Tue, 04 Mar 2008, Stef Mientki apparently wrote:
But for a non-programmer like me, it doesn't feel natural at all, so my learning curve is just too steep.
I'm just a user too. Did you try it at all? You can start by just letting Traits handle some simple type checking with predefined traits: <URL:http://code.enthought.com/traits/doc/UM/Traits2_UM_3.html> This is not mind bending, but it may not meet a need of yours either ... Cheers, Alan
![](https://secure.gravatar.com/avatar/0e31f673b2f054ea61da64e35bd52cc0.jpg?s=120&d=mm&r=g)
hi Allen, Alan G Isaac wrote:
On Tue, 04 Mar 2008, Stef Mientki apparently wrote:
But for a non-programmer like me, it doesn't feel natural at all, so my learning curve is just too steep.
I'm just a user too. Did you try it at all?
no, I only try things when I see it's "direct" relevance ...
You can start by just letting Traits handle some simple type checking with predefined traits: <URL:http://code.enthought.com/traits/doc/UM/Traits2_UM_3.html> This is not mind bending, but it may not meet a need of yours either ...
indeed I see no connection to the major headlines of my application :-( nonetheless, thanks for the link, Stef
![](https://secure.gravatar.com/avatar/39916bae984cb93b797efd2b175f59c0.jpg?s=120&d=mm&r=g)
Alan G Isaac wrote:
<URL:http://code.enthought.com/traits/doc/UM/Traits2_UM_3.html>
On Tue, 04 Mar 2008, Stef Mientki apparently wrote:
indeed I see no connection to the major headlines of my application :-(
Just to be clear: this link was only meant to show that Traits is nothing to shy away from. For relevance, see instead <URL:http://code.enthought.com/chaco/scipy06/chaco_talk.html> Cheers, Alan Isaac
![](https://secure.gravatar.com/avatar/4049498c84d4a7a8f5f5afa5b86c4d2b.jpg?s=120&d=mm&r=g)
Stef Mientki a écrit :
I agree, Traits might be a very good choice (once you've mastered it), so again I fully agree there's no single argument to leave Traits, but there are a few obstacles to start with Traits. Stef,
This is only my 2 cts of a Traits's user-but-not-programmer guy. I can say that building a simple app with Traits (using Chaco2) works like a charm. I do like using Traits and so on. And people at enthought are very nice ;-) BTW, you have a lot of examples in source code tree, to begin. http://fredantispam.free.fr/snapshot.png Cheers, -- http://scipy.org/FredericPetit
![](https://secure.gravatar.com/avatar/0e31f673b2f054ea61da64e35bd52cc0.jpg?s=120&d=mm&r=g)
hi Fred fred wrote:
Stef Mientki a écrit :
I agree, Traits might be a very good choice (once you've mastered it), so again I fully agree there's no single argument to leave Traits, but there are a few obstacles to start with Traits.
Stef,
This is only my 2 cts of a Traits's user-but-not-programmer guy.
I can say that building a simple app with Traits (using Chaco2) works like a charm. Yes, Chaco looks very nice, very good color choses, I should have discovered that sooner ! And I'll certainly will integrate that into my application, but I've just finished integrating MatPlotLib, PyPlot and ScopePlot :-9 I do like using Traits and so on. And people at enthought are very nice ;-)
Fully agree, what I understand they were they guys that developed and promoted SciPy. cheers, Stef
BTW, you have a lot of examples in source code tree, to begin.
http://fredantispam.free.fr/snapshot.png
Cheers,
![](https://secure.gravatar.com/avatar/39916bae984cb93b797efd2b175f59c0.jpg?s=120&d=mm&r=g)
On Mon, 3 Mar 2008, Gael Varoquaux apparently wrote:
* Type validation of attributes: the attributes of an object can be given a type descriptor (more precisely a validation method) and the compliance of the attribute is checked at run-time when this attribute is set. This is very useful for complex codebase, but probably not for you.
Can you easily state briefly how this differs from the use of properties (with type checking on the setter)? Thank you, Alan Isaac
![](https://secure.gravatar.com/avatar/5c9fb379c4e97b58960d74dcbfc5dee5.jpg?s=120&d=mm&r=g)
On Mon, Mar 03, 2008 at 07:20:05PM -0500, Alan G Isaac wrote:
On Mon, 3 Mar 2008, Gael Varoquaux apparently wrote:
* Type validation of attributes: the attributes of an object can be given a type descriptor (more precisely a validation method) and the compliance of the attribute is checked at run-time when this attribute is set. This is very useful for complex codebase, but probably not for you.
Can you easily state briefly how this differs from the use of properties (with type checking on the setter)?
Fundementaly, I don't think this differs much. You have a lot of syntactic sugar around it, which makes the code more readable, and easier to reuse, as it gives the commonly used patterns (dynamical initialisation, delegation, as well as a lot of existing validation types). Don't under-estimate the work to get the syntax and the different patterns right. When you use it a lot, Traits simply "feels right". I was present when someone asked R. Kern (I hope you won't mind me quoting you, Robert) "what do you use Traits for?", and his reply was, "As an 'object' replacement". In addition, the property-calling code is written in C, which makes it orders of magnitude faster than standard Python properties. Cheers, Gaël
![](https://secure.gravatar.com/avatar/39916bae984cb93b797efd2b175f59c0.jpg?s=120&d=mm&r=g)
On Mon, 3 Mar 2008, Gael Varoquaux apparently wrote:
* Type validation of attributes: the attributes of an object can be given a type descriptor (more precisely a validation method) and the compliance of the attribute is checked at run-time when this attribute is set. This is very useful for complex codebase, but probably not for you.
On Mon, Mar 03, 2008 at 07:20:05PM -0500, Alan G Isaac wrote:
Can you easily state briefly how this differs from the use of properties (with type checking on the setter)?
On Tue, 4 Mar 2008, Gael Varoquaux apparently wrote:
Fundementaly, I don't think this differs much. You have a lot of syntactic sugar around it, which makes the code more readable, and easier to reuse, as it gives the commonly used patterns (dynamical initialisation, delegation, as well as a lot of existing validation types). Don't under-estimate the work to get the syntax and the different patterns right. When you use it a lot, Traits simply "feels right". ... In addition, the property-calling code is written in C, which makes it orders of magnitude faster than standard Python properties.
Thanks! Alan
![](https://secure.gravatar.com/avatar/3a6c2451f75d3309b1252476a8f6a4a6.jpg?s=120&d=mm&r=g)
On Mar 3, 2008, at 1:21 PM, Stef Mientki wrote:
What I understand is that traits is a smart replacement of "*arg, **kwargs" (which I've never used either).
Not at all, not more so than a car is just a smart replacement of horses with circular legs. :) Gael succinctly identifies the heart of the matter:
Going from program-driven logics, where the user is presented sequentially a set of dialogs, to user-driven logics, where the user (or an experiment) keeps interacting with the program, will require a paradigm shift. I believe that Traits will make this paradigm shifte easier than any alternative.
Let's look at your example:
Please tell me in 2 lines what's the essential difference between TraitsUI in your presentation, and the lines below Names = [ 'For All Signals', 'AutoScale', 'Upper Value', 'Lower Value' ] Values = [ False, True, 200, 20 ] Types = [ bool, bool ] OK, Values = MultiLineDialog ( Names, Values, Types, 'Set Border Values', width = 70 )
Presumably this dialog is part of a larger application. Can your user write a script to invoke parts of this dialog? Can the user have this dialog open while they have a different dialog open (i.e. non-modal view)? What if option "Foo" in that other dialog directly affects the AutoScale setting? If this is a plot, perhaps their mouse interaction with the plot turns off AutoScale, since they might be zooming in to a sub-region; how is that going to work? This dialog is presumably a controller for a single piece of your program; how will you embed this dialog inside a larger GUI panel when the user wants to act on several items at the same time? The more moving parts you have an in an application, the more relationships and interdependencies you have to manage. For most software, the best way to manage what would generally be an N^2 explosion of relationships is by grouping closely-related things into patterns that have well defined semantics. OOP by itself is not enough. Traits allows you to do reactive-based programming in Python, meaning that your components are much less tightly coupled. A very nice side effect is that one tends to write more explicit "model" classes, which are then viewed by view objects, and manipulated by controller objects. A user can easily script in this environment by directly manipulating the model with Python code. A designer can trivially switch out views. Your app suddenly stops being a rigid, procedurally-constructed closed box of UI code tightly coupled with domain logic; instead, it is a live system of objects that communicate via events. You can fire up your application with IPython (or embed a shell like PyCrust into it) and introspect and interact with live parts of your running application. This event-/message-driven approach to software construction not only fits very well with the goal of providing a friendly computation environment for non- programmer domain experts, but it is actually the essence of object oriented programming. Just my $.02 as a long-time traits user. :) -Peter
![](https://secure.gravatar.com/avatar/07a8f7b8193f92fa9f33f6a07691c48a.jpg?s=120&d=mm&r=g)
Peter Wang wrote:
On Mar 3, 2008, at 1:21 PM, Stef Mientki wrote:
What I understand is that traits is a smart replacement of "*arg, **kwargs" (which I've never used either).
Not at all, not more so than a car is just a smart replacement of horses with circular legs. :)
yes, just like a "deux Chevaux Vapeur", or "ugly duck" as it called in our country, but at least I get forward ;-) thanks, Stef Mientki
![](https://secure.gravatar.com/avatar/3a822f456118044475eede4f68650baa.jpg?s=120&d=mm&r=g)
I'm in the middle of writing a real time plot widget, based on direct canvas drawing, don't know yet how fast it is. I hope to make a video of it next week.
BC> I'll look forward to checking it out. Me too! I'll keep an eye on this list :) Best regards, -- Onno Broekmans
![](https://secure.gravatar.com/avatar/40489da22d2dc0cc12596420bb810463.jpg?s=120&d=mm&r=g)
Bryan Cole wrote:
Hi,
I'm an ex-LabView user, now using python for lab data-acquisition and analysis for some years now. It's well worth the switch.
Your best bet is http://pyqwt.sourceforge.net/
You're right, matplotlib/chaco are too slow for "interactive real-time" type work. The strengths of these packages are their presentation-quality output (vector and anti-aliased bitmap graphics).
Are you sure you meant that *chaco* is too slow? The stated difference of chaco with matplotlib is interactive plotting and I know a bit of effort goes in to making it fast. I'm curious what problems you tried chaco on for which it was too slow. -Travis O.
![](https://secure.gravatar.com/avatar/9ae4ce9eef0ed502005163f51792af3a.jpg?s=120&d=mm&r=g)
Are you sure you meant that *chaco* is too slow? The stated difference of chaco with matplotlib is interactive plotting and I know a bit of effort goes in to making it fast.
You're quite right to pull me up on this. In fact, I've not tested chaco for this type of application so I can't say for sure if it's fast enough or not. I guess, my expectation was that it would not be much faster than matplotlib (given they both use Antigrain for rendering, which tends to be the bottleneck). Whenever I tried any type of anti-aliased drawing (antigrain or cairo) there is always a significant performance hit (on linux anyway).
I'm curious what problems you tried chaco on for which it was too slow.
Sounds like I should revisit chaco (I haven't tried it in a while). My main problem with it is lack of documentation (this is really what has prevented me from testing it extensively). cheers, Bryan
-Travis O.
![](https://secure.gravatar.com/avatar/3a6c2451f75d3309b1252476a8f6a4a6.jpg?s=120&d=mm&r=g)
On Mar 2, 2008, at 3:55 PM, Bryan Cole wrote:
Are you sure you meant that *chaco* is too slow? The stated difference of chaco with matplotlib is interactive plotting and I know a bit of effort goes in to making it fast.
You're quite right to pull me up on this. In fact, I've not tested chaco for this type of application so I can't say for sure if it's fast enough or not. I guess, my expectation was that it would not be much faster than matplotlib (given they both use Antigrain for rendering, which tends to be the bottleneck). Whenever I tried any type of anti-aliased drawing (antigrain or cairo) there is always a significant performance hit (on linux anyway).
Although Chaco uses Agg, the nature of *how* it uses Agg is very different from matplotlib. Also, Chaco's internal architecture is designed around interactivity. There are several examples with displaying live updating data: https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/advanced/da... The spectrum analyzer example at the very bottom of the Chaco gallery uses PyAudio to display a realtime FFT and spectrogram of the sound input: http://code.enthought.com/chaco/gallery/index.shtml Also, Chaco has several different backends it can use for output, not just Agg. I recently greatly improved the OpenGL backend so it is extremely fast on all three major platforms (although this has not been merged into the trunk just yet).
Sounds like I should revisit chaco (I haven't tried it in a while). My main problem with it is lack of documentation (this is really what has prevented me from testing it extensively).
I apologize for the continuing lack of extensive documentation. The examples are a good place to start, and the classes all have some level of comments describing the common traits. I think the data_strea.py example would probably be a good place for you to try out your data acquisition and display. (It does require wxPython.) And, as always, you can email the list with questions. -Peter
![](https://secure.gravatar.com/avatar/3a822f456118044475eede4f68650baa.jpg?s=120&d=mm&r=g)
Hi Bryan, BC> I'm an ex-LabView user, now using python for lab data-acquisition and BC> analysis for some years now. It's well worth the switch. Ah, that's great to hear! BC> Your best bet is BC> http://pyqwt.sourceforge.net/ That looks good, I'll check it out asap. BC> You're right, matplotlib/chaco are too slow for "interactive real-time" BC> type work. The strengths of these packages are their BC> presentation-quality output (vector and anti-aliased bitmap graphics). Hm, that's what I suspected, but I hadn't been able to find different packages explicitly meant for real-time plotting. Anyway, thanks a lot for sharing your experiences!! Best regards, -- Onno Broekmans
![](https://secure.gravatar.com/avatar/5c9fb379c4e97b58960d74dcbfc5dee5.jpg?s=120&d=mm&r=g)
On Thu, Feb 28, 2008 at 09:57:00AM +0100, scipy-user@onnodb.com wrote:
Another issue appears to be the creation of simple user interfaces. This is very intuitive in LabVIEW, but could someone here give some advice on a way to combine a UI and plot windows in a not-so-difficult to learn way in Python? What's your own experience?
Traits/TraitsUI are absolutely great for this. I have used them in a way very similar to what you are doing. You can find notes that should help you learn how to create UIs easily starting here: http://gael-varoquaux.info/computers/traits_tutorial/index.html You probably want to use Chaco, rather than MPL, for plotting speed reasons. Hopefully these tutorials can get you on your way: https://svn.enthought.com/enthought/wiki/Tutorials/SimpleChaco2Plot https://svn.enthought.com/enthought/wiki/Tutorials/SimpleEngrTraitsAppWithCh... I suggest you do not try to start with Envisage, as it is overkill for your current needs, can be added later, and is a bit harder to learn. Hope this helps, Gaël
![](https://secure.gravatar.com/avatar/3a822f456118044475eede4f68650baa.jpg?s=120&d=mm&r=g)
Hi Gael, GV> Traits/TraitsUI are absolutely great for this. I have used them in a way GV> very similar to what you are doing. You can find notes that should help GV> you learn how to create UIs easily starting here: GV> [snip] Thanks a lot for all your advice. I'll try soon, and try to post back later with my experiences! Best regards, -- Onno Broekmans
participants (10)
-
Alan G Isaac
-
Bryan Cole
-
Fernando Perez
-
fred
-
Gael Varoquaux
-
Peter Wang
-
scipy-user@onnodb.com
-
Stef Mientki
-
Stef Mientki
-
Travis E. Oliphant