Source
#########################################################################
# test_task_imcollapse.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.
#
#
# Based on the requirements listed in casadocs found here:
# https://casadocs.readthedocs.io/en/stable/api/tt/casatasks.analysis.imcollapse.html
#
##########################################################################
import math
import numpy
import os
import shutil
import unittest
from casatasks.private.casa_transition import *
from casatools import ctsys, image, table, quanta, regionmanager
from casatasks import imcollapse
ctsys_resolve = ctsys.resolve
datapath = ctsys.resolve('unittest/imcollapse/')
_ia = image()
_tb = table()
_qa = quanta()
_rg = regionmanager()
good_image = "collapse_in.fits"
masked_image = "im_w_mask.im"
def run_imcollapse(
imagename, function, axes, outfile, region, box, chans,
stokes, mask, overwrite, stretch=False
):
return imcollapse(
imagename=imagename, function=function, axes=axes,
outfile=outfile, region=region, box=box, chans=chans,
stokes=stokes, mask=mask, overwrite=overwrite,
stretch=stretch
)
class imcollapse_test(unittest.TestCase):
def setUp(self):
shutil.copy(ctsys_resolve(os.path.join(datapath,good_image)), good_image)
self.tabular_spectral_image = ctsys_resolve(os.path.join(datapath,"longZax"))
def tearDown(self):
os.remove(good_image)
self.assertTrue(len(_tb.showcache()) == 0)
def checkImage(self, gotImage, expectedName):
expected = image()