Last modified: June 2019

URL: https://cxc.cfa.harvard.edu/ciao/ahelp/scale_image_crate.html
Jump to: Description · Examples · Bugs · See Also


AHELP for CIAO 4.15

scale_image_crate

Context: contrib

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.

See Also

contrib
make_image_crate, make_table_crate, smooth_image_crate, write_arrays, write_columns
crates
add_col, add_key, add_piximg, delete_col, delete_key, delete_piximg, read_file, read_pha, read_rmf, write_file, write_pha, write_rmf