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
arrayofarrays The arrays to write out.
- fields
arrayofstr The column names (should match the size of
args).- asciibool,
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).- clobberbool,
optional This flag controls whether an existing file can be overwritten (
True) or if it raises an exception (False, the default setting).
- filename
- Raises:
sherpa.utils.err.IOErrIf
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)