Table of Contents


snapshell - compute statistics of bodyvariables in a set of shells


snapshell in=snap_file [parameter=value] ...


snapshell computes selected diagnostics and their statistics from an N-body snapshot in a set of shells in an arbitrary body variable (normally rvar=r). The snapshot must have been properly centered and oriented using other tools (e.g. snapcenter(1NEMO) and/or snaprect(1NEMO) ).

Normally the shell radii are explicitly set (optionally normalized) in rvar space, by setting cumulative=t the mvar= variable is used to compute a cumulative mass in each shell, still sorted by rvar of course.

An arbitrary weighting may be specified for each particle.

The output will be an ascii table, in which for each variable it will print a selected set of statistics (e.g. mean, dispersion, min, max, skewness, kurtosis, number of particles). Shells with no particles are not output however.


The following parameters are recognized.
Input data is read from snap_file, which must be in snapshot(5NEMO) format. Note that only the first snapshot found in this file will be used. No default.
A set of radii in nemoinp(3NEMO) format, representing the edges of the shell. They are normalized if normalized=t is used, and their units are in rvar space, unless cumulative=t is used, when they are in cvar units. No default.
The bodytrans(1NEMO) variable selected for statistics. [Default: vt].
Default: r
Default: m
Expression used to compute the weight of each body. See bodytrans(1NEMO) for the form of body_weight. Default: 1.0.
Normalization values in X,Y and Z to compute (re-shape) radii. Only used if shells are given in configuration space (i.e. svar= is not used) and need to be ellipsoidal in shape. For certain choices of rvar the use of this keyword has to be taken with care. [Default: 1,1,1]
Statistics selected to print. Allowed values are mean, dispersion, min, max, median, kurt, skew, npt. [Default: mean,disp,n].
Valid C-format descriptor, as used in printf(3) , for tabular output. [default: %g].
Should svar= (if used) be done in normalized (0..1) space, and therefore easily allow equal size bins, or in direct svar space (this requires knowledge of the range of the svar variable. [Default: t]
Should the shells be defined in the cumulative (and optionally normalized) space of the cmas variable. This way the number of particles in each shell can be better/differently controlled from selecting them in rvar space. [Default: f]
Should only the first snapshot be processed? [Default: f]
Should statistics on r also be added as a third set of columns. This can be handy if you selected a particular rvar and want to see over what radii they apply. [Default: f]

See Also

snapkinem(1NEMO) , snaprect(1NEMO) , snapsort(1NEMO) , snapshot(5NEMO)


To get a mean rotation speed in the disk, and the velocity dispersion, for a set of rings:
    % mkdisk - rmax=10 | snapsort - - r | snapshell - 0.01:10:0.1 pvar=vt
    #[rvar] mea  dis  npt  #[pvar] mea  dis  npt
    0.221025 0 1           0.213258 0
    0.347701 0.035125 2    0.318487 0.0270184
    0.468138 0.0260884 2   0.403087 0.0164231
    9.65953 0.0284596 39   0.319191 0.000455262
    9.7589 0.0288926 40    0.317613 0.00045552
    9.85975 0.0293125 41   0.316035 0.000455434
This results in rings with different numbers of particles (3rd column). By using an appropriate cumulative variable (e.g. mass) one can easily find shells which then contain an equal number of particles. The keyword cumulative=t is used for this:

    % mkdisk - rmax=10 | snapsort - - r | snapshell - 0:1:0.01 cumulative=t mvar=1
where we also needed to use mvar=1 normalized=t,since mkdisk(1NEMO) creates a disk of test particles, and does not by default set the mass of the disk.

In case the particles are sorted by potential from an N-body simulation, one can select shells by particle number (easy way to make the binsizes the same)

    % snapsort run01.dat - phi times=4.0 | snapshell - 0:1:0.01 rvar=phi cumul=t
or assign the shells directly in rvar space (this requires you to know the values in svar space):
    % snapsort run01.dat - phi times=4.0 | snapshell - -400:-200:10 rvar=phi cumul=t


Ellipsoidal shells may need reshape/sort/reshape?


Peter Teuben


13-nov-01    V1.0 created    PJT
14-nov-05    V2.0 some re-write: svar= is now rvar=     PJT
15-nov-05    V2.1 added mvar= and cumulative=    PJT

Table of Contents