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

Jump to: Description · Example · Bugs · See Also

AHELP for CIAO 4.9


Context: contrib


Add a column to a crate given a name and array of values


add_colvals(crate, colname, colvals, unit=None, desc=None)


Adds a column with a name of colname and contents of colvals - which should be an array - to the table crate. If the unit argument is not None then it is a string listing the units of the column. If desc is not None then it is used as the description of the column.

Loading the routine

The routine can be loaded into a ChIPS or Sherpa session by saying:

from crates_contrib.utils import *


chips> cr = read_file('table.dat')
chips> c = get_colvals(cr, 'counts')
chips> t = get_colvals(cr, 'exposure')
chips> add_colvals(cr, 'rate', c/t, unit='s**-1')
chips> write_file(cr, 'table.dat', clobber=True)

Here we add the column "rate", defined as counts/exposure, to the table and then overwrite the original file.


See the bug pages on the CIAO 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_table_crate, write_columns
add_col, col_exists, copy_colvals, delete_col, get_col, get_col_names, get_colvals, get_number_cols, is_virtual, set_colvals

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.