add_image(crate, cratedata);
- crate - input crate
- cratedata - CrateData object to be added
The add_image 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.
slsh> cd = CrateData;
slsh> img = [0:11];
slsh> reshape (img, [1,2,6]);
slsh> py_call (cd.load, img, 1);
1
slsh> cr = IMAGECrate;
slsh> add_image(cr, cd);
1
slsh> 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).
See the
bug pages
on the CIAO website for an up-to-date listing of known bugs.
- sl.crates
-
add_col,
add_key,
delete_col,
delete_image,
delete_key,
get_image,
get_image_shape,
get_imagevals,
read_arf,
read_file,
read_pha,
read_rmf,
set_imagevals,
write_arf,
write_file,
write_pha,
write_rmf
- sl.crates_contrib
-
make_table_crate,
write_columns
|