title: PyFITS: hdulist.writeto()
body: <p>I'm extracting extensions from a multi-extension FITS file, manipulate the data, and save the data (with the extension's header information) to a new FITS file. </p>
  
  <p>To my knowledge pyfits.writeto() does the task.  However, when I give it a data parameter in the form of an array, it gives me the error:</p>
  
  <pre><code>    'AttributeError: 'numpy.ndarray' object has no attribute 'lower''
  </code></pre>
  
  <p>Here is a sample of my code:</p>
  
  <pre><code>    'file = 'hst_11166_54_wfc3_ir_f110w_drz.fits'
       hdulist = pyfits.open(dir + file)'
       sci = hdulist[1].data # science image data
       exp = hdulist[5].data # exposure time data
       sci = sci*exp # converts electrons/second to electrons
       file = 'test_counts.fits'
  
       hdulist.writeto(file,sci,clobber=True)
  
       hdulist.close()
  </code></pre>
  
  <p>I appreciate any help with this. Thanks in advance.</p>