          Add a keyword to a crate given a CrateKey object.

add_key(crate, cratekey)

Argument
Description
crate
A Crate object such as a TABLECrate or IMAGECrate
cratekey
The CrateKey object storing the keyword and its value.

The add_key command adds the keyword to the end of the keyword list in the crate. If the keyword already exists, the value is replaced.

Only the crate is changed; the input file is unaffected. The write_file command can be used to save the modified crate to a file.

The set_key routine can be used to create a keyword without having to create a CrateKey object.

>>> cr = read_file("evt2.fits")
>>> key = CrateKey()
>>> key.name = "TIMEDEL"
>>> key.value("0.00285")
>>> key.unit = "s"
>>> add_key(cr, key)

Create a new key named "TIMEDEL" with a value of 0.00285 and units of seconds, then add it to the crate.

See the bug pages on the CIAO website for an up-to-date listing of known bugs.

December 2015