Skip to the navigation links
Last modified: December 2009

AHELP for CIAO 4.2


Context: py.crates


Return a CrateData object of a column from a crate.


get_col(crate, colid)


  • crate - input crate
  • colid - column name or number, where the first column is numbered 0

The get_col command returns a CrateData object representing the the contents of the column within the crate. The print_col_names command ("ahelp print_col_names") lists all the columns in the file with the corresponding numbers.

To retrieve just the column data (without any metadata), use copy_colvals ("ahelp copy_colvals") or get_colvals ("ahelp get_colvals").

Example 1

>>> cr = read_file("evt2.fits")
>>> col = get_col(cr, "sky")
>>> print get_crate_item_type(col)

The sky(x,y) column is retrieved from the crate "cr" as a CrateKey object. The get_crate_item_type command is used to confirm its type.

Example 2

>>> cr = read_file("evt2.fits")
>>> col = get_col(cr, 0)

Keyword number 0 - the time column in this file - is retrieved as a CrateData object.


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

See Also

add_col, col_exists, copy_colvals, cratedata, delete_col, get_axis_transform, get_col_names, get_colvals, get_crate_item_type, get_crate_type, get_key, get_key_names, get_keyval, get_number_cols, get_number_rows, get_piximg, get_piximg_shape, get_piximgvals, get_transform, get_transform_matrix, is_virtual, print_col_names, set_colvals

Last modified: December 2009