About Chandra Archive Proposer Instruments & Calibration Newsletters Data Analysis HelpDesk Calibration Database NASA Archives & Centers Chandra Science Links

Skip the navigation links
Last modified: December 2008

URL: http://cxc.harvard.edu/ciao4.1/delete_col.py.html
AHELP for CIAO 4.1

delete_col

Context: py.crates

Synopsis

Delete a column from a crate.

Syntax

delete_col(crate, colid)

Description

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

The delete_col command removes the column from the crate. The print_col_names command ("ahelp print_col_names") lists all the columns in the file with the corresponding numbers.

The command returns a "1" if the column is successfully deleted. The column is only deleted from the data in the crate; it's not removed from the input file. The write_file command ("ahelp write_file") can be used to save the modified crate to a file.

Example 1

>>> cr = read_file("evt2.fits")
>>> print(get_col_names(cr))
['CHANNEL' 'COUNTS' 'STAT_ERR' 'BACKGROUND' 'BIN_LO' 'BIN_HI']
>>> delete_col(cr, "STAT_ERR")
1
>>> col_exists(cr, "STAT_ERR")
0
>>> write_file(cr, "nostat.fits")
1

Delete the STAT_ERR column from the crate, then use the col_exists command to confirm it has been deleted. Write the crate to nostat.fits.

Example 2

>>> cr = read_file("evt2.fits")
>>> delete_col(cr, 4)
1
>>> col_exists(cr, "BACKGROUND")
0
>>> write_file(cr, "edit.fits")
1

Delete column number 4 - the BACKGROUND column in this file - from the crate, then write the crate to file edit.fits.

Bugs

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

Last modified: December 2008



The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory.
60 Garden Street, Cambridge, MA 02138 USA.    Email: cxcweb@head.cfa.harvard.edu
Smithsonian Institution, Copyright © 1998-2004. All rights reserved.