| AHELP for CIAO 4.4 | get_col |
Context: crates |
Synopsis
Return a CrateData object of a column from a crate.
Syntax
get_col(crate, colname) get_col(crate, colnum)
Description
- crate - input table crate
- colname - column name (case insensitive)
- colnum - column 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. To retrieve just the column data (without any metadata), use copy_colvals ("ahelp copy_colvals") or get_colvals ("ahelp get_colvals").
The get_col_names() routine ("ahelp get_col_names") can be used to find the columns in a Crate.
Example 1
>>> cr = read_file("rprof.fits")
>>> col = get_col(cr, "sky")
>>> print(col)The sky(x,y) column is retrieved from the crate "cr" as a CrateData object. The output of the print() call is a representation of the data stored in this object:
Name: sky
Shape: (50, 2)
Datatype: float64
Nsets: 50
Unit: pixel
Desc: Position
Eltype: Vector
NumCpts: 2
Cpts: ['X', 'Y']
Example 2
>>> cr = read_file("evt2.fits")
>>> col = get_col(cr, 0)
>>> print(col.name)
time
>>> print(col.unit)
sColumn number 0 - the time column in this file - is retrieved as a CrateData object.
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_colvals
- crates
- add_col, col_exists, copy_colvals, copy_piximgvals, 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, set_colvals

![[CIAO Logo]](../imgs/ciao_logo_navbar.gif)