[AstroPy] AstroPy Digest, Vol 151, Issue 3

Benjamin Weiner bjw at as.arizona.edu
Wed Apr 17 12:51:48 EDT 2019


Hello Rick,

You should be able to read a FITS binary table with something like:

from astropy.io import fits
hdulist = fits.open('myfilename.fits')
mydata = hdu[1].data   # makes a table from the data in extension 1

This is covered in the astropy.io.fits documentation at
http://docs.astropy.org/en/stable/io/fits/

Cheers,
Ben Weiner

Date: Wed, 17 Apr 2019 15:43:56 +0200
> From: "Frederic V. Hessman" <hessman at astro.physik.uni-goettingen.de>
> To: astropy at python.org
> Subject: [AstroPy] HDU to Table
>
> There's the convenience function
>
>         astropy.io.fits.table_to_hdu (astropy.table.Table) ->
> astropy.io.fits.BinTableHDU
>
> but where's
>
>         astropy.io.fits.hdu_to_table(astropy.io.fits.BinTableHDU) ->
> astropy.table.Table ?
>
> Surely people are writing AND reading binary tables.....!    I want to
> dump IFU spectra into a single FITS binary table file and then easily read
> them back in again.
>
> My internet searches haven't yielded anything equivalent.  Of course, one
> can write the reverse conversion (one can write anything/everything), but
> this should be a standard FITS/Table function.
>
> Rick
>
>
> ------------------------------------------------------------------------------------------------
> Dr. Frederic V. Hessman     Hessman at Astro.physik.Uni-Goettingen.DE
> Institut f?r Astrophysik          Tel.  +49-551-39-5052
> Friedrich-Hund-Platz 1         Fax +49-551-39-5043
> 37077 Goettingen                 Room F04-133
> http://www.Astro.physik.Uni-Goettingen.de/~hessman
>
> -------------------------------------------------------------------------------------------------
> MONET: a MOnitoring NEtwork of Telescopes
> http://monet.Uni-Goettingen.de
>
> -------------------------------------------------------------------------------------------------
>
>
-- 
Benjamin Weiner
Staff Scientist / Associate Astronomer, MMT / Steward Observatory
bjw at as.arizona.edu
http://mingus.mmto.arizona.edu/~bjw/ <http://mingus.as.arizona.edu/~bjw/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20190417/fa95dc49/attachment.html>


More information about the AstroPy mailing list