Chandra X-Ray Observatory (CXC)
Skip to the navigation links
Last modified: December 2012

URL: http://cxc.harvard.edu/ciao/delete_key.html
Jump to: Description · Examples · Bugs · See Also


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, 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_key, set_keyval, write_file, write_pha, write_rmf

Last modified: December 2012
CXC logo

The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory. 60 Garden Street, Cambridge, MA 02138 USA.   Email: cxcweb@head.cfa.harvard.edu Smithsonian Institution, Copyright © 1998-2012. All rights reserved.