casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables
test_ia_isconform.py
Go to the documentation of this file.
00001 ##########################################################################
00002 # imfit_test.py
00003 #
00004 # Copyright (C) 2008, 2009
00005 # Associated Universities, Inc. Washington DC, USA.
00006 #
00007 # This script is free software; you can redistribute it and/or modify it
00008 # under the terms of the GNU Library General Public License as published by
00009 # the Free Software Foundation; either version 2 of the License, or (at your
00010 # option) any later version.
00011 #
00012 # This library is distributed in the hope that it will be useful, but WITHOUT
00013 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00015 # License for more details.
00016 #
00017 # You should have received a copy of the GNU Library General Public License
00018 # along with this library; if not, write to the Free Software Foundation,
00019 # Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00020 #
00021 # Correspondence concerning AIPS++ should be adressed as follows:
00022 #        Internet email: aips2-request@nrao.edu.
00023 #        Postal address: AIPS++ Project Office
00024 #                        National Radio Astronomy Observatory
00025 #                        520 Edgemont Road
00026 #                        Charlottesville, VA 22903-2475 USA
00027 #
00028 # <author>
00029 # Dave Mehringer
00030 # </author>
00031 #
00032 # <summary>
00033 # Test suite for the CASA task ia.isconform
00034 # </summary>
00035 #
00036 # <reviewed reviwer="" date="" tests="" demos="">
00037 # </reviewed
00038 #
00039 # <prerequisite>
00040 # <ul>
00041 #   <li> <linkto class="task_ia_isconform.py:description">ia.isconform</linkto> 
00042 # </ul>
00043 # </prerequisite>
00044 #
00045 # <etymology>
00046 # Test for the ia.isconform method
00047 # </etymology>
00048 #
00049 # <synopsis>
00050 # Test the ia.isconform method.
00051 # </synopsis> 
00052 #
00053 # <example>
00054 #
00055 # This test runs as part of the CASA python unit test suite and can be run from
00056 # the command line via eg
00057 # 
00058 # `echo $CASAPATH/bin/casapy | sed -e 's$ $/$'` --nologger --log2term -c `echo $CASAPATH | awk '{print $1}'`/code/xmlcasa/scripts/regressions/admin/runUnitTest.py test_ia_isconform[test1,test2,...]
00059 #
00060 # </example>
00061 #
00062 # <motivation>
00063 # To provide a test standard for the ia.isconform method to ensure
00064 # coding changes do not break the associated bits 
00065 # </motivation>
00066 #
00067 
00068 ###########################################################################
00069 import shutil
00070 import casac
00071 from tasks import *
00072 from taskinit import *
00073 from __main__ import *
00074 import unittest
00075 
00076 fits = "jj.fits"
00077 
00078 
00079 class ia_isconform_test(unittest.TestCase):
00080 
00081     def setUp(self):
00082         datapath=os.environ.get('CASAPATH').split()[0]+'/data/regression/unittest/ia_isconform/'
00083         shutil.copy(datapath + fits, fits)
00084         self._myia = iatool()
00085         self._myia.maketestimage()
00086 
00087     
00088     def tearDown(self):
00089         self._myia.done()
00090         del self._myia
00091 
00092     def test_unattached(self):
00093         self._myia.done()
00094         self.assertRaises(Exception, self._myia.isconform("x"))
00095         
00096     def test_trueness(self):
00097         self.assertTrue(self._myia.isconform(fits))
00098         
00099     def test_diffaxes(self):
00100         _newia = self._myia.adddegaxes(spectral=True)
00101         self.assertFalse(_newia.isconform(fits))
00102       
00103     def test_diffaxes(self):
00104         _cs = self._myia.coordsys()
00105         names = _cs.names()
00106         _cs.setnames([names[1], names[0]])
00107         self._myia.setcoordsys(_cs.torecord())
00108         self.assertFalse(self._myia.isconform(fits))
00109       
00110     def test_diffincrements(self):
00111         _cs = self._myia.coordsys()
00112         _cs.setincrement([0.1,0.1])
00113         self._myia.setcoordsys(_cs.torecord())
00114         self.assertFalse(self._myia.isconform(fits))
00115         
00116 def suite():
00117     return [ia_isconform_test]