          Add an image to a crate.

add_piximg(crate, cratedata)

Argument
Description
crate
The image crate.
cratedata
The CrateData object containing the image data to add.

The add_piximg command adds an image to the crate. Any existing image in the crate will be replaced.

Only the crate is changed; the input file is unaffected. The write_file command can be used to save the modified crate to a file.

>>> img = np.arange(12).reshape(3, 4)
>>> cd = CrateData()
>>> cd.values = img
>>> cr = IMAGECrate()
>>> add_piximg(cr, cd)
>>> write_file(cr, "newimg.fits")

Here we create a FITS image file called newimg.fits which contains a 4 (x) by 3 (y) 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(4x3)

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

December 2019