Adding a new column to a FITS file via python

前端 未结 1 558
执笔经年
执笔经年 2021-01-15 20:24

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

1条回答
  •  孤城傲影
    2021-01-15 21:08

    Finally they released an updated library that allows the modification of a table extension in a human way!

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

    0 讨论(0)
提交回复
热议问题