结合Astropy FITS文件?

因此,我有一些要保存的“熵适合度”表(它们都具有相同的格式,列名等)。我想把所有这些fits文件合并起来,制成一个大fits文件。

当前,我正在使用astropy.io附加和更新功能,但无济于事。

任何帮助将不胜感激。

buchuankuzideyu 回答:结合Astropy FITS文件?

所以我现在开始工作了。这实际上是我所做的:

# 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)

就我而言,每个表的所有列均相同。因此,我只是遍历了所有拟合文件并一次附加了一个。可能还有其他方法可以做到这一点,但是我发现这是最简单的。

本文链接:https://www.f2er.com/3147228.html

大家都在问