parse_xspec_model_description

sherpa.astro.utils.xspec.parse_xspec_model_description(modelfile, namefunc: ~typing.Callable[[str], str] = <function add_xs_prefix>) list[ModelDefinition][source] [edit on github]

Given an XSPEC model file - e.g. the lmodel.dat file - return information about the models it contains.

Parameters:
modelfilestr or os.PathLike or file-like

The name of the model file (often called model.dat or lmodel.dat) or a file-like object containing the file

namefunccallable(), optional

The routine used to convert an XSPEC model name, such as “apec”, into the Sherpa class name. The default function prepends ‘XS’ to the name.

Returns:
modelslist of ModelDefinition

A representation of each model. This will include models that Sherpa does not support at this time (e.g. mixing models).

Raises:
ValueError

An invalid or unsupported parameter line, or an unrecognized model type, was found.