Chandra X-Ray Observatory
Skip to the navigation links
Last modified: September 2011

Jump to: Description · Examples · Bugs · See Also

AHELP for CIAO 4.10


Context: contrib


Write arrays to an ASCII file


write_arrays(filename, args, [fields=None, sep=" ", comment="#",
clobber=False, linebreak="\n", format="%g"])


Write a series of arrays as a table to an ASCII file.

Loading the routine

The routine can be loaded into Sherpa by saying:

from crates_contrib.utils import *

Function arguments

  • filename - filename of outfile
  • args - array of column arrays
  • fields - array of strings representing the column names. None (default)=omit column names, otherwise use the supplied column names
  • sep - column separation character, default=" "
  • comment - column header comment character, default="#"
  • clobber - clobber outfile False (default)=do not clobber file - if exists, True=clobber file - if exists
  • linebreak - row separation character, default="\n"
  • format - array element format, default="%g"


Example 1

sherpa> write_arrays("out.dat", [arr1, arr2, arr3])

Write arrays arr1,arr2,arr3 to a file out.dat

Example 2

sherpa> write_arrays("out.dat", [arr1, arr2, arr3],
fields=["arr1","arr2","arr3"], clobber=True)

Write arrays arr1,arr2,arr3 to a file out.dat with column headers "#arr1 arr2 arr3", clobbering if necessary


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

Refer to the CIAO bug pages for an up-to-date listing of known issues.

See Also

make_image_crate, make_table_crate, scale_image_crate, smooth_image_crate, write_columns
add_col, add_key, add_piximg, delete_col, delete_key, delete_piximg, read_file, read_pha, read_rmf, write_file, write_pha, write_rmf

Last modified: September 2011
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.