next up previous contents
Next: 4 Plotting Data Up: IFEFFIT Tutorial Previous: 2 Data, Commands, and Simple Data


3 Reading Arrays from Data Files

IFEFFIT reads ASCII files with data listed in columns, delimited by whitespace (blanks or tabs). The data are stored in IFEFFIT arrays, so that they are ready for immediate manipulation, plotting, and analysis. The read_data() command is used to read data arrays from an ASCII file. A typical use would look like

  Ifeffit> read_data(file = cu_001.xmu, group= 'cu', type = 'xmu')
Because of the naming rules for arrays (see 2.1), read_data() needs to assign both a prefix (or group name) and suffix for each array read in from the data file. Since data in a file is usually grouped together logically, read_data() will use just one group name for all the arrays in an individual file. The group name used can be specified with the group keyword in the read_data() command. By default, the prefix of the filename itself is used.

The method for assigning the suffixes of the array names is a bit more involved. There are four different ways for IFEFFIT to determine the array suffixes when reading in a file:

From the 'type' argument
: In the example above, the type = 'xmu' argument tells IFEFFIT to use the suffixes energy and xmu for the first and second columns, and use 3, 4, ... for any remaining columns. Another commonly used file types is chi for columns of k and chi. A more complete list of known file types and the suffixes they produce is given in the Reference Guide.

From the 'label' argument
: For data that is not in one of the pre-defined types (or if you just want to specify the array suffixes explicitly), then the label argument can be used. label takes a string that is just the array suffixes listed separated by a space. Using read_data(file = cu_001.xmu, group='cu', label = 'energy xmu') would be equivalent to the above type version.

From the files own 'label' line
: Many files (especially, those written by IFEFFIT, FEFFIT, or AUTOBK) will have a label line which contains the column labels (i.e, array suffixes) and appears just before the data and just after a line of minus signs (#-------):
 # Cu foil at 10K
 # OFFSETS     51284   50016   48319
 #----------------------------------
 #     energy          xmu
  .8786204E+04    .1013661E+01
If neither the type nor label keyword are specified, IFEFFIT will look for a label line and use it.

By column index
: If none of the above methods are used (that is neither the type nor label keyword are given, and a label line is not found), IFEFFIT will name the arrays by column number 1, 2, 3, .... Though primitive, this is actually the most predictable behavior, and can be enforced by using "type = 'raw'".


next up previous contents
Next: 4 Plotting Data Up: IFEFFIT Tutorial Previous: 2 Data, Commands, and Simple Data
Matt Newville
2001-10-05