Chandra X-Ray Observatory (CXC)
Skip to the navigation links
Last modified: December 2012

URL: http://cxc.harvard.edu/ciao/add_col.html
Jump to: Description · Example · Bugs · See Also


AHELP for CIAO 4.5

add_col

Context: 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 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("mdl.fits")
>>> print(get_col_names(cr))
['E_MIN' 'E_MAX' 'MDLFLUX']
>>> emin = copy_colvals(cr, "E_MIN")
>>> emax = copy_colvals(cr, "E_MAX")
>>> emid = 0.5 * (emin + emax)
>>> col = CrateData()
>>> col.name = "E_MID"
>>> col.values = emid
>>> add_col(cr, col)
>>> print(get_col_names(cr))
['E_MIN' 'E_MAX' 'MDLFLUX' 'E_MID']
>>> write_file(cr, "mdl2.fits")

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 write_file call creates a new file which includes this column.

Bugs

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

contrib
add_colvals, make_image_crate, make_table_crate, scale_image_crate, smooth_image_crate, write_arrays, write_columns
crates
add_key, add_piximg, col_exists, copy_colvals, delete_col, delete_key, delete_piximg, get_col, get_col_names, get_colvals, get_number_cols, is_virtual, read_file, read_pha, read_rmf, set_colvals, write_file, write_pha, write_rmf

Last modified: December 2012
CXC logo

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-2012. All rights reserved.