Structured tables consist of a small (though optional) header, that normally contains parameters like the number of bodies, the time of the snapshot etc., and one or more blocks (sections) of homogeneous tables, their length equal the number of bodies in the snapshot and their width as specified by the user from the variables expected to be present in those blocks. Examples will be shown below.
Unstructured files (i.e. without a header) can also be processed if the user specifies how many bodies are present per snapshot. If even that is not done, the number of lines in the file (corrected for the number of times and blocks specified) is used to derive the number of bodies. Although at least one block must be present, if no times are specified, the number of snapshots is then assumed to be one. See examples below.
By default tabtos does not handle comment lines (lines starting with #) gracefully at all, see options=comment or options=history below how to deal with his. If you use these options, automatically determining nbody will not work, and either header= or nbody= needs to be used.
Recognized are: nbody, ndim, time, skip (-). If they do not appear in the header, their value should be set via the equivalent keyword (see below). The special value skip (or -) is allowed to skip header items that have no current meaning in parsing the data into snapshot format (e.g. SPH files have ngas, but this is currently not processed). Default: none supplied.
Recognized are: mass, pos, vel, phase, acc, phi, dens, aux for real-valued and key for integer valued columns (see also snapshot(5NEMO) ). In addition, single elements from the ndim vector are recognized as x, y, z, vx, vy, vz, ax, ay, az. m is also recognized as mass, to be symmetric with the standard bodytrans(5NEMO) names. As before, the name skip (or -) can be used to skip a column. If the variable skip appears are the only item in a block, all nbody rows in that block are skipped, independant of the number of columns (NOTE: this cannot be done if options=wrap is used).
Structured ASCII tables can contain up to 9 separate blocks, currently all of them must have the same length, and be equal to the number of bodies, nbody. No default.
% tabtos in=table out=snap block1=mass,pos,velTo read in "205" formatted N-body snapshots (see also atos(1NEMO) ), with three seperate blocks of masses, positions and velocities, you can use:
% tabtos in=table out=snap header=nbody,ndim,time \
block1=mass block2=pos block3=vel
To read in "205" pure-SPH data (i.e. NGAS=NOBJ, see also atosph(1NEMO)
),
in which the density is going to be stored in the mass slot, entropy/temperature
in aux, potentials in phi, and masses and smoothing lengths are skipped,
use: % tabtos in=table out=snap header=nbody,skip,ndim,time \
block1=skip block2=pos block3=vel block4=mass block5=aux \
block6=skip block7=phi
Note: files with Ngas < Nobj cannot be processed (yet), since the blocks
have different length. See atosph(1NEMO)
.
format header blocks atos nbody,ndim,time mass pos vel phi atosph nbody,ngas,ndim,time mass pos vel rho temp hsph phi acc
If no times specified, and the header= has no associated time, all snapshots will have the same time (0.0). A warning will be issued.
If both times specified, and the header= has an associated time, the header value will be overriden with the user specified values. Note that the number of specified times now determines the maximum number of snapshots that will be read, i.e. EOF may not be reached.
Although snapshots with varying amounts of particles can be read, there are many programs in NEMO which have difficulties if the first snapshot is not the largest one in that file.
This program cannot parse fixed column files if they are not separated by whitespace.
Files with comment lines cannot be
parsed. Use tabcomment(1NEMO)
to delete them:
tabcomment tab.in - delete=t | tabtos - snap.out ....though the drawback of using a pipe in this example is that typically the keyword nbody= needs to be supplied.
27-Aug-93 V1.0 Created, I finally broke down Peter Teuben 30-aug-93 V1.1 added scan= PJT 25-oct-94 V1.2 options=scan|comment PJT 2-nov-94 V1.2d added wrap/spill, fixed times= bug PJT 19-aug-00 V1.3d fixed various TAB related problems PJT 24-jan-02 V1.3f block10 now PJT 29-jul-05 V1.4 added options=time to auto-inc time PJT 14-nov-06 V1.5 added history option PJT 18-jan-12 V1.5a added dens(ity) option JCL