Use pyfits.getdata to open images rather than pyfits.open