Source
xxxxxxxxxx
rec = spxfit(imagename=[imagename1, imagename2], spxtype="plp", spxest=plpest, model="model.im")
#########################################################################
# test_task_spxfit.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.spxfit.html
#
#
##########################################################################
import shutil
import unittest
import numpy
import math
import os
import glob
import shutil
from casatools import ctsys, image, functional, table
from casatasks import spxfit
nanvalue = 4.53345345
datapath=ctsys.resolve('unittest/spxfit/')
myia = image()
_fn = functional()
class spxfit_test(unittest.TestCase):
def setUp(self):
self._tb = table( )
def tearDown(self):
myia.done()
files = glob.glob('cubeApF.*')
files.extend(glob.glob('test_sol.im_*'))
files.extend(glob.glob('concat*.im'))
files.extend(['spxfit.im', 'spxfit.log', 'model.im'])
for f in files:
if os.path.islink(f) or os.path.isfile(f):
os.remove(f)
elif os.path.isdir(f):
shutil.rmtree(f)
def checkArray(self, gotArray, expectedArray):
mytype = type(gotArray.ravel()[0])
self.assertTrue(gotArray.shape == expectedArray.shape)
if mytype == numpy.float64:
newgot = gotArray.copy()