Chandra X-Ray Observatory
Skip to the navigation links
Last modified: December 2013

Jump to: Description · Examples · Bugs · See Also

AHELP for CIAO 4.9


Context: crates


Return the value of a keyword in a crate.


get_keyval(crate, keyname)
get_keyval(crate, keynum)


Argument Description
crate A Crate object such as a TABLECrate or IMAGECrate
keyname The key name (case insensitive).
keynum The number of the key, where the first key is numbered 0.

The get_keyval command returns the value of specified keyword within the crate.

The get_key_names routine can be used to find the names of all the keywords in a Crate.

The get_key command returns a CrateKey object for the keyword, which is useful if you are interested in the metadata associated with it.

Example 1

>>> cr = read_file("evt2.fits")
>>> print(get_keyval(cr, "EXPOSURE"))

The value of the EXPOSURE keyword is retrieved with get_keyval.

Example 2

>>> expo = get_keyval(cr, "EXPOSURE")
>>> print(expo)

The value of the EXPOSURE keyword is stored in the variable "expo".

Example 3

>>> print(get_keyval(cr, 9))

The value of keyword number 9 - the DATE keyword in this file - is returned.


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

add_key, copy_piximgvals, cratekey, delete_key, get_axis_transform, get_col, get_col_names, get_colvals, get_crate_item_type, get_crate_type, get_key, get_key_names, get_number_cols, get_number_rows, get_piximg, get_piximg_shape, get_piximgvals, get_transform, get_transform_matrix, key_exists, set_key, set_keyval

Last modified: December 2013
Smithsonian Institute Smithsonian Institute

The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory. 60 Garden Street, Cambridge, MA 02138 USA.   Email: Smithsonian Institution, Copyright © 1998-2017. All rights reserved.