logging.info("For pixel value check the obtained value was {}. The expected value was {} with a tolerance of {}. test success = {}.".format(selected_slice, refval, atol, isequal))
logging.debug("Importing CASAtools")
logging.debug("Import casa6 errors. Trying CASA5...")
from taskinit import tbtool
def check_plotfile(self, plotfileName, min_size, max_size=None):
Check if plotfile generated is cprrect size
plotfileName --> Name of plotted Image
min_size -- > Min Size of image
max_size --> Max Size of image
Return : True if image size > min_size ( and < max_size if max_size is provided )
if os.path.isfile(plotfileName):
self.plotSize = os.path.getsize(plotfileName)
logging.info('{} file size is: {}'.format(plotfileName, self.plotSize))
if self.plotSize > min_size:
if not self.plotSize < max_size:
logging.critical("Plot was not created")
def check_pixels(self, imagename='', loc=None, refval=None, rtol=1e-05, atol=1e-08):
Check pixels in an image to a specified reference value
@param imagename: input image file
@param loc: The index of the image to compare to the refval
@param refval: The reference value to compare the selected pixel(s) to
@param rtol: The relative tolerance used in the numpy.isclose function
@param atol: The absolute tolerance used in the numpy.isclose function
@return: True if the shape and value of the refval and selected pixel match.
if not isinstance(loc, str):
raise TypeError('Please give target location in string list format "20,30,2:4"')
if os.path.exists(imagename):
if not isinstance(refval, None):
to_slice = loc.split(',')