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 import a formatted text file containing two data cubes. One data cube is a simple Gaussian field, the other is a Gaussian superimposed on a sloping background. Note that though the values are calculated using Fortran double precision variables they are written out as floating point numbers. DX interprets the ensuing file as containing single precision values. Each data cube is represented as a single DX field (see Section 17). The program to generate the data file is listed in Figure 7.
.general
’. Thus the present example is called ‘field.general
’.
interleaving=field
’ specifies this sort of
interleaving.
0.15655673 0.25655673 |
0.16572675 0.26572675 |
0.17514088 0.27514088 |
0.18476781 0.28476781 |
0.19457102 0.29457102 |
0.20450866 0.30450866 |
|
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].
format
keyword should be set to ‘binary
’. Binary files written with a C program
can be imported directly. However, unfortunately, binary files written with a Fortran
program contain record-control bytes which must be removed prior to importing the file.
The Starlink extensions to DX include SXUnfort
for this purpose; see SUN/203[11] for
details. Of course, an unformatted file written on a Digital alpha will differ from the
corresponding file written on a Sun because of the different byte order of the machines.
It is possible to input an unformatted file written on a Sun into DX running on a Digital
alpha, or vice versa, by using the ‘msb
’ and ‘lsb
’ modifiers to the format
keyword4.
See Section 4.3 Header File Syntax: Keyword Statements of the IBM QuickStart Guide[1] for
details.
4Strictly speaking it should be possible to input any unformatted file written in IEEE floating point format, irrespective of the type of machine that it was written on. Note, however, that Digital VAXen and IBM mainframes do not use IEEE floating point format.