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
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
>>> from pycrates import *
>>> crate = read_file("table.fits")
>>> r = get_colvals(crate,"COUNT_RATE")
>>> rmean = sum(r) / r.size
In this example Crates is used to load in the values of the
COUNT_RATE column from the file "table.fits". 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.
- py.crates
-
add_col,
add_image,
add_key,
col_exists,
cratedata,
delete_col,
delete_image,
delete_key,
get_axis_transform,
get_col,
get_col_names,
get_colvals,
get_crate_item_type,
get_crate_type,
get_image,
get_image_shape,
get_imagevals,
get_key,
get_key_names,
get_keyval,
get_number_cols,
get_number_rows,
get_transform,
get_transform_matrix,
is_arf,
is_pha,
is_rmf,
key_exists,
print_axis_names,
print_col_names,
print_key_names,
read_arf,
read_file,
read_pha,
read_rmf,
set_colvals,
set_imagevals,
set_keyval,
write_arf,
write_file,
write_pha,
write_rmf
|