Debian Codegraph @

docs/faq.rst

raw
1 Frequently Asked Questions
2 ==========================
3 Here is a collection of the most common problems with using SPLASH. You may also wish to browse the archives of the `splash-users <http://groups.google.com/group/splash-users>`_ discussion list. See also the old `pgplot faq <http://users.monash.edu.au/~dprice/splash/pgplot.html>`__.
4
5 .. _sec:moviemaking:
6
7 How do I make a movie from splash output?
8 -----------------------------------------
9
10 First, make sure ffmpeg is installed using your package manager (e.g. ``brew install ffmpeg`` or ``sudo apt install ffmpeg``)
11
12 Since v3.10.0 splash now has a direct-to-mp4 backend. Hence to make a movie just give a filename like ``movie.mp4``
13 or select ``/mp4`` at the device prompt which will produce a file called ``splash.mp4``
14
15 You can also try a completely hands-free approach from the command line using the ``--movie`` flag::
16
17 splash --movie disc_0*
18
19 That's it!
20
21 Using ffmpeg to make a movie from png files
22 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23
24 With ffmpeg installed, you can use the script provided in splash/scripts/movie.sh, e.g.::
25
26 ~/splash/scripts/movie.sh
27
28 This should produce a movie called ``movie.mp4`` from your splash_*.png files. The contents of this script are just some options for ffmpeg that produce a nice movie::
29
30 #!/bin/bash
31 #
32 # script to make an mpeg4 movie from splash_*.png files
33 # requires ffmpeg utility
34 #
35 # DJP, Feb 2014
36 #
37 opts='-r 10 -vb 50M -bt 100M -vf setpts=4.*PTS'
38 ffmpeg -i splash_%04d.png $opts movie.mp4
39
40
41 The main options to play with are the bitrate (``-bt 100M``) that controls the quality and the ``-vf setpts=4.*PTS`` which controls how fast the movie plays (``setpts=1.*PTS`` gives 10 frames per second, this is usually too fast so we slow it down).
42
43 The industry-standard compression codec is the ``H.264`` MPEG codec which gives a nice small movie that is still good quality. The best way to reduce the movie size further is to restrict the data rate.
44
45 .. important::
46 The .mp4 files produced by ffmpeg as above will not play directly in the Slack app. To ensure this you need to mandate that the pixel format is
47 "yuv420p", by adding the flag ``-pix_fmt yuv420p``. You must also ensure that the page dimensions are given in even (not odd) numbers of pixels.
48
49 Can I make animated gifs?
50 ~~~~~~~~~~~~~~~~~~~~~~~~~
51
52 Another option is to produce an animated gif using the
53 ``convert`` utility that comes with the `ImageMagick <http://www.imagemagick.org>`_ package. As an example (kindly provided by John Mansour), use::
54
55 convert -delay 10 -loop 0 splash_*.png animatedgif.gif
56
57 where delay gives a delay in ms between frames, and loop determines whether the animated gif will loop (0= infinite, 1=1
58 loop, etc). The problem with an animated GIF is that they are slow unless you have *lots* of memory. However it is easy to convert an animated GIF into other movie formats.
59
60 I'm getting a segmentation fault, is splash broken?
61 ----------------------------------------------------
62
63 This could be a stacksize issue (particularly with large data reads). Try::
64
65 ulimit -s unlimited
66
67 before invoking splash.
68
69 How do I write a postscript/eps file for LaTeX?
70 -----------------------------------------------
71
72 See :ref:`sec:postscript`. At the graphics device prompt, type::
73
74 Graphics device/type (? to see list, default /xw): /eps
75
76 choose ``/eps``. This will write the output to a file called splash.eps in the current directory.
77 Alternatively you can specify the filename explicitly by typing "myfile.eps". The
78 file can be incorporated directly into LaTeX documents.
79
80 How can I get a colour scheme like the one Joe Bloggs uses?
81 -----------------------------------------------------------
82
83 Send me an image (any sensible format will do) containing a colour bar using the scheme you
84 want to rip off and I will add it into splash. Also feel free to play with `my scripts for grabbing colour maps <https://github.com/danieljprice/extractcmap>`_ yourself.
85
86
87 What about boundaries? How does the rendering work near a boundary?
88 -------------------------------------------------------------------
89
90 Usual practice in SPH simulations near boundaries is to introduce ghost
91 particles which mirror the real particles. splash does not explicitly
92 setup any ghost particles but will use any that are present in the data
93 (see next question for how to specify multiple particle types).
94 Additional particle types contribute to the rendering calculations but
95 not to the determination of the plot limits. Note, however, that splash
96 does *not* set up ghost particles itself, as this may depend on the type
97 and location of the boundary. Thus if your simulation uses ghost
98 particle boundaries, the ghost particles should be dumped alongside the
99 gas particles in the output file so that their positions, masses,
100 densities and smoothing lengths can be read into splash and used to
101 render the image appropriately.
102
103 How does splash handle multiple particle types?
104 -----------------------------------------------
105
106 splash can handle up to 6 different particle types. These can be turned
107 on and off in the :ref:`sec:menu-o`.
108 These types are be specified in the set_labels part of the read_data
109 routine, which contains some lines of code along the lines of:
110
111 ::
112
113 ntypes = 3
114 labeltype(1) = 'gas'
115 labeltype(2) = 'ghost'
116 labeltype(3) = 'sink'
117 UseTypeInRenderings(1) = .true.
118 UseTypeInRenderings(2) = .true.
119 UseTypeInRenderings(3) = .false.
120
121 which says that there are 3 particle types, with names as given, and
122 that types 1 and 2 are SPH particles and should be used in the rendering
123 where appropriate (i.e., only when plotting of this type is turned on in
124 the :ref:`sec:menu-o`). Particle types which are to be used in renderings
125 should have masses, densities and smoothing lengths read. Non-SPH
126 particle types (e.g. sink particles) can be optionally plotted on top of
127 :ref:`sec:renderplot`.
128
129 What does SPLASH stand for?
130 ----------------------------
131 Urrmmm... it has SPH in it and it sounded good. I thought of:
132
133 - "Some Pretty Little Application for Smoothed (particle) Hydrodynamics"
134 - "Smoothed Particles Look Amazingly Stunning Here"
135 - "So People Love Analysing Simulations of Hydrodynamics"
136 - "Simulating Particles Like A Superfast Horse"
137
138 Your suggestions on a postcard please.
139
140 SPLASH is so great. Can I send you loads of money?
141 --------------------------------------------------
142 I accept donations in the form of citations to the
143 `SPLASH paper <https://ui.adsabs.harvard.edu/abs/2007PASA...24..159P/abstract>`_ (Price, 2007, PASA, 24, 159-173). Just like sending cash, only... not.
144 This may change if I am flooded with requests from people wanting to send large
145 sums of money.