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


Delete a keyword from a crate.


delete_key(crate, keyname)
delete_key(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 delete_key command removes the specified keyword from the crate.

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 get_key_names routine can be used to find the names of all the keywords in a Crate.

Example 1

>>> cr = read_file("evt2.fits")
>>> print(get_key_names(cr))
>>> delete_key(cr, "CALDBVER")
>>> key_exists(cr, "CALDBVER")
>>> write_file(cr, "copy.fits")

Here we delete the CALDBVER keyword from the file evt2.fits, writing the results to copy.fits. Note that evt2.fits is unchanged by this sequence.

Example 2

>>> cr = read_file("evt2.fits")
>>> delete_key(cr, 35)
>>> delete_key(cr, -2)

Here we delete the 36th and last-but-one keywords from the crate.


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

make_image_crate, make_table_crate, scale_image_crate, smooth_image_crate, write_arrays, write_columns
add_col, add_key, add_piximg, cratekey, delete_col, delete_piximg, get_key, get_key_names, get_keyval, key_exists, read_file, read_pha, read_rmf, set_key, set_keyval, write_file, write_pha, write_rmf

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.