[AstroPy] Add an astropy.table.Table to a multi-extension FITS file?
J. Xavier Prochaska
xavier at ucolick.org
Wed Dec 17 23:41:07 EST 2014
I don’t recall where I pulled this syntax, but it works fine:
prihdr = fits.Header()
prihdu = fits.PrimaryHDU(header=prihdr)
#data is an astropy Table
table_hdu = fits.BinTableHDU.from_columns(np.array(data.filled()))
thdulist = fits.HDUList([prihdu, table_hdu])
thdulist.writeto(outfil,clobber=True)
X
On Dec 17, 2014, at 5:55 PM, David Kirkby <dkirkby at uci.edu> wrote:
> Is it possible to create a table as an astropy.table.Table and then convert it to an astropy.fits.io.BinTableHDU suitable for adding to the astropy.io.fits.HDUList of a multi-extension file?
>
> I guess that astropy.table.Table.write already implements this but I didn't see how to only generate a new HDU in memory with this API.
>
> thanks,
> David
>
> !DSPAM:826,54923412200161532812012! _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> http://mail.scipy.org/mailman/listinfo/astropy
>
>
> !DSPAM:826,54923412200161532812012!
----------------------------------------------
J. Xavier Prochaska
UCO/Lick Observatory
1156 High St.
UC Santa Cruz
Santa Cruz, CA 95064
http://www.ucolick.org/~xavier/
http://imps.ucolick.org/
http://www.qpqsurvey.org/
http://k1dm3.ucolick.org/
http://www.ucolick.org/~xavier/IDL/index.html
https://github.com/profxj/xastropy
831-459-2135 (Direct)
831-459-2991 (UCO/Lick Main)
831-459-5244 (Fax)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20141217/59936c12/attachment.html>
More information about the AstroPy
mailing list