Chandra X-Ray Observatory (CXC)
Skip to the navigation links
Last modified: December 2012

URL: http://cxc.harvard.edu/ciao/cratekey.html
AHELP for CIAO 4.5

cratekey

Context: crates

Synopsis

CrateKey object type in the CRATES library.

Description

The CRATES Library uses CrateKey objects to store keyword values (name, value, unit, and description).

The get_key() and get_keyval() routines can be used to get a keyword from the header. They can also be created using the CrateKey() contstructor - for example

chips> key = CrateKey()

- and then filled in using the following fields:

Field Description
value The value of the keyword (the Python type of the value is used to determine the storage type).
name The name of the keyword.
unit The units of the value, if set.
desc A description of the keyword, if set.

As an example, we create two keywords below, EXPOSURE and NORMFLAG:

chips> key1 = CrateKey()
chips> key2 = CrateKey()
chips> key1.name = "EXPOSURE"
chips> key1.value = 12234.86
chips> key1.unit = "s"
chips> key1.desc = "Exposure time"
chips> key2.name = "NORMFLAG"
chips> key2.value = False

The add_key() routine would be used to add these to a Crate; new in CIAO 4.5 is the set_key() routine which allows you to add keywords to a Crate without needing to create a CrateKey object.

Viewing Crate Keys

They can also be viewed using print:

chips> print(key1)
   Name:   EXPOSURE
   Value:  12234.86
   Unit:   s
   Desc:   Exposure time

chips> print(key2)
   Name:   NORMFLAG
   Value:  False
   Unit:   
   Desc:   

Changes in CIAO 4.5

The set_key() routine has been added to simplify creating a key in a Crate:

k = CrateKey()
k.name = 'X'
k.value = x
add_key(cr, k)
set_key(cr, 'X', x)

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_keyval, set_key
crates
add_key, delete_key, get_key, get_key_names, get_keyval, key_exists, set_keyval

Last modified: December 2012
CXC logo

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-2012. All rights reserved.