casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables
task_imtrans.py
Go to the documentation of this file.
00001 
00002 ##########################################################################
00003 # task_imtrans.py
00004 #
00005 # Copyright (C) 2008, 2009
00006 # Associated Universities, Inc. Washington DC, USA.
00007 #
00008 # This script is free software; you can redistribute it and/or modify it
00009 # under the terms of the GNU Library General Public License as published by
00010 # the Free Software Foundation; either version 2 of the License, or (at your
00011 # option) any later version.
00012 #
00013 # This library is distributed in the hope that it will be useful, but WITHOUT
00014 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00015 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00016 # License for more details.
00017 #
00018 # You should have received a copy of the GNU Library General Public License
00019 # along with this library; if not, write to the Free Software Foundation,
00020 # Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00021 #
00022 # Correspondence concerning AIPS++ should be adressed as follows:
00023 #        Internet email: aips2-request@nrao.edu.
00024 #        Postal address: AIPS++ Project Office
00025 #                        National Radio Astronomy Observatory
00026 #                        520 Edgemont Road
00027 #                        Charlottesville, VA 22903-2475 USA
00028 #
00029 # <author>
00030 # Dave Mehringer
00031 # </author>
00032 #
00033 # <summary>
00034 # Task to transpose an image
00035 # </summary>
00036 #
00037 # <reviewed reviwer="" date="" tests="" demos="">
00038 # </reviewed>
00039 #
00040 # <prerequisite>
00041 # <ul>
00042 #
00043 # </ul>
00044 # </prerequisite>
00045 #
00046 # <etymology>
00047 # imtrans => im(age) trans(pose)
00048 # </etymology>
00049 #
00050 # <synopsis>
00051 # imtrans transposes an image. It is built on top of ia.reorder()
00052 # </synopsis> 
00053 #
00054 # <example>
00055 # imtrans(imagename="myim.im", outfile="transposed.im", order="102")
00056 #
00057 # </example>
00058 #
00059 # <motivation>
00060 # To make users happy, cf https://bugs.aoc.nrao.edu/browse/CAS-607
00061 # </motivation>
00062 #
00063 
00064 ###########################################################################
00065 from taskinit import *
00066 
00067 def imtrans(imagename=None, outfile=None, order=None, wantreturn=None):
00068     casalog.origin('imtrans')
00069     myia = iatool()
00070     newim = None
00071     try:
00072         if (not myia.open(imagename)):
00073             raise Exception, "Cannot create image analysis tool using " + imagename
00074         newim = myia.transpose(outfile=outfile, order=order)
00075         myia.done()
00076         if wantreturn:
00077             return newim
00078         else:
00079             newim.done()
00080     except Exception, instance:
00081         casalog.post( str( '*** Error ***') + str(instance), 'SEVERE')
00082         if myia:
00083             myia.done()
00084         if newim:
00085             newim.done()
00086         raise instance