T8:
Visualization of Galaxies in cosmological simulations
We are going to use Splotch to visualize galaxies
out of the Magneticum simulations.
How to Prepare:
(This has to be done only once at the beginning !)
- Copy over the spltch code:
cp -r ~/splotch .
- Change into the splotch directory
cd splotch
- Edit the Makefile
vi Makefile
uncomment the OPT += -DLONGIDS option
comment the #OPT += -DUSE_MPI option
- compile the code
make -j
- Change back to the directory once above
cd ..
- Download a example parameterfile
wget https://www.usm.uni-muenchen.de/~dolag/Lille2026/T08/demo.par
How to do your first image:
The galaxies_box4_uhr.txt
and the galaxies_box4_uhr_ideal.txt files contains a list of interesting objects, defined by 5 numbers: SNR and SUB defines the file and X, Y and Z the coordinate. Here an example:
SNR SUB X Y Z
136 12 44319.5 11750.2 15495.4
136 9 24555.5 37925.5 41413.5
036 10 32042.6 44672.2 22093.5
Now, select a galaxy of the list, download the file needed and edit the demo.par file:
- Copy the simulation data:
wget https://www.usm.uni-muenchen.de/~dolag/Box4uhr/snapdir_[SNR]/snap_[SNR].[SUB] where you replace the bracketed labels with the numbers from the file for the selected galaxy.
- In the demo.par do the same replacement to specity the file to be read: infile=snap_[SNR].[SUB]
- Then also set the focus of the camera to the point where you want to look at by setting lookat_x=[X], lookat_y=[Y] and lookat_z=[Z], where you replace the bracketed values by the numbers for that galaxy from the file.
- Finally place the Camera at a useful position, e.g.: camera_x=[X], camera_y=[Y+200] and
camera_z=[Z].
- Now execute Splotch by:
./splotch/Splotch6-generic demo.par
You should have an image demo0000.tga which you can watch.
- As the
.tga image format is not recognized by all image viewers, you can convert it into more known frmats by:
convert demo0000.tga demo0000.png
You should now have an image demo0000.png which you can watch.
How to improve your image:
Now you have a large range of possibilities to influence the appearance of the result. In general, lines starting
with # as well as unused or unknown parameters in the parameter file are ignored. ptypes=2
defines that you want to visualize two particles species and ptype0=0 defines that the first
species are the gas particles of the simulation and ptype1=4 defines that the second ones are
the star particles in the simulation. Accordingly, all parameters ending with 0 refer to the
gas particles and the one ending with 1 are referring to the stellar particles.
- brightness[0/1]=[value] controls the overall brightness a component becomes. If you set
it to 0 for a component then this component disappears.
- palette[0/1]=[filename] defines the color table used to translate a value to RGB color.
Have a look on the files in /ptmp2/T13/WhatYouNeed/palettes/ to see what you could us.
- outfile=[filename] controls the name of the image files produced and xres=[value]
and yres=[value] control the dimension of the produced image.
- pic_gamma=[value], pic_brightness=[value] and pic_contrast=[value] allow to
manipulate the final image. Note that gamma here is the real gamma correction, while programs
like photo shop or similar typically interpret gamma as 1/gamma, see also
here.
- You have various ways to change the appearance of your image by controlling the quantity which is used
to get visualized.
color_[min/max][0/1]=[value] allows to set the min/max values used. When you run Splotch it
displays you the underlying min/max values of all particles.
color_log[0/1]=[TRUR/FALSE] allows to use the logarithm of the quantity (if you change, do not forget
to adapt the min/max values accordingly.
How to make a movie:
Splotch allows you to create image sequences directly in a very simple way. You create just a file
with the evolution of some of the parameters and Splotch will produce an image for each line in
the file. So simply:
When you now run Splotch files with increasing numbers will be created, which you can glue together as a
movie after wards. For example you can set the camera position as a circle around the object, see the movie below.
How to explore the unknown:
- You have the possibility to visualize (3D) vector quantities directly as RGB. Take the first galaxy from
above example and change:
color_label[0/1]=VEL
color_present[1/1]=63
color_is_vector[0/1]=TRUE
color_log[0/1]=FALSE
color_asinh[0/1]=TRUE
color_min[0/1]=-5
color_max[0/1]=5
Now re-run Splotch. The colors indicate the direction of the velocity and you should be able to identify
coherent motions (see example image below).
- Explore the galaxies in box3_uhr, do you find interesting ones ?
Example Image/Movie::