因此,我保存了一些Astropy Fits表(它们都具有相同的格式,列名等)。我想将所有这些fits文件合并起来以组成一个大fits文件。
当前,我正在使用astropy.io附加和更新功能,但无济于事。
任何帮助将不胜感激。
所以我现在开始工作了。这基本上就是我所做的:
# Read in the fits table you want to append
table = Table.read(input_file, format='fits')
# Read in the large table you want to append to
base_table = Table.read('base_file.fits', format='fits')
# Use Astropy's 'vstack' function and overwrite the file
concat_table = vstack([base_table,append_table])
concat_table.write('base_file.fits', format='fits', overwrite=True)
在我的情况下,每个表的所有列都相同。因此,我只浏览了所有拟合文件并一次附加一个。可能还有其他方法可以做到这一点,但是我发现这是最简单的。