set_io_backend

sherpa.astro.io.set_io_backend(new_backend: str) None[source] [edit on github]

Set the Sherpa IO backend.

IO backends are registered in Sherpa with a string name. See the examples below for how to get a list of available backends.

Parameters:

new_backend (string) – Set a sherpa IO backend.

Examples

Set the backend to use astropy for I/O operations:

>>> from sherpa.astro import io
>>> io.set_io_backend('astropy')

Get a list of registered backends:

>>> from sherpa.astro import io
>>> io.IO_BACKENDS
{'dummy': <module 'sherpa.astro.io.dummy_backend' ...

This list shows the names and the module for each backend. Details for each backend can be found in the Sherpa documentation or by inspecting the backend modules using normal Python functionality:

>>> from sherpa.astro.io import dummy_backend
>>> help(dummy_backend)
Help on module sherpa.astro.io.dummy_backend in sherpa.astro.io:

NAME
    sherpa.astro.io.dummy_backend - A dummy backend for I/O.

DESCRIPTION
    This backend provides no functionality and raises an error if any of
    its functions are used. It is provided as a model for what routines
    are needed in a backend, even if it does nothing, and to allow
    `sherpa.astro.io` to be imported even if no usable backend is
    available.
...