The save_state() function
Sherpa has many state objects; several that control the appearance
of plots (e.g., sherpa.plot) and several that control the execution
of parameter estimation methods (e.g., sherpa.regproj). A user
could spend much time changing the default values of the state
objects to more closely match theor preferences. The function
save_state() provides an easy way to save the current values
of all the fields of all the state objects to a file, which
can then be read into Sherpa at a later time. For example:
sherpa> save_state()
sherpa> save_state("state1.shp")
In the former case, the values of the state objects are saved
to the file $HOME/.sherpa-state-rc (which is overwritten every time
save_state() is executed). If $HOME/.sherpa-state-rc exists, then
the file is automatically read in whenever the user starts Sherpa.
In the latter case, the state is saved in the file state1.shp;
this file will not be automatically read in. The user can read in
the file at any time during the Sherpa session. This can be useful
if, for example, the user wishes to use two or more different plot
styles.
At the beginning of a Sherpa session,
Sherpa looks for a .sherpa-state-rc in the following
locations:
-
the $SHERPA_STATE_RC environment variable
-
$PWD/.sherpa-state-rc
-
$HOME/.sherpa-state-rc
The search stops when the first match is made and
Sherpa is launched, even if the chosen
.sherpa-state-rc file contains an error. Sherpa
first searches for a .sherpa-state-rc, and if it is found, reads it
in; then Sherpa searches for a .sherparc file, and if a
.sherparc file is found, reads it in. Thus, .sherparc can contain
configuration variable settings that can override settings in
.sherpa-state-rc, as .sherparc is read in after the .sherpa-state-rc
file.
|