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 2008

URL: http://cxc.harvard.edu/ciao4.1/add_col.sl.html
AHELP for CIAO 4.1

add_col

Context: sl.crates

Synopsis

Add a column to a crate.

Syntax

add_col(crate, cratedata);

Description

  • crate - input crate
  • cratedata - CrateData object to be added

The add_col command adds the column to the crate. If the column already exists in the crate, it is replaced. The command returns a "1" if the column is successfully added.

The column is only added to the crate. The write_file ("ahelp write_file") command can be used to save the modified crate to a file.

Example

slsh> cr = read_file("evt2.fits");
slsh> print (get_col_names(cr));
['CHANNEL' 'E_MIN' 'E_MAX']
slsh> emin = copy_colvals(cr, "E_MIN");
slsh> emax = copy_colvals(cr, "E_MAX");
slsh> emid = 0.5 * (emin + emax);
slsh> col = CrateData();
slsh> col.name = "E_MID";
slsh> py_call(col.load, emid, 1);
1
slsh> add_col(cr, col);
1
slsh> print (get_col_names(cr));
['CHANNEL' 'E_MIN' 'E_MAX' 'E_MID']

Here we create a column called E_MID, whose values are the mid-points of the E_MIN and E_MAX columns, and then add it to the crate.

The syntax for adding data to a column - namely

py_call(col.load, <values>, 1)

- will be improved in a later release.

Bugs

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

Last modified: December 2008



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.