create_xspec_code

sherpa.astro.utils.xspec.create_xspec_code(models: list[ModelDefinition], name: str = '_models') XSPECcode[source] [edit on github]

Create the Python classes and C++ code for the models.

Create the code fragments needed to build the XSPEC interface but they are not complete.

Parameters:
  • models (list of ModelDefiniton)

  • name (str, optional) – The name of the module.

Returns:

code – The code is accessible as the ‘python’ and ‘compiled’ fields.

Return type:

XSPECcode

Notes

We skip any model functions that are used in multiple models, as this was an error in the XSPEC 12.8.2 model.dat which caused the eplogpar to call the wrong function. This has been fixed but we add a check here just in case.