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

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


AHELP for CIAO 4.4

get_keyval

Context: crates

Synopsis

Return the value of a keyword in a crate.

Syntax

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

Description

  • crate - input crate
  • keyname - key name (case insensitive)
  • keynum - key number, 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 ("ahelp get_key_names") can be used to find the names of all the keywords in a Crate.

The get_key command ("ahelp get_key") 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"))
18792.5851136

The value of the EXPOSURE keyword is retrieved with get_keyval.

Example 2

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

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

Example 3

>>> print(get_keyval(cr, 9))
2001-07-09T22:31:32

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

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_keyval
crates
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_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.