Commits
Ville Suoranta authored b592815b239 Merge
64 64 | # |
65 65 | |
66 66 | ########################################################################### |
67 67 | |
68 68 | import sys |
69 69 | import os |
70 70 | import shutil |
71 71 | import numpy |
72 72 | import unittest |
73 73 | |
74 - | CASA6 = False |
75 - | try: |
76 - | import casatools |
77 - | myia = casatools.image() |
78 - | mycl = casatools.componentlist() |
79 - | csys = casatools.coordsys() |
80 - | myqa = casatools.quanta() |
81 - | sys.path.append(os.path.abspath(os.path.dirname(__file__))) |
82 - | CASA6 = True |
83 - | except ImportError: |
84 - | from __main__ import default |
85 - | from tasks import * |
86 - | from taskinit import * |
87 - | myia = iatool() |
88 - | mycl = cltool() |
89 - | csys = cstool() |
90 - | myqa = qatool() |
74 + | import casatools |
75 + | myia = casatools.image() |
76 + | mycl = casatools.componentlist() |
77 + | csys = casatools.coordsys() |
78 + | myqa = casatools.quanta() |
79 + | sys.path.append(os.path.abspath(os.path.dirname(__file__))) |
91 80 | |
92 - | |
93 - | if CASA6: |
94 - | datapath = casatools.ctsys.resolve('unittest/ia_fromcomplist/') |
95 - | estimates_file = os.path.join(datapath,'2gauss_estimates.txt') |
96 - | climage = os.path.join(datapath, 'simple_cl.im') |
97 - | else: |
98 - | datapath = os.environ.get('CASAPATH').split()[0] + '/casatestdata/unittest/ia_fromcomplist/' |
99 - | estimates_file = os.path.join(datapath, '2gauss_estimates.txt') |
100 - | climage = os.path.join(datapath, 'simple_cl.im') |
81 + | datapath = casatools.ctsys.resolve('unittest/ia_fromcomplist/') |
82 + | estimates_file = os.path.join(datapath,'2gauss_estimates.txt') |
83 + | climage = os.path.join(datapath, 'simple_cl.im') |
101 84 | |
102 85 | class ia_fromcomplist_test(unittest.TestCase): |
103 86 | |
104 87 | def setUp(self): |
105 88 | self._myia = myia |
106 89 | self._mycl = mycl |
107 90 | |
108 91 | def tearDown(self): |
109 92 | self._myia.done() |
110 93 | self._mycl.done() |
94 + | data = ["1ptsource.im","jj.cl","jk.im", |
95 + | "akd.im","simple_cl.im" ] |
96 + | for f in data: |
97 + | if os.path.exists(f) and os.path.isdir(f): |
98 + | shutil.rmtree(f) |
111 99 | |
112 100 | def test_ia_fromcomplist(self): |
113 101 | """Test ia.fromcomplist() functionality""" |
114 102 | mycl = self._mycl |
115 103 | myia = self._myia |
116 104 | flux = [1, 2, 3, 4] |
117 105 | direction = ['J2000', '00:00:00.00', '00.00.00.0'] |
118 106 | pt = "point" |
119 107 | mycl.addcomponent(flux=flux, dir=direction, shape=pt) |
120 108 | |