What is GVB?
GVB (Good ViBrations) is a small program to simulate vibrations in 1 and 2 dimensions, written by me (Pietro Battiston) in March 2008 as a university “homework”. Here are some screenshots.
It features several calculation, drawing methods and starting positions and the ability to dump frames to png (so that they can be used to build animations).
It uses scipy for calculations, Gtk (pygi) and Glade for the user interface and Cairo for graphics.
Gvb development is substantially finished, so don't expect big “spontaneous” improvements. However, in the remote case someone is interested in some particular feature (for example from the wishlist), I could actually implement it, and if someone spots a bug I will probably fix it, so feedback is welcome: me [at] pietrobattiston [dot] it.
Where can I get it?
You can always find the last version at the address http://pietrobattiston.it/gvb
OR you can get last development GVB with git:
git clone git://pietrobattiston.it/gvb
OR if you use Debian (at least Lenny) or Ubuntu (at least Intrepid), just install it from the repositories, with synaptic or by giving the command:
sudo apt-get install gvb
in a terminal.
- Why Python?
I first started writing gvb in C. After some weeks, it finally had a decent interface, but I still had big problems with calculation methods I wasn't able to debug.
Then, one day, I decided to start again from scratch in Python. After one week, gvb was finished and was more complete than what I planned.
- But Python is slow and GVB needs a lot of calculation!
GVB relies on scipy for the calculation, and scipy relies on Lapack and Blas, and Lapack and Blas aren't slow (and they are compiled C or Fortran, not Python). So don't worry. If GVB is slow, it's because the calculations to do really are hard (or eventually because I did a mistake). To spot the difference between “Python code” and “Python relying on scipy”, see the performance improvements between “naif” (pure Python) and “matrix” (scipy) methods.
- I need a start position not provided / I need a rectangular (non square) grid / I need to set start speeds, not only positions.
Those possibilities are not provided by the GUI, but this is not a big problem: you can create your own start position as a simple text file containing the shape (how many rows, comma, how many columns) of the grid on the first line, the positions (just a long list of comma-separated values; first the first row, then the second…) on the second line and the speeds (again, a list of comma-separated values, eventually comma-separated zeros) on the third line, and a newline character at the end of the file.
- I dumped a lot of png frames. How do I create a movie with them?
If you have avconv installed, move to the directory where the pngs are and (supposing there are only those png) give the following command:
avconv -i %08d.png video.mp4
Gueic is totally GPLv3
I will maybe do none of those things. But if the program actually catches some interest and if I have some spare time, I could implement some. So if you are interested (and more still if you are offering to help), please contact me.
- Threading may help separating scipy calls from GUI so that program doesn't stall during intense calculation
- Some heuristic could be used to anticipately estimate time needed for intense calculations, so that a progress bar could be shown
- Some exception catching should be implemented (e.g: permissions not owned to write to a file, or not enough memory for a given calculation actually leave the program in an unpredictable state)
- It wouldn't be hard to provide the ability to handle 3D “vibrations” too… but calculators would be slightly less simple than 2D ones, and drawings much more confused
- The ability to apply masks (select a set of points in the 2D grid that are fixed) would allow observation of interesting (and, for example, more regular) vibrations.
- The possibility to highlight nodes (points that do not move) would be nice.
- Some dampening could be allowed
- Elasticity and mass could vary from point to point
- At the moment, the editor allows the creation of nearly every conceivable 1D start position. Instead, something better could be implemented to create 2D start positions.
- There should be the possibility to set rectangular (non square) grids.
- Creation of start position and drawings could be optimized a lot.
When dumping to png, plotting to screen should still be enabled.
- The ability to output a .wav file to make you hear the vibration of a given point would be nice.
- In the “eig” method, the operator matrix is very sparse. This could make the process of calculating its eigenvalues and eigenvectors much faster, but I'm not really sure and scipy released version still doesn't implement anything useful (as of March 2008)
- Ability to remember some preferences (e.g: last configuration seen, last methods used)
- Ability to save some “metadata” to files (e.g: calculation data)