Display the images resulting from tests


In [ ]:
%matplotlib inline

import os
import sys

sys.path.append(os.path.join('..', '..'))

from matplotlib import pylab
import numpy
from matplotlib import pyplot as plt

from data_models.parameters import arl_path
from wrappers.serial.image.operations import show_image, qa_image, import_image_from_fits

import logging

log = logging.getLogger()
log.setLevel(logging.INFO)
log.addHandler(logging.StreamHandler(sys.stdout))

Look for empty files


In [ ]:
pylab.rcParams['figure.figsize'] = (12.0, 12.0)
pylab.rcParams['image.cmap'] = 'rainbow'


fits_files = []
results_dir = arl_path('tests/test_results')
for file in os.listdir(results_dir):
    if file.endswith(".fits"):
        fits_files.append(file)
        
fits_files = numpy.sort(fits_files)

empty = list()
for file in fits_files:
    im = import_image_from_fits('test_results/%s' % file)
    if numpy.max(numpy.abs(im.data)) == 0.0:
        empty.append(file)

import pprint
p=pprint.PrettyPrinter()
print("The following files are empty:")  
p.pprint(empty)

Display all files


In [ ]:
for file in fits_files:
    print('******************************************************************')

    im = import_image_from_fits('tests/test_results/%s' % file)
    print(qa_image(im, context=file))
    try:
        show_image(im, title=file)
        plt.show()
    except IndexError:
        pass

In [ ]: