通过python将新列添加到FITS文件
我创建了一个名为 distance 的数组,其中包含1242个值.我想将此数组添加为包含10列的现有FITS文件中的第11列.
I have created an array named distance that contains 1242 values. I want to add this array as the 11th column in an already existing FITS file that contains 10 columns.
我正在使用pyfits.
I am using pyfits.
我尝试了pyfits.append(filename,distance),它没有显示任何错误,但没有将我的专栏添加到FITS文件中.
I tried pyfits.append(filename, distance) which showed no errors but did not add my column to the FITS file.
有什么建议吗?
最后,他们发布了一个更新的库,该库允许以人工方式修改表扩展名!
Finally they released an updated library that allows the modification of a table extension in a human way!
FITSIO 的最新版本.您可以轻松添加带有如下代码的列:
Last release of FITSIO. You can easily add a column with a code looking like the following:
import fitsio
from fitsio import FITS,FITSHDR
...
fits = FITS('file.fits','rw')
fits[-1].insert_column(name = 'newcolumn', data = mydata) # add the extra column
fits.close()