All of the notes from the intro of day 1. This includes some ideas about how to use
visualization in your research and an intro to the tools we are going to be using to
do our visualizations.
We are going to break up our code into two parts - one part to calculate trajectories and save the info to a text file,
and the second part to read in saved data and make png plot images.
This is exactly the code from "Choose your
Own Adventure #1" from Day 4, but with some code to save information about the trajectories in a text file
instead of plotting. Feel free to just grab the end bits of this code that does the saving of positions and velocities
as your code probably differs in initial conditions.
If you worked with galaxy mergers last week, use this code to generate movies from saved data. See the "Resources" section
for the data download. Note - its a 77Mb zip file.
Step 1: Download FFmpeg from here. There are
binaries for most distributions under "Get the packages" so select one that matches your OS.
Step 2: Once you have a series of images generated from the "Code" section above, you can create a
movie with the following (assuming /FFMPEG_DIRECTORY/ is the directory where FFmpeg unpacks):
/FFMPEG_DIRECTORY/ffmpeg -framerate 15 -pattern_type glob -i 'traj*.png' -c:v libx264 -pix_fmt yuv420p out.mp4
The above is for a Mac, but the calling sequence might be slightly different on your OS, so let someone
know if it doesn't work and we can take a look at it.
Note: If you get a "width not divisible by 2" error, this means your saved images have a height or width
that is not divisible by 2. You can solve this with a comment such as (if the width is not divisible by 2):
/FFMPEG_DIRECTORY/ffmpeg -framerate 15 -pattern_type glob -i 'traj*.png' -vf "crop=in_w-1:in_h" -c:v libx264 -pix_fmt yuv420p out.mp4
But certainly let someone know if this doesn't fix the problem.
Also, check out "Resources" section for some FFmpeg links.
Lots of information about what the different parameters are for using FFmpeg to make a movie from a series of png files.
A list of other movie making resources if you HATE FFmpeg.
77Mb of galaxy merger awesomeness.