Skip to the navigation links
Last modified: December 2009

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

set_keyval

Context: py.crates

Synopsis

Set the keyword value in a crate.

Syntax

set_keyval(crate, keyid, value)

Description

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

The set_keyval command sets the value of an existing keyword within the input crate. The command returns a "1" if the keyword is successfully added.

The value is only changed in the crate; the input file is unaffected. The write_file command ("ahelp write_file") can be used to save the modified crate to a file.

Example

>>> cr = read_file("evt2.fits")
>>> set_keyval(cr, "ORIGIN", "CXC")
1
>>> write_file(cr, "evt2.fits")
1

Update the value of the ORIGIN keyword to "CXC", then overwrite the original file.

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_key, get_key_names, get_keyval, key_exists, print_key_names, set_colvals, set_piximgvals

Last modified: December 2009