Read FITS or ASCII data into a crate.
- filename - name of the input file; FITS or ASCII format
The read_file command loads the specified file into the
appropriate crate, either a TABLECrate or an IMAGECrate.
The input file may be in FITS or ASCII format.
The read_pha, read_arf, and read_rmf routines can be
used when the type of the dataset is known.
Users familiar with the CIAO Data Model should note that:
-
Crates reads one extension of the input file, not the whole dataset.
The file that is written out will only contain the block which was read.
-
Crates does not retain the data subspace of the file.
-
Crates does not retain HISTORY or COMMENT blocks from the input file.
>>> cr = read_file("image.fits")
>>> print get_crate_type(cr)
Image
A file is read into the crate "cr", then the
get_crate_type command is used to confirm it is an IMAGECrate.
>>> cr = read_file("table.fits")
>>> print get_crate_type(cr)
Table
Read a file and create a TABLECrate.
>>> phacr = read_file("src.pi")
>>> print(get_crate_type(phacr))
Table
>>> resp = read_file("src.arf")
>>> print(get_crate_type(resp))
Table
>>> resp2 = read_file("src.rmf")
>>> print(get_crate_type(resp2))
Table
Using the read_file command to read a PHA, ARF, or RMF
file reads it in as a TABLECrate. The read_pha,
read_arf, and read_rmf routines should be used to
create a PHACrate, ARFCrate, or RMFCrate.
>>> f = "evt2.fits[energy=500:7000,sky=region(src.reg)][bin sky=::1]"
>>> cr = read_file(f)
>>> s = get_imagevals(cr).sum()
>>> print "Pixel sum=%d" % s
Pixel sum=2361
File names can include CIAO Data Model filtering and binning
commands (e.g. see "ahelp dm"). In this case an energy and spatial
filter are applied to an event file before being binned into an image.
The pixel values are read in and then summed up.
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,
delete_col,
delete_image,
delete_key,
read_arf,
read_pha,
read_rmf,
write_arf,
write_file,
write_pha,
write_rmf
|