[Tutor] Interactive plots...
pine508 at hotmail.com
Sun Mar 30 05:23:08 CEST 2008
> I am thinking about writing a program which will involve, among other
> things, displaying a plot of a series of numbers. The idea is that
> you could click on the points and move them to change the numbers.
> Reverse-plotting, I suppose. It need not be complex; the numbers
> will all be zero or one, and it's only necessary to flip the bits, so
> click-and-drag is seriously overkill. Really it would be better to
> just double-click on a point to switch it from one value to the other.
> Can anyone point me in the right direction? I have written some
> programs in python before, including TKinter, but this new project is
> beyond the point that I know where to even start looking. :)
> In case you care, the application is in functional brain imaging; the
> brain scans generate a certain number of time points (say 500) and
> then the motion of the subject is also calculated. Standard practice
> is to generate a "censor" file composed of zeros and ones, where zero
> indicates that that time point had excessive motion and must be
> disregarded. I want to display a graph of the motion over time, and
> allow quick and easy interactive editing of the censor time series in
> visual parallel to the motion graph. This would save a lot of time;
> at present everyone does this in Excel, which being a horrible
> Windows program can't be integrated into the predominantly UNIX-based
> processing pipeline. And in any case, it requires manually typing
> all the zeros, looking back and forth between the graph of motion and
> the list of numbers.
> I have already written a program to algorithmically generate the
> censor time series from the motion data, but it is absolutely
> essential to be able to manually double-check and if necessary make
> minor edits. I'd like to be able to keep that functionality in
> Python rather than sending everyone back to Excel... if possible!
> Thanks very much for any help.
Without knowing more, it seems that this is going to be a lot of work, but if it will be used for years, probably worth it. For graphing: in the wxPython widget toolkit there is a PyPlot widget which does plotting, or you could use Matplotlib, a Python plotting library (with similarities to Matlab) with lots of functions. In either case you can catch mouse events on the plot and connect those events to changing the display of which parts of the motion graph are "censored" (might not be possible with PyPlot; definitely with Matplotlib). That way you could censor (or uncensor) sections of the trace right on the graph, and the censor time series would be updated from that.
I'd also say about Excel ("being a horrible Windows program") that it is not horrible, unless you meant that all Windows-only programs were horrible by virtue of running on Windows? Excel is a good program, in my opinion. But if you want to keep it all under Linux and sort of all of a piece, I get that.
How well do you know your celebrity gossip?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor