Source
errormsg="\nError: Expected value of -4.273192e-09, and mask=True" + "\n\t" + "Top left corner value was Not Found")
##########################################################################
# test_task_imval.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.imval.html
#
##########################################################################
import time
import os
import shutil
import glob
import numpy
import unittest
from casatools import ctsys, image
from casatasks import imval, casalog
_ia = image()
# Input files
datapath = ctsys.resolve('unittest/imval/')
image_file = 'n4826_bima.im'
good_rgn_file = 'n4826_bima_test.rgn'
###########################################################################
# NAME: info
#
# SHORT DESCRIPTION: Display information.
#
# DESCRIPTION: Write information to the local logger.
#
############################################################################
def info(message):
#note(message,origin='regionmgrtest')
print(message)
casalog.postLocally(message, priority="NORMAL", origin='regionmgrtest')
###########################################################################
# NAME: note
#
# SHORT DESCRIPTION: Display information.
#
# DESCRIPTION: Write information to the local logger with the given priority
#
############################################################################
def note(message, priority="NORMAL", origin="imval_test"):
print(message)
casalog.postLocally(message, priority, origin)
###########################################################################
# Input test general format
def tryInput(imagename, box='', chans='', stokes='', region='', errormsg=''):
retValue = {'success': True, 'msgs': "", 'error_msgs': ''}
note("Starting imval INPUT/OUTPUT tests.", 'NORMAL2')
info('Performing input/output tests on imagename, errors WILL occur.')
results = None
try:
results = imval(imagename=imagename, box=box, chans=chans, stokes=stokes, region=region)
except:
pass
else:
if (results != None \
and ((isinstance(results, bool) and results == True) \
or (isinstance(results, dict) and results != {}))):
retValue['success'] = False
retValue['error_msgs'] = retValue['error_msgs'] \
+ errormsg
return retValue
###########################################################################
# Single point test general format