next up previous contents
Next: 4. Using frames Up: 3. Plotting 2D data Previous: 3.3 Using bitmaps

   
3.4 Saving data


  
Figure 3.4: Extracting data from 2D data sets
\includegraphics[scale=0.6, angle=270.0]{pl2.4.eps}

In contrast to 1D data where we could mainly save a given data set in the 'xy' format, there are several options to extract and save data from a 2D data set. As described in section 2.5, the first step is to enter the save sublevel using the command 'ksav' followed by the number of the data set to be saved. As before the output filename is set by the command 'outfile' and the saving process is started via 'run'. However, there are now many more possible settings for the 'form' command.


 
Table 3.2: Save options for 2D data sets
Format Parameters Description
ni [x1,x2,y1,y2] Nipl file, given area
pg [x1,x2,y1,y2] PGM file (ASCII), given area
gn [x1,x2,y1,y2] XYZ file (gnuplot), given area
sx y-value Cross section $\Vert$ x at y-value
sy x-value Cross section $\Vert$ y at x-value
mx i Cross section $\Vert$ x through maximum #i
my i Cross section $\Vert$ y through maximum #i
sk ik Cross section along xy of data set ik
sl x1,y1,x2,y2,n Cross section from x1,y1 to x2,y2 with n points

The first three of those formats listed in Table 3.2 save the data set or a subsection as 2D data set either in NIPL, PGM or XYZ format. As before the area that is saved is determined by the current size of the plot window determined by the command 'skal'. Alternatively the x-limits x1 and x2 and y-limits y1 and y2can be specified as additional parameters to the 'form' command. Note that when using PGM as output format, the z-values are converted to integer and should range from $0 \rightarrow
255$. The command 'thresh' allows to control how the z-values are converted to this range. The other formats in Table 3.2 are used to extract a cross section from the 2D data set. The created output file is a normal 'xy' file. The parameters 'sx' and 'sy' extract a cross section parallel to the x- or y-axis at the given y- or x-value (see example below). Rather than specifying these y- or x-values, the corresponding coordinates of maximum i determined by the command 'smax' (see section 7) can be used ('mx' or 'my'). The command above will extract the z-values at the corresponding grid points. The last two options can extract data from any value of x and y by interpolation. The format 'sk' will use the coordinates x and y from data set (1D) number 'ik' to determine the z-values to be extracted whereas 'sl' will extract 'n' points along a straight line defined by the points (x1,y1) and (x2,y2).

A simple example how to extract a cross section is show in Figure 3.4. The original data set is shown on the left. The cross section parallel x (or [hh0]) at y (or l) equals 1.0 is marked by a dashed line. The resulting 1D plot of the cross section is shown on the right panel of the figure. The corresponding commands to create the data file shown at the top is listed below:

     1  ksav 1
     2  outfile test.cut
     3  form sx,1.0
     4  run

In line 1 we enter the save sublevel. In our example the data set to be used is data set number one. The output filename is set to 'test.cut' (line 2) and the format is set to 'sx', i.e. cross section parallel to x at y=1.0 (line 3). Finally the data file is written after the command 'run' is entered (line 4).


next up previous contents
Next: 4. Using frames Up: 3. Plotting 2D data Previous: 3.3 Using bitmaps
Thomas Proffen {Billinge}
1999-06-26