Skip to the navigation links
Last modified: December 2009

URL: http://cxc-newtest.cfa.harvard.edu/ciao4.2/get_keyval.py.html
AHELP for CIAO 4.2

get_keyval

Context: py.crates

Synopsis

Return the value of a keyword in a crate.

Syntax

get_keyval(crate, keyid)

Description

  • crate - input crate
  • keyid - keyword name or number, where the first keyword is numbered 0

The get_keyval command returns the value of specified keyword within the crate. The print_key_names command ("ahelp print_key_names") lists all the keywords in the file with the corresponding numbers.

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")
>>> get_keyval(cr, "EXPOSURE")
18792.5851136

The value of the EXPOSURE keyword is retrieved with get_keyval.

Example 2

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

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

Example 3

>>> cr = read_file("evt2.fits")
>>> 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.

See Also

py.crates
add_key, 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, print_key_names, set_keyval

Last modified: December 2009