Synopsis
Return a CrateData object of a column from a crate.
Syntax
get_col(crate, colname) get_col(crate, colnum)
Description
| Argument | Description |
|---|---|
| crate | The table crate. |
| colname | The column name (case insensitive). |
| colnum | The 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 or get_colvals.
The get_col_names routine can be used to find the columns in a Crate.
Examples
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, add_piximg, col_exists, copy_colvals, copy_piximgvals, cratedata, create_vector_column, create_virtual_column, 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