sherpa.astro.ui.set_default_id(id: int | str) None

Set the default data set identifier.

The Sherpa data id ties data, model, fit, and plotting information into a data set easily referenced by id. The default identifier, used by many commands, is changed by this command. The current setting can be found by using get_default_id.


id (int or str) – The default data set identifier to be used by certain Sherpa functions when an identifier is not given, or set to None.

See also


Return the default data set identifier.


List the identifiers for the loaded data sets.


The default Sherpa data set identifier is the integer 1.


After the following, many commands, such as set_source, will use ‘src’ as the default data set identifier:

>>> set_default_id('src')

Restore the default data set identifier.

>>> set_default_id(1)