Chandra X-Ray Observatory
Skip to the navigation links
Last modified: December 2013

Jump to: Description · Examples · Bugs · See Also

AHELP for CIAO 4.9 Sherpa v1


Context: saving


Save a Sherpa data set to an ASCII file.


save_data( [id,] filename [, fields=None, sep="", comment="#",
clobber=False] )


The save_data command saves a dataset to a column-based ASCII file. Optional arguments allow the user to assign column names, a column separator, or a comment character. This command has no return value.

The save_table command can be used to create a FITS format output file ("ahelp save_table").

  • id - the id of the dataset to use; if not given, uses the default dataset id (id=1 by default, see "ahelp get_default_id")
  • filename - the output filename, including path
  • fields - names for the output columns
  • sep - the column-separating character; default is a space (" ")
  • comment - character which indicates a comment line; default=#
  • clobber - clobber outfile; default=False (do not clobber if file exists)

Example 1

sherpa> save_data("data.dat")

Save dataset 1 as an ASCII file named "data.dat", using the default settings.

Example 2

sherpa> save_data("src", "source.ascii", ["x", "y"], "&")

Dataset "src" is written to the file "source.ascii". The column names are "x" and "y", and the separator is set to "&". (This can be useful, for instance, to create a latex table from the output.)


See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.

See Also

dataspace1d, dataspace2d, datastack, fake, load_arf, load_arrays, load_ascii, load_bkg, load_bkg_arf, load_bkg_rmf, load_data, load_grouping, load_image, load_multi_arfs, load_multi_rmfs, load_pha, load_quality, load_rmf, load_staterror, load_syserror, load_table, pack_image, pack_pha, pack_table, unpack_arf, unpack_arrays, unpack_ascii, unpack_bkg, unpack_data, unpack_image, unpack_pha, unpack_rmf, unpack_table
get_default_id, list_bkg_ids, list_data_ids
add_model, add_user_pars, load_table_model, load_template_model, load_user_model, save_model, save_source
restore, save, save_all, save_arrays, save_delchi, save_error, save_filter, save_grouping, save_image, save_pha, save_quality, save_resid, save_staterror, save_syserror, save_table, script

Last modified: December 2013
Smithsonian Institute Smithsonian Institute

The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory. 60 Garden Street, Cambridge, MA 02138 USA.   Email: Smithsonian Institution, Copyright © 1998-2017. All rights reserved.