Source
xxxxxxxxxx
+"\nError: Bad region file, 'garbage.rgn', was not reported as missing."
########################################################################3
# imsmooth_test.py
#
# Copyright (C) 2008, 2009
# Associated Universities, Inc. Washington DC, USA.
#
# This scripts free software; you can redistribute it and/or modify it
# under the terms of the GNU Library General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# This library is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
# License for more details.
#
# You should have received a copy of the GNU Library General Public License
# along with this library; if not, write to the Free Software Foundation,
# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
#
# Correspondence concerning AIPS++ should be adressed as follows:
# Internet email: aips2-request@nrao.edu.
# Postal address: AIPS++ Project Office
# National Radio Astronomy Observatory
# 520 Edgemont Road
# Charlottesville, VA 22903-2475 USA
#
from __future__ import absolute_import
from __future__ import print_function
import random
import os
import numpy
import shutil
import unittest
import math
from casatasks.private.casa_transition import is_CASA6
if is_CASA6:
from casatools import ctsys, image, regionmanager, componentlist, table, quanta
from casatasks import imsmooth, casalog, imsubimage
_ia = image()
_rg = regionmanager()
_tb = table()
_qa = quanta()
ctsys_resolve = ctsys.resolve
else:
import casac
from tasks import *
from taskinit import *
from casa_stack_manip import stack_frame_find
casa_stack_rethrow = stack_frame_find().get('__rethrow_casa_exceptions', False)
componentlist = cltool
image = iatool
dataRoot = os.path.join(os.environ.get('CASAPATH').split()[0],'casatestdata/')
def ctsys_resolve(apath):
return os.path.join(dataRoot,apath)
_ia = iatool( )
_rg = rgtool()
# not local tools
_tb = tb
_qa = qa
datapath = ctsys_resolve('unittest/imsmooth/')
targetres_im = "imsmooth_targetres.fits"
tiny = "tiny.im"
image_names=['g192_a2.image', 'g192_a2.image-2.rgn']
def _near(got, expected, tol):
return _qa.le(
_qa.div(
_qa.abs(_qa.sub(got, expected)),
expected
),
tol
)
def run_imsmooth(
imagename, major, minor, pa, targetres,
outfile, kernel="gauss", overwrite=False, beam={}
):
return imsmooth(
imagename=imagename, kernel=kernel,
major=major, minor=minor, pa=pa,
targetres=targetres, outfile=outfile,
overwrite=overwrite, beam=beam