|AHELP for CIAO 4.2||
CRATES - A high-level I/O interface for Python
CRATES is a software package developed by the Chandra X-Ray Center (CXC) to provide a high level I/O interface for use by Python. The CIAO applications ChIPS and Sherpa use CRATES to read input data for use in plotting and fitting and to write output data files. It supports reading and writing both FITS and ASCII files.
The classes and methods allow a user to easily access and manipulate general data files. There are specialized classes for specific data products (e.g. PHA Type I and II, RMF, and ARF). CRATES also provides convenient access to metadata information, such as WCS transforms and Data Model (DM) subspace information which may be associated with a table column or image.
It can be used from Python by saying
from pycrates import *
The Sherpa and ChIPS environments automatically load CRATES at startup. There are help files for each of the CRATES commands; a full list can be seen with the following command
"ahelp -c py.crates"
>>> from pycrates import * >>> cr = read_file("src.pi") >>> r = copy_colvals(cr,"COUNT_RATE") >>> rmean = sum(r) / r.size >>> print (rmean) 1.86375544832e-05
In this example, CRATES is used to load in the values of the COUNT_RATE column from the file "src.pi" into the crate "cr". The resulting array (r) is then used to calculate the mean value of the column.
See the bug pages on the CIAO website for an up-to-date listing of known bugs.
- add_col, add_key, add_piximg, col_exists, copy_colvals, copy_piximgvals, cratedata, delete_col, delete_key, delete_piximg, get_axis_transform, get_col, 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_arf, is_pha, is_rmf, is_virtual, key_exists, print_axis_names, print_col_names, print_key_names, read_arf, read_file, read_pha, read_rmf, set_colvals, set_keyval, set_piximgvals, write_arf, write_file, write_pha, write_rmf
- make_table_crate, scale_image_crate, write_columns