save_arrays¶
-
sherpa.astro.ui.
save_arrays
(filename, args, fields=None, ascii=True, clobber=False)¶ 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
False
then 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 filename already exists and clobber is
False
.
See also
save_data
Save the data to a file.
save_image
Save the pixel values of a 2D data set to a file.
save_table
Save 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)