Last modified: December 2013

URL: https://cxc.cfa.harvard.edu/ciao/ahelp/copy_piximgvals.html
AHELP for CIAO 4.15

copy_piximgvals

Context: crates

Synopsis

Copy the image values from a crate.

Syntax

copy_piximgvals(crate)

Description

Argument Description
crate The image crate.

The copy_piximgvals command retrieves an array of the values of the specified image within the crate. The data values are copied into an array and that array is returned.

The get_piximg command returns a CrateData object for the image, which is useful if you are interested in the metadata associated with it.


Example

>>> cr = read_file("image.fits")
>>> vals = copy_piximgvals(cr)
>>> print(vals.shape)
(201, 201)
>>> print(vals.sum())
6696

The copy_piximgvals() call returns a numpy array which contains a copy of the pixel values.


Should I use copy_piximgvals or get_piximgvals?

The copy_piximgvals routine is similar to get_piximgvals, so when should you use it? The return value from get_piximgvals reflects the contents of the Crate, so that changes to the return value also change the crate, whereas copy_piximgvals returns a copy of this data.

It is generally going to be safer to use copy_piximgvals rather than get_piximgvals unless:

If the image being read in is a virtual one then the data is always going to be copied, so in this particular case there is no difference between copy_piximgvals and get_piximgvals.


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

crates
add_piximg, delete_piximg, get_axis_transform, get_col, get_col_names, get_colvals, get_crate_item_type, get_crate_type, get_key, get_key_names, get_keyval, get_number_cols, get_number_rows, get_piximg, get_piximg_shape, get_piximgvals, get_transform, get_transform_matrix, set_piximgvals