TemporaryIOBackend
- class sherpa.astro.io.TemporaryIOBackend(new_backend: str)[source] [edit on github]
Bases:
AbstractContextManagerSet the Sherpa I/O backend as a context, e.g. for a single operation
- Parameters:
new_backend (string) – Name of a known Sherpa IO backend.
Examples
Temporarily set a different backend and print out its name. Of course, for this example to be useful, we should not just print the name of the backend, but use it to read or write a datafile.
>>> from sherpa.astro import io >>> with io.TemporaryIOBackend('dummy'): ... print(io.backend.name) dummy
Get a list of registered backends:
>>> from sherpa.astro import io >>> io.IO_BACKENDS {'dummy': <module 'sherpa.astro.io.dummy_backend' ...