Next: Variations
Up: Simple Recipes
Previous: Variations
Importing Particle Data
It is usually possible to input a file written by some other program
into DX. The procedure is simply to create a file which describes the
contents of the data file to DX. This description file is called a
`header file' and is simply a text file created with an editor.
As an example this recipe shows how to input a formatted text file
containing particle (or catalogue) data. The positions of the particles
trace out a three-dimensional cone. The data are represented as a
single DX field (see Section
). For simplicity the file
contains only this single field. However, it is possible to have
particle datasets containing several fields, similar to the gridded
data in Section
. The program to generate the data is listed
in Figure
.
- The DX header file for this data file is shown in
Figure
. These header files have file type
`.general'. Thus the present example is called ` particle.general'.
Figure:
Header file for particle
data.
 |
- Each line of the header file consists of a keyword followed by
one or more values. The purpose of the various keywords are as follows.
- file
- is the name of the data file. If the file name is not
preceded by a directory specification then it is assumed to be in
the same directory as the header file.
- points
- is the number of particles (or points) in the data
set.
- format
- is the format of the file; the current example is
a formatted file rather than a binary file.
- field
- specifies names for the the individual fields (or columns) in
the data file. In the present case the first three columns,
containing the positions are collectively called `locations' and
the final column is called `Intensity'. Note the use of a comma to
separate the two names.
- structure
- specifies the structure of each field in the file.
In the present case the first three columns are grouped into a
three-element vector containing the positions and the fourth
column is treated as a scalar dependent variable.
- interleaving
- specifies how the various data items within
the file are intertwined. In the present case each record in the
file contains the position and data value for a single particle
(see Figure
). `interleaving=field'
specifies this sort of interleaving.
A full description of all the possible keywords is given in
Section 4.3 Header File Syntax: Keyword Statements of the
IBM QuickStart Guide[1].
- Once a suitable description file has been been created the data
can be imported into DX by including the `Import' module in your
network. Note that it is the name of the description file, not
the name of the data file which must be supplied to `Import'.
Subsections
Next: Variations
Up: Simple Recipes
Previous: Variations
The DX Cookbook
Starlink Cookbook 2
A.C. Davenhall
1st October 1997
E-mail:starlink@jiscmail.ac.uk
Copyright © 2013 Science and Technology Facilities Council