code: def fromfits(infilename, hdu = 0, verbose = True):
      
      
      pixelarray, hdr = pyfits.getdata(infilename, hdu, header=True)
      pixelarray = np.asarray(pixelarray).transpose()
      
      pixelarrayshape = pixelarray.shape
      if verbose :
          print "FITS import shape : (%i, %i)" % (pixelarrayshape[0], pixelarrayshape[1])
          print "FITS file BITPIX : %s" % (hdr["BITPIX"])
          print "Internal array type :", pixelarray.dtype.name
      
      return pixelarray, hdr
docs: Reads a FITS file and returns a 2D numpy array of the data.
      Use hdu to specify which HDU you want (default = primary = 0)