How can I combine two FITS tables into a single table in new fits file?
Question: I have two fits file data (file1.fits and file2.fits). The first one
(file1.fits) consists of 80,700 important rows of data and another one is
140,000 rows. The both of them have the same Header.

    
    
    $ python
    >>> import pyfits 
    >>> f1 = pyfits.open('file1.fits')
    >>> f2 = pyfits.open('file2.fits')
    >>> event1 = f1[1].data
    >>> event2 = f2[1].data
    >>> len(event1)
    80700
    >>> len(event2)
    140000
    

How can I combine file1.fits and file2.fits into new fits file (newfile.fits)
with the same header as the old ones and the total number of rows of
newfile.fits is 80,700+ 140,000 = 220,700 ?


Answer: I tried with [astropy](http://www.astropy.org/):

    
    
    from astropy.table import Table, hstack
    
    t1 = Table.read('file1.fits', format='fits')
    t2 = Table.read('file2.fits', format='fits')
    new = hstack([t1, t2])
    new.write('combined.fits')
    

It seems to work with samples from NASA.

