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.