sherpa.astro.ui.save_arrays(filename, args, fields=None, ascii=True, clobber=False)

Write a list of arrays to a file.

  • filename (str) – The name of the file to write the array to.

  • args (array of arrays) – The arrays to write out.

  • fields (array of str) – The column names (should match the size of args).

  • ascii (bool, optional) – If False then the data is written as a FITS format binary table. The default is True. The exact format of the output file depends on the I/O library in use (Crates or AstroPy).

  • clobber (bool, optional) – This flag controls whether an existing file can be overwritten (True) or if it raises an exception (False, the default setting).


sherpa.utils.err.IOErr – If filename already exists and clobber is False.

See also


Save the data to a file.


Save the pixel values of a 2D data set to a file.


Save a data set to a file as a table.


Write the x and y columns from the default data set to the file ‘src.dat’:

>>> x = get_indep()
>>> y = get_dep()
>>> save_arrays('src.dat', [x, y])

Use the column names “r” and “surbri” for the columns:

>>> save_arrays('prof.fits', [x,y], fields=["r", "surbri"],
...             ascii=False, clobber=True)