[AstroPy] AstroPy Digest, Vol 151, Issue 3
Christoph Deil
deil.christoph at googlemail.com
Wed Apr 17 13:41:20 EDT 2019
Hi Rick,
if you want a astropy.table.Table object, use Table.read.
You can pass it a filename, but you can also pass an astropy.io <http://astropy.io/>.fits.BinTableHDU object,
If for some reason you already have it in memory.
I agree it’s weird that Table.read does this, adding a astropy.io.fits.hdu_to_table function would make this easier to discover.
Maybe file an issue with Astropy with that suggestion?
Christoph
> On 17. Apr 2019, at 18:52, Benjamin Weiner <bjw at as.arizona.edu> wrote:
>
> Ugh, I mistyped a variable name, my example should be
> hdulist = fits.open('myfilename.fits')
> mydata = hdulist[1].data # makes a table from the data in extension 1
>
>
>
> On Wed, Apr 17, 2019 at 9:51 AM Benjamin Weiner <bjw at as.arizona.edu <mailto:bjw at as.arizona.edu>> wrote:
> Hello Rick,
>
> You should be able to read a FITS binary table with something like:
>
> from astropy.io <http://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/ <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 <mailto:hessman at astro.physik.uni-goettingen.de>>
> To: astropy at python.org <mailto: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 <mailto: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 <http://www.astro.physik.uni-goettingen.de/~hessman>
> -------------------------------------------------------------------------------------------------
> MONET: a MOnitoring NEtwork of Telescopes
> http://monet.Uni-Goettingen.de <http://monet.uni-goettingen.de/>
> -------------------------------------------------------------------------------------------------
>
>
> --
> Benjamin Weiner
> Staff Scientist / Associate Astronomer, MMT / Steward Observatory
> bjw at as.arizona.edu <mailto:bjw at as.arizona.edu>
> http://mingus.mmto.arizona.edu/~bjw/ <http://mingus.as.arizona.edu/~bjw/>
>
>
> --
> Benjamin Weiner
> Staff Scientist / Associate Astronomer, MMT / Steward Observatory
> bjw at as.arizona.edu <mailto:bjw at as.arizona.edu>
> http://mingus.mmto.arizona.edu/~bjw/ <http://mingus.as.arizona.edu/~bjw/>
> _______________________________________________
> AstroPy mailing list
> AstroPy at python.org <mailto:AstroPy at python.org>
> https://mail.python.org/mailman/listinfo/astropy <https://mail.python.org/mailman/listinfo/astropy>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20190417/9c225a5a/attachment-0001.html>
More information about the AstroPy
mailing list