Subsections


results.write

Image relax Image document-save

Synopsis

Write the results to a file.

Defaults

results.write(file=`results', dir=`pipe_name', compress_type=1, force=False)

Keyword arguments

file: The name of the file to output results to. The default is `results'. Optionally this can be a file object, or any object with a write() method.

dir: The directory name.

compress_type: The type of compression to use when creating the file.

force: A flag which if True will cause the results file to be overwritten.

Description

This will write the entire contents of the current data pipe into an XML formatted file. This results file can then be read back into relax at a later point in time, or transfered to another machine. This is in contrast to the state.save user function whereby the entire data store, including all data pipes, are saved into a similarly XML formatted file.

To place the results file in the current working directory in the prompt and scripting modes, leave the directory unset. If the directory is set to the special name `pipe_name', then the results file will be placed into a directory with the same name as the current data pipe.

The default behaviour of this function is to compress the file using bzip2 compression. If the extension `.bz2' is not included in the file name, it will be added. The compression can, however, be changed to either no compression or gzip compression. This is controlled by the compression type which can be set to

0 -
No compression (no file extension),
1 -
bzip2 compression (`.bz2' file extension),
2 -
gzip compression (`.gz' file extension).

The complementary read function will automatically handle the compressed files.


The relax user manual (PDF), created 2016-10-28.