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

URL: http://cxc.harvard.edu/ciao/add_keyval.html
AHELP for CIAO 4.4

add_keyval

Context: contrib

Synopsis

Add a keyword to a crate given a name and a value

Syntax

add_keyval(crate, keyname, keyval, unit=None, desc=None)

Description

Adds a key to the header of the crate; existing keywords are replaced. If the unit argument is not None then it is a string listing the units of the key. If desc is not None then it is used as the description of the key.

Loading the routine

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

from crates_contrib.utils import *

Example

chips> cr = make_table_crate(x, y, z, colnames=["x", "y", "z"])
chips> add_key(cr, 'xmean', x.mean())
chips> add_key(cr, 'zmax', z.mean(), unit='cm**2', desc='Max of Z')

Here we add the XMEAN and ZMAX keywords to a crate, the first with the mean of the x array and the second with the maximumn value of the z column. The ZMAX keyword has its units and description set as well.

Changes in the January 2012 Release

The add_keyval() routine is new in this release.

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

crates
add_key, cratekey, delete_key, get_key, get_key_names, get_keyval, key_exists, set_keyval

Last modified: December 2011
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.