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 2007

URL: http://cxc.harvard.edu/ciao4.0/add_key.py.html
Hardcopy (PDF): A4 | Letter
AHELP for CIAO 4.0 add_key Context: py.crates

Synopsis

Adds a keyword to a crate.

Syntax

add_key(crate, cratekey)

Description

  • crate - input Crate object
  • cratekey - CrateKey object to be added

Adds the keyword represented by the cratekey argument to the crate. If the keyword already exists it will be replaced otherwise it will be added to the end of the keyword list.

Argument Description
crate a Crate object
cratekey CrateKey object

Example

>>> crate = read_file("table.fits")
>>> print get_key_names(crate)
['TELESCOP' 'INSTRUME' 'DETNAME' 'FILTER' 'CHANTYPE' 'DETCHANS'
'HDUCLASS'
'HDUCLAS1' 'HDUCLAS2' 'HDUCLAS3' 'HDUVERS' 'HDUVERS1' 'HDUVERS2'
'RMFVERSN' 'PHAFILE' 'EB_SCALE' 'EBOFFSET' 'SMOOTHED' 'CVSD0001'
'CVST0001' 'CDES0001']
>>> key = CrateKey()
>>> key.name = "NEWKEY"
>>> add_key(cr, key)
1
>>> print get_key_names(crate)
['TELESCOP' 'INSTRUME' 'DETNAME' 'FILTER' 'CHANTYPE' 'DETCHANS'
'HDUCLASS'
'HDUCLAS1' 'HDUCLAS2' 'HDUCLAS3' 'HDUVERS' 'HDUVERS1' 'HDUVERS2'
'RMFVERSN' 'PHAFILE' 'EB_SCALE' 'EBOFFSET' 'SMOOTHED' 'CVSD0001'
'CVST0001' 'CDES0001' 'NEWKEY']
>>>

Create a new key and add it to the input Crate.

Bugs

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

Hardcopy (PDF): A4 | Letter
Last modified: December 2007



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.