About Chandra Archive Proposer Instruments & Calibration Newsletters Data Analysis HelpDesk Calibration Database NASA Archives & Centers Chandra Science Links

Skip the navigation links
Last modified: December 2007

URL: http://cxc.harvard.edu/sherpabeta/load_ascii.py.html
AHELP for Sherpa 4.0 Beta load_ascii Context: py.sherpa

Synopsis

Load ASCII/text data from a file

Syntax

load_data( [id=1], filename, [ncols=2,colkeys=None,sep="
",comment='#',dstype=Data1D] )

Description

Load tabular data from column-based text (ASCII) file into a data set by data set ID.

Example

sherpa> load_data("data.txt")
sherpa> load_data("bkg", "bkg.txt", ncol=3)
sherpa> load_data(1, "data.txt", colkeys=["x", "y", "staterror"])
sherpa> load_data("data.txt", sep="\t")
sherpa> load_data("data.txt", colkeys=["xlo", "xhi", "y", "stat_err"],
dstype=Data1DInt)
sherpa> load_data("data.txt", colkeys=["col1", "col3", "col2"])

The load_data function can be called with just a filename and path argument, in which case all the default arguments will be used. In this case, two columns from the text file will be read into a Data1D data set as "x" and "y". The user can specify which columns to read from the file by their column names in the order as they correspond to the data arrays in the data set. If no columns names are present, defaults will be assigned. (e.g., "col1", "col2", ...) The default data set, Data1D, uses the order: x, y, staterror, syserror for data arrays. Data set IDs can be integers or strings; in the latter case a string can denote useful information about the data (e.g., whether it is your source or background data set).

Bugs

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

Last modified: December 2007



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