Synopsis
Scale the pixel values in an IMAGE crate.
Syntax
scale_image_crate(crate, scaling="arcsinh")
Description
This routines applies a scaling function to the pixel values stored in an image crate.
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 Python 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
>>> cr = read_file("img.fits") >>> scale_image_crate(cr)
Here we use the default scaling method (arcsinh) to scale the data.
Example 2
>>> r = read_file("evt2.fits[energy=500:1500][bin sky=::4]") >>> g = read_file("evt2.fits[energy=1500:3500][bin sky=::4]") >>> b = read_file("evt2.fits[energy=3500:7000][bin sky=::4]") >>> scale_image_crate(r) >>> scale_image_crate(g) >>> scale_image_crate(b)
Here we use the default scaling method (arcsinh) to scale the "soft", "medium", and "hard" bands (these energy ranges are aribtrarily chosen for this example).
Example 3
>>> cr = read_file("img.fits") >>> scale_image_crate(cr, "log") >>> write_file(cr, "img.scaled.fits")
A new file is created - called img.scaled.fits - which contains the natural logarithm of the pixel values.
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.