From CS 294-10 Visualization Sp10

Jump to: navigation, search

edit: I made this page last week but forgot to add the link from the main page, oops



I will be using the data that I generate as part of my research. I am in a computational biophysics group and my project involves simulating the dynamic spatial organization of photosynthesis proteins. My code generates text files containing the positions and other properties of a few thousand particles over time. Specifically, the data fields are particle type and id (N), x and y coordinates (Q), z layer (N), shape specifiers (radius, length, and orientation) (Q), energy (Q), interaction strength (N).

Software requirements

My workflow involves running code to generate data, visualizing the simulated data as images or movies, and computing statistical quantities based on the data (averages, correlations, etc). Currently I have two noninteractive programs that do these tasks: one to generate data files and movies, and another to read in the data files and compute statistics. Ultimately I hope to build an application that interactively integrates all of these functions, but for the scope of this project I will limit myself to the following tasks:

  • reading data from a series of text files
  • visualizing each time point as a frame in a movie
  • playing sequential frames in the movie
  • interactively tagging particles by clicking on them
  • using color to encode tagged status in subsequent movie frames
  • hopefully allowing interactive selection of hue and brightness encoding parameters

Status of visualizations

In the static 2D images I generate, I encode x and y coordinates with position, z layer with position (the two layers are visualized side by side although in my mental model they are stacked on top of each other), shape specifiers and type with shape and orientation, and type, energy, interaction strength, and tag all with color. This means that color is overloaded, sometimes redundant, and possibly confusing. I hope to use the result of this assignment to explore better combinations of hue and brightness to encode my nominal fields.


Here's a mock-up in keynote that includes a sample image using my current encodings. File:storyboard.001.jpg

Final write-up

Code and sample data set here: File:Anna visualizer.zip

I was able to implement most of my key features: load data files, visualize configurations, play multiple configurations as a movie, and change the color of particles. I didn't have time to implement the tag-by-clicking-on-particle functionality. But this is enough for me to start analyzing the data I generated this week, including the data set included with the code.

This took me a fair bit of time to write (20 hours?), but I was also learning wxPython from scratch as I went, so I'm quite pleased with what I was able to accomplish in a week. wxPython was a good choice of toolkit for me because I could use my previous Python knowledge, it has a lot of widgets, it comes with a great demo program (although the documentation itself is meager), and in the future the Python back-end will tie together image visualization (wxPython), data analysis code (normal Python), and scatterplot data displays (probably matplotlib).

To use the visualization

0. Install Python 2.5 or later and wxPython (both are probably already installed)
1. 'python pygs_visualizer.py'
2. Click on 'open files'
3. Select one or more data files to visualize
4. Click 'Open'
5. Play around with features!


  • Note that the directory from which files were read is displayed below the 'open files' button, and the frame number and layer are extracted from the file name ('layer0' files are drawn on the left, 'layer1' on the right).
  • Play a movie: Choose or type start time in 'current time', press 'play' to play, press 'pause' to stop. Movie automatically stops at the last frame, and 'current time' always displays the current time.
  • Zoom: Choose or type zoom fraction (<1 = zoom out, >1 = zoom in) in 'zoom', press 'redraw'.
  • Change image boundaries: Click a 'dilution' radio button, or type 'x' and 'y' value (finicky, sorry). The default 'dilution 0' is the appropriate choice for this data set.
  • Change colors: Click colored boxes, use native color selector (first 3 boxes active, no PSII tagged particles). The default colors are what I've been using and were chosen to be suggestive of photosynthesis, but they are not the ideal colors for many visualization tasks.


The controls are located in different places than in the storyboard, mostly because of what widget layouts are convenient to generate in wxPython. Frame selection and movie playing controls are grouped together, file selection and dilution controls are grouped together, and color selection controls are grouped together. I chose to put the 'zoom' control with the movie controls because those controls are meant to get adjusted frequently while exploring a data set, while the file selection and dilution controls should be set once at the beginning of a session and not changed thereafter. (Therefore, maybe the file selection controls should go in a start-up dialog and not be displayed as editable options during data exploration.) There is a subtle grayscale box surrounding each set of controls, but the distinction between boxes may not be strong enough to be worthwhile.

I couldn't figure out how to control the allowed set of values for wxPython's slider widget so it turned out to be a poor choice for a frame selector/movie progress bar. The combo box widget I chose instead is mediocre as a frame selector and does not function as a progress bar, but I couldn't find a better option.

Other features to add: click-to-tag, various data analysis and plotting capabilities, save images and movies, better scrolling, remove frames and/or manage multiple data sets, color encodings for energy and interaction strength dimensions.

[add comment]
Personal tools