Skip to the navigation links
Last modified: December 2009

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

col_exists

Context: sl.crates

Synopsis

Determine if a column exists in a crate.

Syntax

col_exists(crate, name);

Description

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

The col_exists command returns "1" if the column exists and "0" if not. The name comparison is case-insensitive. The crate must be a 'Table', 'ARF', 'PHA', or 'RMF' crate.

The print_col_names command ("ahelp print_col_names") lists all the columns in the file.

Example 1

slsh> cr = read_file("evt2.fits");
slsh> col_exists(cr, "ENERGY");
1
slsh> col_exists(cr, "energy");
1

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

Example 2

slsh> cr = read_file("evt2.fits");
slsh> col_exists(cr, "count_rate");
0

There is not a column named count_rate 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_col, copy_colvals, delete_col, get_col, get_col_names, get_colvals, get_number_cols, is_arf, is_pha, is_rmf, is_virtual, key_exists, print_col_names, set_colvals

Last modified: December 2009