casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables
test_getchunk.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 imfit Task
00034 # </summary>
00035 #
00036 # <reviewed reviwer="" date="" tests="" demos="">
00037 # </reviewed
00038 #
00039 # <prerequisite>
00040 # <ul>
00041 #   <li> <linkto class="imfit.py:description">imfit</linkto> 
00042 # </ul>
00043 # </prerequisite>
00044 #
00045 # <etymology>
00046 # imfit_test stands for imfit test
00047 # </etymology>
00048 #
00049 # <synopsis>
00050 # imfit_test.py is a Python script that tests the correctness
00051 # of the ia.fitcomponents tool method and the imfit task in CASA.
00052 # </synopsis> 
00053 #
00054 # <example>
00055 # `echo $CASAPATH/bin/casapy | sed -e 's$ $/$'` --nologger --log2term -c `echo $CASAPATH | awk '{print $1}'`/code/xmlcasa/scripts/regressions/admin/runUnitTest.py test_imfit[test1,test2,...]
00056 # </example>
00057 #
00058 # <motivation>
00059 # To provide a test standard to the imfit task to ensure
00060 # coding changes do not break the associated bits 
00061 # </motivation>
00062 #
00063 
00064 ###########################################################################
00065 import os
00066 import casac
00067 from tasks import *
00068 from taskinit import *
00069 import sha
00070 from __main__ import *
00071 import unittest
00072 
00073 image = "gauss_no_pol.fits"
00074 myia = iatool()
00075 
00076 class getchunk_test(unittest.TestCase):
00077     
00078     def setUp(self):
00079         datapath=os.environ.get('CASAPATH').split()[0]+'/data/regression/unittest/imfit/'
00080         os.system('cp -r ' +datapath + image + ' ' + image)
00081 
00082     def tearDown(self):
00083         os.system('rm -rf ' + image)
00084         myia.done()
00085 
00086     def test_CAS_2355(self):
00087         '''getchunk: test 32/64 bit resolution'''
00088         myia.open(image)
00089         bb = myia.boundingbox( myia.setboxregion() )
00090         trc = bb['trc']
00091         blc = bb['blc']
00092         chunk = myia.getchunk(blc=blc, trc=trc)
00093         # if the last statement didn't throw an exception, then that's proof enough
00094         # the fix worked, but just for kicks...
00095         self.assertTrue(chunk[0][0][0] > 1973 and chunk[0][0][0] < 1974) 
00096 
00097 def suite():
00098     return [getchunk_test]