Last modified: December 2023

AHELP for CIAO 4.16 Sherpa


Context: saving


Save the information about the current session to a text file.


save_all(outfile=None, clobber=False)

outfile - str or file-like, optional
clobber - bool, optional


This differs to the `save` command in that the output is human readable. Three consequences are:


Example 1

Write the current Sherpa session to the screen:

>>> save_all()

Example 2

Save the session to the file 'fit.sherpa', overwriting it if it already exists:

>>> save_all('fit.sherpa', clobber=True)

Example 3

Write the contents to a StringIO object:

>>> from io import StringIO
>>> store = StringIO()
>>> save_all(store)


The parameters for this function are:

Parameter Definition
outfile If given, the output is written to this file, and the `clobber` parameter controls what happens if the file already exists. `outfile` can be a filename string or a file handle (or file-like object, such as StringIO ) to write to. If not set then the standard output is used.
clobber If `outfile` is a filename, then this flag controls whether an existing file can be overwritten ( True ) or if it raises an exception ( False , the default setting).


This command will create a series of commands that restores the current Sherpa set up. It does not save the set of commands used. Not all Sherpa settings are saved. Items not fully restored include:

Changes in CIAO

Changed in CIAO 4.16

Any set_psf calls are now included in the output file. The filter is no-longer included if it does not exclude any data, and the code tries to recreate manually-created datasets (e.g. use of `dataspace1d` or `load_arrays` ), but not all situations are handled. XSPEC table models are now correctly restored.


See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.

See Also

save_chart_spectrum, save_marx_spectrum
save_model, save_source
restore, save, save_arrays, save_data, save_delchi, save_error, save_filter, save_grouping, save_image, save_pha, save_quality, save_resid, save_staterror, save_syserror, save_table, script