Debian Codegraph @

docs/advanced.rst

raw
1
2 Advanced plotting examples
3 ==========================
4
5 Rendered plot of star formation data
6 ------------------------------------
7
8 This is an example using data provided by Paul Clark. The data is from
9 an SPH simulation of star formation in sphNG format. We read the dump
10 file as follows:
11
12 ::
13
14 dprice/dustfrag> splash omuk162
15
16 after which we get output along the lines of:
17
18 ::
19
20 ...
21 reading single dumpfile
22 >>>>>>>>>>>>>>>>>>>>>>>>>> omuk162 <<<<<<<<<<<<<<<<<<<<<<<<<<
23 double precision dump
24 File ID: FHydroRTMHD1
25 npart = 11744854
26 ...
27
28 and arrive at the main menu:
29
30 ::
31
32 You may choose from a delectable sample of plots
33 -------------------------------------------------------
34 1) x 7) v\dx
35 2) y 8) v\dy
36 3) z 9) v\dz
37 4) particle mass 10) u
38 5) h 11) grad h
39 6) density
40 -------------------------------------------------------
41 12) multiplot [ 4 ] m) set multiplot
42 -------------------------------------------------------
43 d(ata) p(age) o(pts) l(imits) le(g)end h(elp)
44 r(ender) v(ector) x(sec/rotate) s,S(ave) q(uit)
45 -------------------------------------------------------
46 Please enter your selection now (y axis or option):
47
48 here we want to plot a rendered plot of column density (density is in
49 column 6), so we type ``2`` for column 2 (y) as the y axis, ``1`` for column
50 1 (x) as the x-axis and at the render prompt ``6``, for density, ie:
51
52 ::
53
54 Please enter your selection now (y axis or option):2
55 (x axis) (default=1):
56 (render) (0=none) ([0:11], default=0):6
57 (vector plot) (0=none, 7=v) ([0:7], default=0):0
58 Graphics device/type (? to see list, default /xw): /xw
59
60 producing the plot shown in :numref:`fig:starpart1` – somewhat black!
61
62 .. figure:: figs/starpart1.png
63 :alt: star formation tutorial part 1a
64 :name: fig:starpart1
65 :width: 50.0%
66
67 First stage in the star formation figure tutorial: a simple render plot of density
68
69
70 The main thing to note is the limits on the colour bar (extending from :math:`0`
71 to :math:`10^{7}` on a linear scale) which is the main source of all the
72 blackness. Moving the cursor over the colour bar and pressing ``l`` for
73 log produces :numref:`fig:starpart1b` — a vast
74 improvement!
75
76 .. figure:: figs/starpart2.png
77 :alt: star formation tutorial part 1b
78 :name: fig:starpart1b
79 :width: 50.0%
80
81 With a log axis after having placed cursor over colour bar and pressed ``l``
82
83 For this visualisation we will eventually want the data in physical
84 units rather than code units. For the sphNG read these units are already
85 specified in the read_data routine, so all we have to do is turn
86 physical units on. Pressing ``q`` from interactive mode (that is, with the
87 cursor in the plot window) returns us to the main menu.
88
89 Physical units are turned on from the :ref:`sec:menu-d`, as follows:
90
91 ::
92
93 Please enter your selection now (y axis or option):d
94 ----------------- data read options -------------------
95 0) exit
96 1) read new data /re-read data
97 2) change number of timesteps used ( 1 )
98 3) plot selected steps only ( OFF )
99 4) buffering of data on/off ( OFF )
100 5) turn calculate extra quantities on/off ( OFF )
101 6) use physical units ( OFF )
102 7) change physical unit settings
103 enter option ([0:7], default=0):6
104 current settings for conversion to physical units are:
105 x [cm] = x x 1.000E+17
106 y [cm] = y x 1.000E+17
107 z [cm] = z x 1.000E+17
108 particle mass [g] = particle mass x 1.991E+33
109 h [cm] = h x 1.000E+17
110 density [g/cm\u3\d] = density x 1.991E-18
111 v\dx [cm/s] = v\dx x 3.645E+04
112 v\dy [cm/s] = v\dy x 3.645E+04
113 v\dz [cm/s] = v\dz x 3.645E+04
114 u [erg/g] = u x 1.328E+09
115 grad h = grad h x 1.000E+00
116 time = time x 1.69E+00
117 Use physical units? (default=yes):
118
119 returning us to the main menu with labels changed as follows:
120
121 ::
122
123 You may choose from a delectable sample of plots
124 -------------------------------------------------------
125 1) x [cm] 7) v\dx [cm/s]
126 2) y [cm] 8) v\dy [cm/s]
127 3) z [cm] 9) v\dz [cm/s]
128 4) particle mass [g] 10) u [erg/g]
129 5) h [cm] 11) grad h
130 6) log density [g/cm\u3
131 -------------------------------------------------------
132 12) multiplot [ 4 ] m) set multiplot
133 -------------------------------------------------------
134 d(ata) p(age) o(pts) l(imits) le(g)end h(elp)
135 r(ender) v(ector) x(sec/rotate) s,S(ave) q(uit)
136 -------------------------------------------------------
137 Please enter your selection now (y axis or option):
138
139 at this stage we will save the current settings to file by pressing ``s``
140 from the main menu.
141
142 ::
143
144 Please enter your selection now (y axis or option):s
145 default options saved to file splash.defaults
146
147 Actually we would prefer the column labels in AU, but we will come to
148 that later. Replotting the same plot (that is 2, 1, 6, 0, /xw from the
149 main menu) plots the same plot we had before, but with the axes in
150 physical units. Zooming in (using the mouse) on the region of interest
151 and adapting the colour bar limits by moving the mouse over the colour
152 bar and pressing ``a`` produces the plot shown in :numref:`fig:starpart2`.
153
154
155 .. figure:: figs/starpart3.png
156 :alt: star formation tutorial part 2a
157 :name: fig:starpart2
158 :width: 50.0%
159
160 Second stage in the star formation figure tutorial: having applied physical units, zooming in and pressing ``a`` on the colour bar
161
162 For this kind of plot, the Bate colour scheme looks better – pressing
163 ``m`` with the mouse in the plot window changes the colour scheme,
164 producing the plot shown in :numref:`fig:starpart2b`.
165
166 .. figure:: figs/starpart4.png
167 :alt: star formation tutorial part 2b
168 :name: fig:starpart2b
169 :width: 50.0%
170
171 having changed the colour scheme
172
173 Pressing ``s`` in interactive mode (that is, with the mouse in the plot window) saves the
174 current zoom and colour bar settings (but not to disk until you also
175 press ``S`` from the main menu). Pressing ``q`` from interactive mode
176 returns to the main menu.
177
178 Next we want to turn on the plotting of sink particles (all particle
179 types other than gas are turned off by default). This is done in the
180 :ref:`sec:menu-o` as follows:
181
182 ::
183
184 Please enter your selection now (y axis or option):o
185 ------------- particle plot options -------------------
186 0) exit
187 1) turn on/off particles by type ( ON, OFF, OFF, OFF )
188 2) change graph markers for each type ( 1, 4, 17, 1 )
189 3) set colour for each particle type ( -1, -1, -1, -1 )
190 4) plot line joining particles ( OFF )
191 5) plot smoothing circles ( 0 )
192 6) use fast particle plotting ( ON )
193 7) change coordinate systems ( 1 )
194 8) plot exact solution ( 0 )
195 9) exact solution plot options
196 enter option ([0:9], default=0):1
197 Plot gas particles? (default=yes):
198 Plot ghost particles? (default=no):
199 Plot sink particles? (default=no):y
200 >> Plot sink particles on top of rendered plots? (default=no):y
201 Plot unknown/dead particles? (default=no):
202
203 Repeating our previous plot (i.e., 2, 1, 6, 0, /xw) produces the plot
204 shown in :numref:`fig:starpart3`.
205
206 .. figure:: figs/starpart5.png
207 :alt: star formation tutorial part 3a
208 :name: fig:starpart3
209 :width: 50.0%
210
211 Third stage in the star formation figure tutorial: having turned sink particle plotting on
212
213 .. figure:: figs/starpart6.png
214 :alt: star formation tutorial part 3b
215 :name: fig:starpart3b
216 :width: 50.0%
217
218 replacing the axes with a scale
219
220
221 The axes in [cm] are kind of ugly, so we could either change this to a
222 sensible unit or plot a scale instead. We will do the latter. The axes
223 can be turned off in the :ref:`sec:menu-p`, as follows:
224
225 ::
226
227 Please enter your selection now (y axis or option):p
228 ---------------- page setup options -------------------
229 ...
230 2) axes options ( 0)
231 ...
232 enter option ([0:8], default=0):2
233 -4 : draw box and major tick marks only;
234 -3 : draw box and tick marks (major and minor) only;
235 -2 : draw no box, axes or labels;
236 -1 : draw box only;
237 0 : draw box and label it with coordinates;
238 1 : same as AXIS=0, but also draw the coordinate axes (X=0, Y=0);
239 2 : same as AXIS=1, but also draw grid lines at major increments of the coordinates;
240 10 : draw box and label X-axis logarithmically;
241 20 : draw box and label Y-axis logarithmically;
242 30 : draw box and label both axes logarithmically.
243 enter axis option ([-4:30], default=0):-2
244 axis = -2
245
246 The option to plot a scale of a particular length is also to be found in
247 the :ref:`sec:menu-g`. We will choose to plot a scale of length 0.1 pc.
248
249 ::
250
251 Please enter your selection now (y axis or option):g
252 ---------------- legend and title options -------------------
253
254 To set the plot titles, create a file called
255 'splash.titles' in the working directory, with one title per line
256
257 0) exit
258 1) time legend on/off/settings ( ON 0.87 1.87 0.00 "t=")
259 2) titles on/off/settings ( ON 0.20 -0.92 0.00)
260 3) legend for multiple steps per page on/off ( OFF )
261 4) plot scale on co-ordinate plots ( OFF )
262 5) legend only on nth panel/first row/column ( 0 )
263 Enter option ([0:5], default=0):4
264 Plot scale on co-ordinate plots? (default=no):y
265 Enter length of scale in the current x,y,z units (default=1.000):3.0856e15
266 Enter text to appear below scale (e.g. '10 AU') (default=1 unit): 0.1 pc
267 Enter horizontal position as fraction of viewport ([0.000:1.000], default=0.5000):
268 Enter vertical position in character heights above bottom (default=1.000):
269
270 Note that because the x axis units were already in cm, we simply entered
271 the value for 0.1pc in these units. Before plotting again, we should
272 save what we have done so far to disk: Pressing ``S`` from the main menu
273 saves both the current plot settings *and* the plot limits to disk:
274
275 ::
276
277 Please enter your selection now (y axis or option):S
278 default options saved to file splash.defaults
279 saving plot limits to file splash.limits
280
281 Plotting our figure again (``2``-``1``-``6``-``0``-``/xw``) produces the plot shown in :numref:`fig:starpart3`
282
283 Nearly there...! To add the finishing touches we want to increase the
284 number of pixels substantially. This is done in the :ref:`sec:menu-r`, option
285 1, for which we can use the shortcut ``r1``:
286
287 ::
288
289 Please enter your selection now (y axis or option):r1
290 ----------------- rendering options -------------------
291 enter number of pixels along x axis ([1:10000], default=200):1000
292
293 then, to plot the figure to file instead of the screen, we simply choose
294 a different device at the prompt:
295
296 ::
297
298 Please enter your selection now (y axis or option):2
299 (x axis) (default=1):
300 (render) (0=none) ([0:11], default=6):
301 (vector plot) (0=none, 7=v) ([0:7], default=0):
302 Graphics device/type (? to see list, default /xw): starpartfinal.gif/gif
303
304 producing our final finished :numref:`fig:starfinal`.
305
306 .. figure:: figs/starpartfinal.png
307 :alt: Finished star formation plot
308 :name: fig:starfinal
309 :width: 50.0%
310
311 Finished star formation plot
312
313 Pressing ``S`` from the main menu saves all of the settings and plot
314 limits to disk, so invoking splash again will produce the same plot. To
315 produce the same plot on a sequence of dumps, simply put more than one
316 file on the command line and plot to a non-interactive device (see
317 :ref:`sec:movies`). Use the postscript devices /ps or /cps (for
318 colour) to make figures suitable for inclusion in a paper.
319
320 Other things you may want to do with this plot include:
321
322 - Turn the time legend off. See :ref:`sec:legendoff`.
323
324 - Change the colour of sink particles. See
325 :ref:`sec:partcolours`.
326
327 - Change the foreground/background colour of the page. See
328 :ref:`sec:pagecolours`.
329
330
331 Multi-panelled figure
332 ---------------------
333 The following is an example plot taken from [PB07]_.
334 Here I will plot a sequence of plots tiled on the same page, so that
335 columns correspond to dumps taken from different runs at the same time
336 and rows correspond to an evolutionary sequence from a given run. The
337 plot uses sphNG data which contains sink particles, so I also want these
338 to appear on the plots and be plotted in white. Basically I want the
339 plots to be plotted such that as much of the plot is taken up by data
340 and very little by axes and the like but still conveying all of the
341 necessary information.
342
343 We proceed as follows: Firstly, each different run (corresponding in
344 this case to a series of runs with different magnetic field strength)
345 are in different subdirectories with names like ``mbossbod_f10.0/``,
346 ``mbossbod_f5.0/``, etc. which all contain a sequence of dump files with
347 names like ``mbos001``, ``mbos002`` etc. To begin the plot, I start by
348 creating a new, empty subdirectory so that the ``splash.defaults`` and
349 ``splash.limits`` files created by pressing ``S`` from the main menu will
350 be in this directory such that running splash from that directory always
351 produces this plot. So:
352
353 ::
354
355 dprice% mkdir plot1
356 dprice% cd plot1
357
358 then having decided which dump files from each run to use, I create a
359 text file listing these filenames (with the full relative pathname) in
360 the order in which I will plot them. For example, calling this file
361 (arbitrarily) ``filelistplot``, the contents should be something like
362 the following:
363
364 ::
365
366 dprice% more filelistplot
367 ../mbossbod_f20.0/mbos259
368 ../mbossbod_f20.0/mbos263
369 ../mbossbod_f20.0/mbos268
370 ../mbossbod_f20.0/mbos275
371 ../mbossbod_f20.0/mbos294
372 ../mbossbod_f10.0/mbos259
373 ../mbossbod_f10.0/mbos263
374 ../mbossbod_f10.0/mbos268
375 ../mbossbod_f10.0/mbos275
376 ../mbossbod_f10.0/mbos294
377 ../mbossbod_f7.5/mbos259
378 ../mbossbod_f7.5/mbos263
379 ../mbossbod_f7.5/mbos268
380 ...
381
382 Then invoke splash with these filenames on the
383 command line:
384
385 ::
386
387 splash `cat filelistplot`
388
389 after which the first dump file should be read, indicated by output
390 along the lines of:
391
392 ::
393
394 reading single dumpfile
395 >>>>>>>>>>>>>>>>>>>>>>>>>> ../mbossbod_f20.0/mbos259 <<<<<<<<<<<<<<<<<<<<<<<<<<
396 double precision dump
397 File ID: SHydroRTMHD1
398 npart = 491567
399 ...
400
401 An alternative method is to rename the ``filelistplot`` file
402 ``splash.filenames``, from which the filenames will be read if there are
403 none specified on the command line (this feature was implemented as a
404 workaround for a limit to the number of command line arguments on the
405 some compilers).
406
407 The first stage is to get a plot of a single panel looking good. So,
408 from the main menu, we will plot a simple rendering of density and
409 adjust the plot limits until we are happy:
410
411 ::
412
413 You may choose from a delectable sample of plots
414 -------------------------------------------------------
415 1) x 6) density
416 2) y 7) B\dx
417 3) z 8) B\dy
418 4) particle mass 9) B\dz
419 5) h
420 -------------------------------------------------------
421 10) multiplot [ 4 ] m) set multiplot
422 -------------------------------------------------------
423 d(ata) p(age) o(pts) l(imits) le(g)end h(elp)
424 r(ender) v(ector) x(sec/rotate) s,S(ave) q(uit)
425 -------------------------------------------------------
426 Please enter your selection now (y axis or option):2
427 (x axis) (default=1):
428 (render) (0=none) ([0:9], default=0):6
429 (vector plot) (0=none, 7=B) ([0:7], default=0):
430 Graphics device/type (? to see list, default /xw): /xw
431
432 which should produce the plot shown in :numref:`fig:multipart1`. Not much can be seen at
433 first – just a few white dots. This is mainly a result of the density
434 axis (i.e., the colour bar) not being logged.
435
436 .. figure:: figs/multipart1.png
437 :alt: multi-panelled figure tutorial part 1
438 :name: fig:multipart1
439 :width: 50.0%
440
441 First stage in the multi-panelled figure tutorial: a simple render plot of density
442
443 Moving the cursor over the
444 colour bar and pressing ``l`` results in the plot shown in :numref:`fig:multipart1b`
445
446 .. figure:: figs/multipart2.png
447 :alt: multi-panelled figure tutorial part 1b
448 :name: fig:multipart1b
449 :width: 50.0%
450
451 and with a log axis after having placed cursor over colour bar and pressed ``l``
452
453 Before we proceed any further, we will first change the axes to be in
454 physical units rather than code units. Pressing ``q`` in the plot window
455 to exit interactive mode and return to the main menu, and from the :ref:`sec:menu-d`,
456 turn the ``use physical units`` option on:
457
458 ::
459
460 Please enter your selection now (y axis or option):d
461 ----------------- data read options -------------------
462 0) exit
463 1) read new data /re-read data
464 2) change number of timesteps used ( 1 )
465 3) plot selected steps only ( OFF )
466 4) buffering of data on/off ( OFF )
467 5) turn calculate extra quantities on/off ( OFF )
468 6) use physical units ( OFF )
469 7) change physical unit settings
470 enter option ([0:7], default=0):6
471 current settings for conversion to physical units are:
472 x [cm] = x x 1.000E+16
473 y [cm] = y x 1.000E+16
474 z [cm] = z x 1.000E+16
475 particle mass [g] = particle mass x 1.991E+33
476 h [cm] = h x 1.000E+16
477 density [g/cm\u3\d] = density x 1.991E-15
478 B\dx [G] = B\dx x 1.000E+00
479 B\dy [G] = B\dy x 1.000E+00
480 B\dz [G] = B\dz x 1.000E+00
481 time = time x 1.13E-01
482 Use physical units? (default=yes):yes
483
484 The default transformations to physical units are in this case set in
485 the data read. However it would be nicer in this case to set the x and y
486 axis units to AU (Astronomical Units), rather than cm.
487 From the :ref:`sec:menu-d` we proceed as follows:
488
489 ::
490
491 enter option ([0:7], default=0):7
492 enter column to change units (-2=reset all,-1=quit,0=time) ([-2:9], default=-1):1
493 enter x [cm] units (new=old*units) (default=0.1000E+17):668.3893
494 enter label amendment (default=[cm]): [AU]
495 Apply these units to all coordinates and h? (default=yes):
496 Enter unit for 'z' in 3D column integrated plots (default=0.1000E+17):
497 Enter label for z integration unit (e.g. [cm]) (default=[cm]):
498
499 enter column to change units (-2=reset all,-1=quit,0=time) ([-2:9], default=-1):
500
501 save units to file? (default=yes):
502 saving plot limits to file splash.units
503
504 where in the above I set the multiplicative factor such that the x axis
505 will be in AU and correspondingly changed the units label to ``[AU]``
506 (note the preceding space). I was also prompted to change the unit for
507 ’z integration’ – this is the length unit added when integrating a
508 quantity through z. Leaving this in cm means that, even though the
509 coordinate axes are in AU, the density (in g/cm\ :math:`^{3}`) is
510 integrated through z in cm, giving column density in g/cm\ :math:`^{2}`
511 (as opposed to g /cm:math:`^{3}` AU).
512
513
514 To save what we have done so far, press ``s`` from the main menu to save
515 the current settings to the ``splash.defaults`` file:
516
517 ::
518
519 Please enter your selection now (y axis or option):s
520 default options saved to file splash.defaults
521
522 Having turned physical units on, we replot the same plot (i.e.,
523 answering ``2``, ``1``, ``6``, ``0``, ``/xw`` to the prompts, as previously). First of all
524 we find simply a white screen. This is a result of the colour bar axis
525 now being wrong. Moving the mouse over the colour bar and pressing ``a``
526 (to adapt) results in the plot shown in :numref:`fig:multipart3`. The plot looks
527 basically identical to the previous plot, except that the axes are now
528 in physical units (x and y are in AU and column density is in
529 g/cm\ :math:`^{2}`).
530
531 .. figure:: figs/multipart3.png
532 :alt: multi-panelled figure tutorial part 2
533 :name: fig:multipart3
534 :width: 50.0%
535
536 Second stage in the multi-panelled figure tutorial: having changed the axes into physical units
537
538 Next, we zoom in to the central region of interest using the mouse –
539 selecting a region and clicking to zoom in. Pressing ``o`` centres the
540 plot on the origin and as we zoom in it we also press ``a`` over the
541 colour bar to readjust the colour bar limits to the max/min on the
542 zoomed-in plot. Finishing with the adjustments (and pressing ``s`` in the
543 plot window to save the current settings) results in the plot shown in
544 :numref:`fig:multipart3b`.
545
546 .. figure:: figs/multipart4.png
547 :alt: multi-panelled figure tutorial part 2b
548 :name: fig:multipart3b
549 :width: 50.0%
550
551 zooming in and adjusting the colour bar
552
553
554 Surface rendering
555 -----------------
556
557 Here I will give an example of how to use the 3D surface rendering
558 feature starting with a dump file kindly supplied by Giuseppe Lodato
559 from an SPH simulation of a warped accretion disc. First we read the
560 file:
561
562 ::
563
564 dprice$ splash warp001
565
566 after which we reach the main menu:
567
568 ::
569
570 You may choose from a delectable sample of plots
571 -------------------------------------------------------
572 1) x 6) density
573 2) y 7) v\dx
574 3) z 8) v\dy
575 4) particle mass 9) v\dz
576 5) h
577 -------------------------------------------------------
578 10) multiplot [ 4 ] m) set multiplot
579 -------------------------------------------------------
580 d(ata) p(age) o(pts) l(imits) le(g)end h(elp)
581 r(ender) v(ector) x(sec/rotate) s,S(ave) q(uit)
582 -------------------------------------------------------
583 Please enter your selection now (y axis or option):
584
585 Firstly we want to plot just a simple render plot of density. Thus we
586 choose:
587
588 ::
589
590 Please enter your selection now (y axis or option):2
591 (x axis) (default=1):
592 (render) (0=none) ([0:9], default=0):6
593 (vector plot) (0=none, 7=v) ([0:7], default=0):
594 Graphics device/type (? to see list, default /xwin): /xw
595
596 producing the plot shown in :numref:`fig:surfpart1` (I have used ``/png``
597 instead of ``/xw`` to produce the figures for the userguide).
598
599 .. figure:: figs/surfpart1.png
600 :alt: surface rendering tutorial part 1
601 :name: fig:surfpart1
602 :width: 50.0%
603
604 First stage in the surface rendering tutorial: a simple render plot of density
605
606 Moving the cursor over the colour bar and pressing ``l`` to log the colour bar axis
607 produces :numref:`fig:surfpart1b`.
608
609 .. figure:: figs/surfpart2.png
610 :alt: surface rendering tutorial part 1b
611 :name: fig:surfpart1b
612 :width: 50.0%
613
614 with a log axis after having placed cursor over colour bar and pressed ``l``
615
616 The next step is to adjust the viewing angle. Pressing ``h`` in the plot
617 window brings up the list of keystrokes which can be used to change the
618 angle. Here we want to add a rotation about the :math:`x-` axis, so we
619 press ``{`` three times to change the x angle by -90 degrees and then
620 press ``[`` once to increment the angle by a further -15 degrees. The
621 splash output in the terminal reads, amongst other things:
622
623 ::
624
625 rotating particles about z by 0.00
626 rotating particles about y by 0.00
627 rotating particles about x by 255.00
628
629 Then we obtain :numref:`fig:surfpart2`.
630
631 .. figure:: figs/surfpart3.png
632 :alt: surface rendering tutorial part 2
633 :name: fig:surfpart2
634 :width: 50.0%
635
636 Second stage in the surface rendering tutorial: after adjusting the rotation angle
637
638 Next, we need to turn the 3D surface rendering on. This cannot be done
639 in interactive mode so we need to exit – pressing ``s`` first to save what
640 we have done so far, then ``q`` to quit interactive mode. Then, back at
641 the splash main menu, we type x4 for the :ref:`sec:menu-x`,
642 option 4 which is “3D surface rendering on/off” with prompts appearing
643 as follows:
644
645 ::
646
647 Please enter your selection now (y axis or option):x4
648 ---------- cross section / 3D plotting options --------
649 Use 3D opacity rendering? (default=yes):y
650
651 Now we replot the original plot with the new settings as follows:
652
653 ::
654
655 Please enter your selection now (y axis or option):2
656 (x axis) (default=1):
657 (render) (0=none) ([0:9], default=6):
658 (vector plot) (0=none, 7=v) ([0:7], default=0):
659 enter z coordinate of observer (default=53.58):
660 enter distance between observer and projection screen ([0.000:], default=5.358):
661 using current h and pmass limits to calculate kappa (cross section/unit mass)
662 min h = 0.1197254 min particle mass = 3.812551E-11
663 [ kappa = pi*h_min**2/(particle_mass*n_smoothing_lengths) ]
664 enter approximate surface depth (number of smoothing lengths): ([0.000:], default=2.000):
665 kappa (particle cross section per unit mass) = 1.2369025E+9
666 Graphics device/type (? to see list, default /xwin):
667
668 Note that several new prompts appear – for the moment I have just used
669 the default answers by pressing return. The first result is rather
670 frightening : just a black image with a black colour bar! This is
671 because the limits we set for column density are several orders of
672 magnitude away from the limits on density. Moving the cursor over the
673 colour bar and pressing ``a`` to adapt the limits produces the plot shown
674 in :numref:`fig:surfpart2b`.
675
676 .. figure:: figs/surfpart4.png
677 :alt: surface rendering tutorial part 2b
678 :name: fig:surfpart2b
679 :width: 50.0%
680
681 With 3D surface rendering turned on (which also turns on 3D perspective) and having adjusted the colour bar limits
682
683 Note that the plot suddenly appears much smaller – this is a consequence
684 of the 3D perspective settings. Moving the cursor into the plot window
685 and pressing ``a`` adapts the plot limits. After also clicking on the
686 colour bar and adjusting the colour bar limits, we arrive at the plot
687 shown in :numref:`fig:surfpart3`.
688
689 .. figure:: figs/surfpart5.png
690 :alt: surface rendering tutorial part 3
691 :name: fig:surfpart3
692 :width: 50.0%
693
694 Third stage in the surface rendering tutorial: after adjusting the xy and colour bar limits interactively
695
696
697 Now that we are nearly there, to add the finishing touches we need to i)
698 increase the number of pixels in the image and ii) turn the axes off,
699 since they are no longer meaningful with 3D perspective set. The number
700 of pixels can be increased by returning to the splash main menu
701 (pressing ``s`` in interactive mode before doing so to save what we have
702 done so far), then typing ``r1`` for :ref:`sec:menu-r`, option 1:
703
704 ::
705
706 Please enter your selection now (y axis or option):r1
707 ----------------- rendering options -------------------
708 enter number of pixels along x axis ([1:10000], default=200):1000
709
710 Next, we turn the axes off using the :ref:`sec:menu-p`:
711
712 ::
713
714 Please enter your selection now (y axis or option):p2
715 ---------------- page setup options -------------------
716 -4 : draw box and major tick marks only;
717 -3 : draw box and tick marks (major and minor) only;
718 -2 : draw no box, axes or labels;
719 -1 : draw box only;
720 0 : draw box and label it with coordinates;
721 1 : same as AXIS=0, but also draw the coordinate axes (X=0, Y=0);
722 2 : same as AXIS=1, but also draw grid lines at major increments of the coordinates;
723 10 : draw box and label X-axis logarithmically;
724 20 : draw box and label Y-axis logarithmically;
725 30 : draw box and label both axes logarithmically.
726 enter axis option ([-4:30], default=0):-2
727 axis = -2
728
729 Plotting the same plot again now results in the plot shown in :numref:`fig:surfpart3b`.
730
731 .. figure:: figs/surfpart6.png
732 :alt: surface rendering tutorial part 3b
733 :name: fig:surfpart3b
734 :width: 50.0%
735
736 and increasing the number of pixels and having turned the axes off
737
738 Finally we will also set the background colour to black, adjust the
739 opacity and move the time legend. Notice that in :numref:`fig:surfpart3b` the surface looks
740 blotchy. This is an indication that the surface is too shallow (that is
741 we are only seeing particles on the very top). Thus we will adjust the
742 opacity for a slightly deeper plot. We proceed as follows: Exiting
743 interactive mode (pressing ``s`` then ``q`` in the plot window), we first
744 set the foreground and background colours in the :ref:`sec:menu-p`:
745
746 ::
747
748 Please enter your selection now (y axis or option):p8
749 ---------------- page setup options -------------------
750 Enter background colour (by name, e.g. "black") (default=):black
751 Enter foreground colour (by name, e.g. "white") (default=):white
752 Do you want to plot axes and overlaid text in background colour (default is foreground) ? (default=no):
753
754 Now, replotting the same plot again, but this time adjusting the opacity
755 at the prompt:
756
757 ::
758
759 enter approximate surface depth (number of smoothing lengths): ([0.000:], default=2.000):200.0
760
761 Finally, moving the time legend by positioning the cursor and pressing
762 ’G’ and zooming out slightly by pressing ``-`` once, we arrive at our
763 finished figure (or movie frame) shown in :numref:`fig:surfpartfinal`. Pressing ``s`` in
764 interactive mode saves the settings, then pressing ``q`` returns to the
765 splash main menu. To :ref:`sec:menu-s` to disk, press ``S`` from the main
766 menu to save both the ``splash.defaults`` file and the ``splash.limits``
767 file.
768
769 .. figure:: figs/surfpartfinal.png
770 :alt: Finished surface-rendered plot
771 :name: fig:surfpartfinal
772 :width: 50.0%
773
774 Finished surface-rendered plot
775
776 To create a sequence of images with these settings, then simply invoke
777 splash again with multiple files:
778
779 ::
780
781 splash warp???
782
783 then plotting the same plot as previously to a non-interactive device
784 will cycle through all dump files producing a sequence of plots with
785 names like ``splash_0000.png``, ``splash_0001.png`` etc. These can be
786 easily converted into an animation.
787
788 .. _sec:evsplash:
789
790 Using splash to plot energy vs time plots
791 ------------------------------------------
792
793 splash can be used for all kinds of data. For example I often use it to plot the
794 contents of the .ev file my SPH code dumps monitoring quantities like
795 energy and angular momentum at every timestep. A shortcut way of setting
796 options appropriate to reading such files (e.g. plotting lines instead
797 of dots, plotting all files on the same page) is implemented by adding
798 the “-ev” option to the command line: e.g.
799
800 ::
801
802 splash -ev file1.ev file2.ev file3.ev
803
804 also, using the -ev option on the command line means that any
805 modification to the preset options /limits are saved to files called
806 ``evsplash.defaults`` and ``evsplash.limits`` instead of the usual
807 ``splash.defaults`` and ``splash.limits``. This means the defaults for
808 this type of plot are saved separately to those for “normal” plots of
809 SPH data.
810
811 For other command line options, see :ref:`sec:commandline`.
812
813 .. _sec:surfdens:
814
815 Plotting azimuthally-averaged disc surface density and Toomre Q parameter
816 -------------------------------------------------------------------------
817
818 For analysis of accretion disc simulations, it is useful to make
819 azimuthally averaged plots of the disc properties such as the surface
820 density and, for self-gravitating discs, the Toomre Q parameter. Extra
821 columns appear to plot both of these quantities when the simulation is
822 3D and the coordinate system is changed to cylindrical or spherical
823 co-ordinates (in the :ref:`sec:menu-o` – see
824 :ref:`sec:geom`). For the Toomre Q parameter to appear it is
825 also necessary to have read the thermal energy from the dump file. For
826 example, having read a dump file, change the coordinate system to
827 cylindricals:
828
829 ::
830
831 Please enter your selection now (y axis or option):o7
832 ------------- particle plot options -------------------
833 0) reset (= 1)
834 1) cartesian x,y,z
835 2) cylindrical r,phi,z
836 3) spherical r,phi,theta
837 4) toroidal r,theta,phi
838 Enter coordinate system to plot in: ([0:4], default=1):2
839
840 then extra columns appear in the menu:
841
842 ::
843
844 You may choose from a delectable sample of plots
845 -------------------------------------------------------
846 1) r 13) u
847 2) phi 14) grad h
848 3) z 15) grad soft
849 ... ...
850 11) v\dphi 23) Surface density
851 12) v\dz 24) Toomre Q parameter
852 -------------------------------------------------------
853
854 Then (in this example), select column 23 to plot surface density,
855
856 ::
857
858 Please enter your selection now (y axis or option):23
859 setting x axis to r for surface density plot
860
861 ...and the plot will appear - an example surface density plot is shown
862 in :numref:`fig:surfdens`.
863
864 .. figure:: figs/surfdens.pdf
865 :alt: Azimuthally averaged surface density
866 :name: fig:surfdens
867 :width: 50.0%
868
869 Plot of azimuthally averaged surface density in a 3D accretion disk
870 simulation
871
872 Azimuthally averaged quantities are calculated by binning the particles
873 into a fixed number of annuli in radius. The mean surface density is
874 calculated using
875
876 .. math:: \Sigma(r_{ann}) = \frac{M_{ann}}{\pi [(r_{ann} + 0.5\Delta r)^{2} - (r_{ann} - 0.5\Delta r)^{2}]},
877
878 that is, the total mass in the annulus (sum of the particle masses)
879 divided by its area, where :math:`r_{ann}` is the radius (cylindrical or
880 spherical) of the annulus. The Toomre Q parameter, defined as
881
882 .. math:: Q_{Toomre}(r) = \frac{\bar{c}_{s}(r)\kappa(r)}{\pi \Sigma(r)},
883
884 where :math:`\kappa` is the epicyclic frequency and :math:`\bar{c}_{s}`
885 is the RMS sound speed, is calculated using the above surface density,
886 assuming a Keplerian rotation profile and a central star mass of unity
887 (i.e., :math:`\kappa(r) = \Omega(r)`, where
888 :math:`\Omega(r) = r^{-3/2}`). The sound speed for each particle
889 :math:`i` is calculated from the stored thermal energy and
890 :math:`\gamma` (ratio of specific heats) according to
891
892 .. math::
893
894 c_{s,i}^{2} = \left\{ \begin{array}{ll}
895 \frac23 u_{i}, & \gamma = 1; \\
896 (\gamma-1)\gamma u_i, & \gamma \neq 1;
897 \end{array}\right.
898
899 from which the RMS sound speed is calculated as the square root of the
900 average of :math:`c_{s}^{2}` on the particles in the annulus.