# -*- coding: iso-8859-1 -*- #Brian R. Kent, NRAO #Example FITS explort to image slices #Useful with FITS import into Blender ''' This example requires numpy, matplotlib, and PYFTIS ''' import numpy import matplotlib.pyplot as plt import numpy as np import pylab as py import pyfits from pylab import * #Define the image img=pyfits.getdata('m81dwarfA.fits') #Start a new figure fig=figure(facecolor='w', edgecolor='w', frameon=False, figsize=(3,3)) #Turn off axes ax1 = plt.axes(frameon=False) ax1.get_xaxis().tick_bottom() ax1.axes.get_yaxis().set_visible(False) # Hide y axis ax1.axes.get_xaxis().set_visible(False) # Hide x axis #Interactive on ion() image=py.imshow(-img[0,22,446:576,456:586], aspect='equal', animated='True',cmap=cm.Greys, origin='lower') #image.set_clim(0.0,0.004) #Save each channel as an image #Here we have made a subdirectory 'pngs' for i in range(0,46): print i image.set_data(-img[0,i,446:576,456:586]) draw() savefig('./pngs/'+str(i)+'.png')