Skip to the navigation links
Last modified: December 2009

URL: http://cxc-newtest.cfa.harvard.edu/ciao4.2/key_exists.sl.html
AHELP for CIAO 4.2

key_exists

Context: sl.crates

Synopsis

Determine if the keyword exists in the crate.

Syntax

key_exists(crate, name);

Description

  • crate - input crate
  • name - the keyword to check

The key_exists command returns "1" if the keyword exists and "0" if not. The comparison is case-insensitive.

The print_key_names command ("ahelp print_key_names") lists all the keywords in the file.

Example 1

slsh> cr = read_file("evt2.fits");
slsh> key_exists(cr, "DETNAM");
1
slsh> key_exists(cr, "detnam");
1

The keyword DETNAM exists in the file evt2.fits. Since the check is case-insensitive, the command returns 1 for both "DETNAM" and "detnam".

Example 2

slsh> cr = read_file("evt2.fits");
slsh> key_exists(cr, "DETECTOR");
0

There is not a keyword named DETECTOR in the file evt2.fits.

Bugs

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

See Also

sl.crates
add_key, col_exists, delete_key, get_key, get_key_names, get_keyval, is_arf, is_pha, is_rmf, is_virtual, print_key_names, set_keyval

Last modified: December 2009