Last modified: December 2020

URL: https://cxc.cfa.harvard.edu/ciao/ahelp/read_dataset.html
AHELP for CIAO 4.13

read_dataset

Context: crates

Synopsis

Read all contents of a file.

Syntax

read_dataset(filename)

Description

Argument Description
filename Name of the file; it can include CIAO Data Model syntax such as filters and binning values

The read_dataset command loads the specified file and returns a cratedataset object, which can be used to access the various blocks in the file.


Examples

Example 1

In the following example three images have been combined into a single file with the dmappend command:

% dmappend broad_flux.img,broad_thresh.img,broad_thresh.expmap broad.img

The full dataset can be loaded intp Python with read_dataset:

>>> ds = read_dataset("broad.img")

The contents can be accessed, such as accessing the data from the second block:

>>> print(ds)
   Crate Dataset:
     File Name:         broad.img
     Read-Write Mode:   rw
     Number of Crates:  3
       1)     Crate Type:        <IMAGECrate>
   Crate Name:        PFLUX_IMAGE

       2)     Crate Type:        <IMAGECrate>
   Crate Name:        EVENTS_IMAGE

       3)     Crate Type:        <IMAGECrate>
   Crate Name:        EXPMAP

>>> cr = ds.get_crate('EVENTS_IMAGE')
>>> print(cr)
   Crate Type:        <IMAGECrate>
   Crate Name:        EVENTS_IMAGE
   Image Axes:        ['sky', 'EQPOS']

 

Example 2

>>> ds = read_dataset('clus.rmf')
>>> rmf = read_rmf('clus.rmf')

The read_dataset routine can read in the separate blocks in a RMF file. The read_rmf routine should be preferred for this task.

>>> print(ds)
   Crate Dataset:
     File Name:         clus.rmf
     Read-Write Mode:   rw
     Number of Crates:  3
       1)     Crate Type:        <IMAGECrate>
   Crate Name:        PRIMARY

       2)     Crate Type:        <TABLECrate>
   Crate Name:        MATRIX
   Ncols:             6
   Nrows:             1070

       3)     Crate Type:        <TABLECrate>
   Crate Name:        EBOUNDS
   Ncols:             3
   Nrows:             1024

and

>>> print(rmf)
   RMF Crate Dataset:
     File Name:         clus.rmf
     Read-Write Mode:   r
     Number of Crates:  3
       1)     Crate Type:        <IMAGECrate>
   Crate Name:        PRIMARY

       2)     Crate Type:        <TABLECrate>
   Crate Name:        MATRIX
   Ncols:             6
   Nrows:             1070

       3)     Crate Type:        <TABLECrate>
   Crate Name:        EBOUNDS
   Ncols:             3
   Nrows:             1024

 

Changes in CIAO 4.13

The read_dataset routine is now exported from the pycrates module. In earlier versions of CIAO it was only availabe from the pycrates.hlui module.


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
make_image_crate, make_table_crate, scale_image_crate, smooth_image_crate, write_arrays, write_columns
crates
add_col, add_crate, add_key, add_piximg, cratedataset, delete_col, delete_key, delete_piximg, get_crate, read_file, read_pha, read_rmf, write_dataset, write_file, write_pha, write_rmf