| AHELP for CIAO 4.5 | delete_key |
Context: crates |
Synopsis
Delete a keyword from a crate.
Syntax
delete_key(crate, keyname) delete_key(crate, keynum)
Description
- crate - input crate
- keyname - key name (case insensitive)
- keynum - key number, where the first key is numbered 0
The delete_key command removes the specified keyword from 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.
Example 1
>>> cr = read_file("evt2.fits")
>>> print(get_key_names(cr))
['TELESCOP' 'INSTRUME' 'DETNAME' 'FILTER' 'CHANTYPE' 'DETCHANS'...]
>>> delete_key(cr, "CALDBVER")
>>> key_exists(cr, "CALDBVER")
False
>>> 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. Please see "ahelp write_file" for caveats on the data copied over by the write_file command.
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.
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, make_image_crate, make_table_crate, scale_image_crate, set_key, smooth_image_crate, write_arrays, write_columns
- crates
- 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_keyval, write_file, write_pha, write_rmf

![[CIAO Logo]](../imgs/ciao_logo_navbar.gif)