|AHELP for CIAO 4.9||
Copy the image values from a crate.
|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.
>>> 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.
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:
- you do want to be able to change values in the crate for either future processing or to write out to disk
- you have read in a large file and do not want to waste memory by creating another copy of the array
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.
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.