Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064 import shutil
00065 import casac
00066 from tasks import *
00067 from taskinit import *
00068 from __main__ import *
00069 import unittest
00070
00071 def _near(got, exp, tol):
00072 qgot = qa.quantity(got)
00073 qexp = qa.quantity(exp)
00074 return qa.abs(qa.div(qa.sub(qgot, qexp), qexp))["value"] < tol
00075
00076 class ia_deconvolvefrombeam_test(unittest.TestCase):
00077
00078 def setUp(self):
00079 self.ia = iatool()
00080
00081 def tearDown(self):
00082 self.ia.done()
00083
00084 def test_multibeams(self):
00085 """ ia.deconvolvefrombeam(): Basic tests"""
00086 print "*** start "
00087 myia = self.ia
00088 source = ["4arcsec","3arcsec", "20deg"]
00089 beam = [
00090 ["2arcsec", "1arcsec", "20deg"],
00091 ["3arcsec", "2arcsec", "50deg"]
00092 ]
00093 emaj = [
00094 qa.quantity({'unit': 'arcsec', 'value': 3.4641016151377548}),
00095 qa.quantity({'unit': 'arcsec', 'value': 3.0203474964295665})
00096 ]
00097 emin = [
00098 qa.quantity({'unit': 'arcsec', 'value': 2.8284271247461894}),
00099 qa.quantity({'unit': 'arcsec', 'value': 1.6963198403637358})
00100 ]
00101 epa = [
00102 qa.quantity({'unit': 'deg', 'value': 20}),
00103 qa.quantity({'unit': 'deg', 'value': -1.9489431240069859})
00104 ]
00105 tol = 1e-10
00106 for i in [0, 1]:
00107 res = myia.deconvolvefrombeam(source, beam[i])
00108 fit = res["fit"]
00109 self.assertTrue(_near(fit["major"], emaj[i], tol))
00110 self.assertTrue(_near(fit["minor"], emin[i], tol))
00111 print "*** got " + str(fit["pa"])
00112 print "*** exp " + str(epa[i])
00113 self.assertTrue(_near(fit["pa"], epa[i], tol))
00114
00115 def suite():
00116 return [ia_deconvolvefrombeam_test]