Synopsis
Scale the pixel values in an IMAGE crate (useful for the ChIPS add_image command)
Syntax
scale_image_crate(crate, scaling="arcsinh")
Description
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.4, 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. |
WARNING
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:
from crates_contrib.utils import *
Writing the data out to file
The write_file() command can be used to write the scaled data out to a new file.
Examples
Example 1
chips> cr = read_file("img.fits") chips> scale_image_crate(cr) chips> add_image(cr) chips> set_plot_title("arcsinh scaling") chips> set_image(["interpolation", "bilinear"])
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.
Note
The dmimgcalc routine is the preferred method to modify image files since using the Crates routines in CIAO 4.4 can lead to the loss of some metadata.
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.