mardi 4 août 2015

PyFITS: hdulist.writeto()

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.

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:

    'AttributeError: 'numpy.ndarray' object has no attribute 'lower''

Here is a sample of my 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()

I appreciate any help with this. Thanks in advance.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire