Source
########################################################################
# test_task_specsmooth.py
#
# Copyright (C) 2018
# Associated Universities, Inc. Washington DC, USA
#
# This script is 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.
#
# [Add the link to the JIRA ticket here once it exists]
#
# Based on the requirements listed in plone found here:
# https://casadocs.readthedocs.io/en/stable/api/tt/casatasks.analysis.specsmooth.html
#
#
##########################################################################
import os
import shutil
import unittest
import numpy
from math import sqrt
from casatools import ctsys, image, table, quanta, regionmanager
from casatasks import specsmooth
_rg = regionmanager( )
_tb = table( )
class specsmooth_test(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
self.assertTrue(len(_tb.showcache()) == 0)
def test_general(self):
"""Test general behavior"""
myia = image()
length = 6
imagename = "test_gen.im"
myia.fromshape(imagename, [1, 1, length])
bb = myia.getchunk()
for i in range(length):
bb[0, 0, i] = i*i + 1
myia.putchunk(bb)
for i in range(length):
reg = _rg.box([0, 0, 0], [0, 0, i])
outfile = "out" + str(i) + ".im"
if (i < 2):
self.assertRaises(
Exception, specsmooth, imagename=imagename, outfile=outfile,
region=reg, function="h", axis=2
)
else:
for drop in (False, True):