save

sherpa.astro.ui.save(filename='sherpa.save', clobber=False) None

Save the current Sherpa session to a file.

Parameters:
  • filename (str, optional) – The name of the file to write the results to. The default is ‘sherpa.save’.

  • clobber (bool, optional) – This flag controls whether an existing file can be overwritten (True) or if it raises an exception (False, the default setting).

Raises:

sherpa.utils.err.IOErr – If filename already exists and clobber is False.

See also

clean

Clear all stored session data.

restore

Load in a Sherpa session from a file.

save_all

Save the Sherpa session as an ASCII file.

Notes

The current Sherpa session is saved using the Python pickle module. The output is a binary file, which may not be portable between versions of Sherpa, but is platform independent, and contains all the data. This means that files created by save can be sent to collaborators to share results.

The output of save is not guaranteed to work with different versions of Sherpa, so it is not ideal as an archiving format. The save_all command is better suited for long-term support, but it unfortunately can not store ancillary variables, extra modules, or all Sherpa settings. It is suggested that the output of both should be checked when the output may be used long term.

Examples

Save the current session to the file ‘sherpa.save’.

>>> save()

Save the current session to the file ‘bestfit.sherpa’, overwriting any existing version of the file.

>>> save('bestfit.sherpa', clobber=True)