# Takes an input cube and outputs a blank version, leaving the header intact import math import numpy import pyfits import os infile = '7448Group.fits' outfile = str(infile.split('.fits')[0])+str('_blank')+str('.fits') os.system('cls') # Changes to the directory where the script is located abspath = os.path.abspath(__file__) dname = os.path.dirname(abspath) os.chdir(dname) FitsFile = pyfits.open(infile) image = FitsFile[0].data header =FitsFile[0].header sizez = image.shape[0] sizey = image.shape[1] sizex = image.shape[2] print sizez,sizey,sizex # Create an array to hold the channel numbers #channel = numpy.array([i for i in range(0,sizez)]) for xp in range(0,sizex): for yp in range(0,sizey): for zp in range(0,sizez): image[zp,yp,xp] = 0.0 FitsFile = pyfits.writeto(outfile, image, header=header)