save_arrays
- sherpa.astro.ui.save_arrays(filename, args, fields=None, ascii=True, clobber=False) None
Write a list of arrays to a file.
- Parameters:
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
Falsethen the data is written as a FITS format binary table. The default isTrue. 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).
- Raises:
sherpa.utils.err.IOErr – If
filenamealready exists andclobberisFalse.
See also
save_dataSave the data to a file.
save_imageSave the pixel values of a 2D data set to a file.
save_tableSave a data set to a file as a table.
Examples
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)