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.py.html
AHELP for CIAO 4.1

add_col

Context: py.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

>>> cr = read_file("evt2.fits")
>>> print get_col_names(cr)
['CHANNEL' 'E_MIN' 'E_MAX']
>>> emin = copy_colvals(cr, "E_MIN")
>>> emax = copy_colvals(cr, "E_MAX")
>>> emid = 0.5 * (emin + emax)
>>> col = CrateData()
>>> col.name = "E_MID"
>>> col.load(emid, 1)
1
>>> add_col(cr, col)
1
>>> 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.

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.