I have multiple tables created with astropy.table.Table, for example:
from astropy.table import Table
import numpy as np
#table 1
ta=Table()
ta["test1"]=np.arange(0,100.)
#table 2
tb=Table()
tb["test2"]=np.arange(0,100.)
I can save them individually to .fits files using
ta.write('table1.fits')
tb.write('table2.fits')
But I would like to have them saved to the same .fits file, each of them with a different hdu. How can I do that?
There's an example of how to do this here. So, you could do something like the following:
which only has one binary table HDU, but with two columns. Alternatively, to add them as separate HDUs, you could do something like