|AHELP for CIAO 4.9||
Delete a keyword from a crate.
delete_key(crate, keyname) delete_key(crate, keynum)
|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.
>>> 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.
>>> 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.
- 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