Skip to the navigation links
Last modified: August 2010

AHELP for CIAO 4.2


Context: sl.crates_contrib


Scale the pixel values in an IMAGE crate (useful for add_image)


scale_image_crate(crate; scaling="arcsinh");


This routines applies a scaling function to the pixel values stored in an image crate. It is useful if you want to display the Crate using add_crate or make_figure and want to change the scaling of the data (since, in CIAO 4.2, images are only displayed using a linear scaling).

Scaling routines

Scaling Description
arcsinh or asinh This scales the data using the arcsinh routine to enhance low-level features whilst preserving structure in bright regions.
log Use the natural logarithm.
log10 Use the base-10 logarithm.
sqrt Takes the square root of the pixel values.
square Takes the square of the pixel values.
none Leaves the pixel values unchanged.


This routine modifies the data in the crate; it does not return a modified copy. There is no way to undo the changes made by this routine other than to use read_file() to re-read in the original data.

Loading the routine

The routine can be loaded into a ChIPS or Sherpa session by saying:

require ("crates_utils");

Writing the data out to file

The write_file() command can be used to write the scaled data out to a new file.

Example 1

chips> cr = read_file("img.fits");
chips> scale_image_crate(cr);
chips> add_image(cr);
chips> set_plot_title("arcsinh scaling");

Here we use the default scaling method (arcsinh) to scale the data before displaying it using the ChIPS add_image() command.

Example 2

chips> r = read_file("evt2.fits[energy=500:1500][bin sky=::4]");
chips> g = read_file("evt2.fits[energy=1500:3500][bin sky=::4]");
chips> b = read_file("evt2.fits[energy=3500:700][bin sky=::4]");
chips> scale_image_crate(r);
chips> scale_image_crate(g);
chips> scale_image_crate(b);
chips> add_image(r, g, b);

Here we use the default scaling method (arcsinh) to scale the three channels used to create a "true color" image.

Example 3

chips> cr = read_file("img.fits");
chips> scale_image_crate(cr, "log");
chips> write_file(cr, "img.scaled.fits");

A new file is created - called img.scaled.fits - which contains the natural logarithm of the pixel values. The dmimgcalc routine is the preferred method to modify image files.


The scale_image_crate() routines now accepts "asinh" as a synonym for "arcsinh" and "none", which leaves the image intact.


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

See Also

add_col, add_key, add_piximg, delete_col, delete_key, delete_piximg, read_arf, read_file, read_pha, read_rmf, write_arf, write_file, write_pha, write_rmf
make_table_crate, write_columns

Last modified: August 2010