NRAO Home > CASA > CASA Toolkit Reference Manual
image.transpose - Function

1.1.1 Transpose the image.


This method transposes the axes in the input image to the specified order. The associated pixel and mask values and coordinate system are transposed.

If the outfile parameter is empty, only a temporary image is created; no output image is written to disk.

The order parameter describes the mapping of the input axes to the output axes. It can be one of three types: a non-negative integer, a string, or a list of strings. If a string or non-negative integer, it should contain zero-based digits describing the new order of the input axes. It must contain the same number of (unique) digits as the number of input axes. For example, specifying reorder=”1032” or reorder=1032 for a four axes image maps input axes 1, 0, 3, 2 to output axes 0, 1, 2, 3. In the case of order being a nonnegative integer and the zeroth axis in the input being mapped to zeroth axis in the output, the zeroth digit is implicitly understood to be 0 so that to transpose an image where one would use a string order=”0321”, one could equivalently specify an int order=321. IMPORTANT: When specifying a non-negative integer and mapping the zeroth axis of the input to the zeroth axis of the output, do *not* explicitly specify the leading 0; eg, specify order=321 rather than order=0321. Python interprets an integer with a leading 0 as an octal number.

Because of ambiguity for axes numbers greater than nine, using string or integer order specifications cannot handle images containing more than 10 axes. The order parameter can also be specified as a list of strings which uniquely minimally match, ignoring case, the image axis names (ia.coordsys().names()). So to reorder an image with right ascension, declination, and frequency axes, one could specify order=[”d”, ”f”, ”r”] or equivalently [”decl”, ”frequ”, ”right a”]. Note that specifying ”ra” for the right ascension axis will result in an error because ”ra” does not match the first two characters of right ascension. Axes can be simultaneously inverted in cases where order is a string or an array of strings by specifying negative signs in front of the axis/axes to be inverted. So, in a 4-D image, order=”-10-3-2” maps input axes 1, 0, 3, 2 to output axes 0, 1, 2, 3 and reverses the direction and values of input axes 1, 3, and 2.




Output image file name. Default is unset.





Zero-based order of axes in output image (eg ”120” => input- > output 0->2, 1->0, 2->1))







# swap stokes (axis 2) and spectral (axis 3) axes in a 4 dimensional image"myimage.fits")  
reordim = ia.transpose(outfile="", order="0132")  


More information about CASA may be found at the CASA web page

Copyright 2016 Associated Universities Inc., Washington, D.C.

This code is available under the terms of the GNU General Public Lincense

Home | Contact Us | Directories | Site Map | Help | Privacy Policy | Search