<%inherit file="base.html"/> <% import matplotlib.pyplot as plt import numpy as np import os.path import string _valid_chars = "_.%s%s" % (string.ascii_letters, string.digits) def _char_replacer(s): '''A small utility function that echoes the argument or returns '_' if the argument is in a list of forbidden characters. ''' if s not in _valid_chars: return '_' return s def sanitize(text): filename = ''.join(_char_replacer(c) for c in text) return filename plt.figure() iwn = context['iwn'] stagename = context['stagename'] clean_image = context['data'][stagename]['cleanimage'][:,:,iwn] residual_image = context['data'][stagename]['residualimage'][:,:,iwn] spatial_axis = context['data'][stagename]['spatial axis'] wn = context['wn'] plt.subplot(121) plt.imshow(clean_image, interpolation='nearest', origin='lower', aspect='equal', extent=[spatial_axis[0], spatial_axis[-1], spatial_axis[0], spatial_axis[-1]]) plt.colorbar(orientation='vertical') plt.axis('image') plt.title('Clean image %6.4gcm-1' % wn) plt.subplot(122) plt.imshow(residual_image, interpolation='nearest', origin='lower', aspect='equal', extent=[spatial_axis[0], spatial_axis[-1], spatial_axis[0], spatial_axis[-1]]) plt.colorbar(orientation='vertical') plt.axis('image') plt.title('Residual image %6.4gcm-1' % wn) filename = '%splane%s.png' % (stagename, wn) filename = sanitize(filename) filename = os.path.join(context['dirname'], filename) plt.savefig(filename) plt.close() %> The clean result should appear here<br>