title: Convert float NumPy array to big endian
body: <p>I wrote a script and in the end I need to convert this array which is in type float64 to big endian int (>2i):</p>
  
  <pre><code>[[ 0.92702157  1.03092008  0.9072934  ...,  0.71617331  1.02524888
      1.07284994]
  [ 0.99573712  0.96416766  0.9230931  ...,  0.66935196  0.64930711
  0.5357821 ]
  [ 0.98846306  1.03608056  0.79976885 ...,  0.69383804  0.62434976
  0.88219911]
  ..., 
  [ 0.91196013  0.87880101  0.97145563 ...,  0.79110817  1.19651477
  0.98244941]
  [ 1.0129829   0.81045263  0.95434107 ...,  0.99752385  1.08271169
  1.12872492]
  [ 0.94037117  0.81365084  0.94384051 ...,  0.82754351  1.03742172  1.]]
  </code></pre>
  
  <p>How I can do that?</p>
  
  <p>Here is whole script</p>
  
  <pre><code>import numpy as np
  import pyfits
  from matplotlib import pyplot as plt
  import glob
  import os
  import re
  from struct import unpack,pack
  
  global numbers
  numbers=re.compile(r'(\d+)')
  
  
  def numericalSort(value):
      parts = numbers.split(value)
      parts[1::2] = map(int, parts[1::2])
      return parts
  
  dark=sorted(glob.glob(' *.fits'),key=numericalSort)
  flat=sorted(glob.glob('/ *.fits'),key=numericalSort)
  img=sorted(glob.glob('/ *.fits'),key=numericalSort)
  
  #dark
  sumd0 = pyfits.open(dark[0])
  sumdd=sumd0[0].data
  sumdd = sumdd.astype(float,copy=False)
  
  for i in range(1,len(dark)):
      sumdi=pyfits.open(dark[i])
      sumdi=sumdi[0].data
      sumdd=sumdd+sumdi.astype(float, copy=False)
  
  
  dd=sumdd/len(dark)
  
  
  #flat
  sumf0 = pyfits.open(flat[0])
  sumff=sumf0[0].data
  sumff = sumff.astype(float, copy=False)
  
  for i in range(1,len(flat)):
      sumfi=pyfits.open(flat[i])
      sumfi=sumfi[0].data
      sumff=sumff+sumfi.astype(float,copy=False)
  
  ff=sumff/len(flat)
  
  
  df=(ff-dd)
  maxx=np.max(df)
  df=np.clip(df,1,maxx)
  
  
  for n in range(len(img)):
      im=pyfits.open(img[n])
      imgg=im[0].data
      header=im[0].header
      imgg=imgg.astype(float,copy=False)
      x,y=im[0].shape
      m=np.max(imgg)
      imgg=np.clip((imgg-dd),1,m)
      imgg=imgg/df
      imgg=np.clip(imgg,0.5,1.5)
  
  
      #print imgg.dtype
      #imgg=imgg[200:950,150:1250]
      #imgg=imgg[::-1,:y]
       hdu = pyfits.PrimaryHDU(imgg,header)
       hdulist = pyfits.HDUList([hdu])
       hdulist.writeto('/c'+img[n][48:])
       plt.imshow(imgg,cmap=plt.cm.Greys_r)
  #plt.savefig('/+'.png')
  plt.show()
  </code></pre>
  
  <p>On last 9 line I need convert array imgg from float64 to >i2</p>