Skip to the navigation links
Last modified: December 2009

URL: http://cxc-newtest.cfa.harvard.edu/ciao4.2/add_piximg.sl.html
AHELP for CIAO 4.2

add_piximg

Context: sl.crates

Synopsis

Add an image to a crate.

Syntax

add_piximg(crate, cratedata);

Prior to CIAO 4.2 this routine was called add_image()

Description

  • crate - input crate
  • cratedata - CrateData object to be added

The add_piximg command adds an image to the crate. Any existing image in the crate will be replaced. The command returns a "1" if the image is successfully added.

The image is only added to the crate. The write_file ("ahelp write_file") command can be used to save the modified crate to a file.

Example

chips> cd = CrateData;
chips> img = [0:11];
chips> reshape (img, [1,2,6]);
chips> py_call (cd.load, img, 1);
1
chips> cr = IMAGECrate;
chips> add_piximg(cr, cd);
1
chips> write_file(cr, "newimg.fits");
1

Here we create a FITS image file called newimg.fits which contains a 6 by 2 pixel image containing the values 0 to 11, inclusive. Use dmlist to examine the output file:

unix% dmlist newimg.fits blocks
 
----------------------------------------------------------------------
Dataset: newimg.fits
----------------------------------------------------------------------
 
     Block Name                Type         Dimensions
----------------------------------------------------------------------
Block    1: PRIMARY              Image      Int4(6x2)

The reason for the "dummy" third dimension of 1 in the reshape call is due to the low-level nature of the load call. If this had not been added, then the output would have been a one-dimensional image with 6 pixels, containing the values 0 to 5 inclusive (i.e. the second row would have been ignored).

CHANGES IN CIAO 4.2

The command was renamed from add_image to add_piximg in CIAO 4.2 to avoid a conflict with a ChIPS command of the same name.

Bugs

See the bug pages on the CIAO website for an up-to-date listing of known bugs.

See Also

sl.crates
add_col, add_key, copy_piximgvals, delete_col, delete_key, delete_piximg, get_piximg, get_piximg_shape, get_piximgvals, read_arf, read_file, read_pha, read_rmf, set_piximgvals, write_arf, write_file, write_pha, write_rmf
sl.crates_contrib
make_table_crate, scale_image_crate, write_columns

Last modified: December 2009