get_xsxset

sherpa.astro.xspec.get_xsxset() dict[str, str][source] [edit on github]
sherpa.astro.xspec.get_xsxset(name: None) dict[str, str]
sherpa.astro.xspec.get_xsxset(name: str) str

Return the X-Spec model setting or settings.

Changed in version 4.17.1: This routine can now be called with no argument, which means that a dictionary containing all the settings is returned. Asking for an unset keyword now raises a KeyError rather than returning the empty string.

Parameters:

name (str or None, optional) – The name of the setting (converted to upper case before being sent to X-Spec). There is no check that the name is valid.

Returns:

val – When name is set, returns the value set by a previous call to set_xsxset. When name is not set a dictionary of all the settings is returned.

Return type:

str or dict

Raises:

KeyError – When the name passed is not set in X-Spec.

Notes

Due to the way X-Spec model settings work, get_xsxset will only return a value if it has previously been set with a call to set_xsxset. There is no way to retrieve the default value of a setting.

Examples

>>> set_xsxset("POW_EMIN", "0.5")
>>> get_xsxset("pow_emin")
'0.5'
>>> get_xsxset()
{'POW_EMIN': '0.5'}