save(self,
file=None,
dir=None,
force=0,
compress_type=1)
| source code
|
Function for saving the program state.
Keyword Arguments
~~~~~~~~~~~~~~~~~
file: The file name, which must be a string, to save the current program state in.
dir: The directory to place the file in.
force: A flag which if set to 1 will cause the file to be overwritten.
Description
~~~~~~~~~~~
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 compress_type argument which can be set to
0: No compression (no file extension).
1: bzip2 compression ('.bz2' file extension).
2: gzip compression ('.gz' file extension).
Examples
~~~~~~~~
The following commands will save the current program state into the file 'save':
relax> state.save('save', compress_type=0)
relax> state.save(file='save', compress_type=0)
The following commands will save the current program state into the bzip2 compressed file
'save.bz2':
relax> state.save('save')
relax> state.save(file='save')
relax> state.save('save.bz2')
relax> state.save(file='save.bz2')
If the file 'save' already exists, the following commands will save the current program
state by overwriting the file.
relax> state.save('save', 1)
relax> state.save(file='save', force=1)
|