[AstroPy] astropy.table.Table metadata and VOTable

Aldcroft, Thomas aldcroft at head.cfa.harvard.edu
Thu Aug 16 08:44:11 EDT 2018


Hi Rick,

I am not aware of any purposeful decision to not handle table meta values,
I suspect this is just a hole in the implementation.  Your point that it
should be relatively straightforward is well taken.  That said, the
original developer of this subpackage is no longer supporting Astropy and
there has not been a lot of activity on io.votable.  Stefan Becker and Pey
Lian Lim are the maintainers now.

As a start, you should open an issue on the astropy github issue tracker to
put this down as a feature request.  From there, you might consider getting
involved and adding this feature yourself (see
http://www.astropy.org/contribute.html to get started).  Regardless of
where you are with coding, even a documentation update like you suggested
would be welcome.  The starting point for writing a table to VOtable is
here:
https://github.com/astropy/astropy/blob/master/astropy/io/votable/connect.py

Cheers,
Tom A

On Thu, Aug 16, 2018 at 7:32 AM Frederic V. Hessman <
hessman at astro.physik.uni-goettingen.de> wrote:

> I looked at the docs and tried to plow through the old lists but couldn't
> find anything about Table's and VOTable metadata.
>
> Naively, I'd expect
>
>         >>> import numpy as np
>         >>> from astropy.table import Table
>         >>> t = Table()
>         >>> hdr = t.meta
>         >>> hdr['ONE'] = 1
>         >>> hdr['MESSAGE'] = 'Hello,world!'
>         >>> hdr['PI'] = np.pi,'this is just pi'
>         >>> t['x'] = np.arange(10)
>         >>> t.write ('nix.xml',format='votable')
>
> to produce the following VOTable
>
>         <?xml version="1.0" encoding="utf-8"?>
>         <!-- Produced with astropy.io.votable version 3.0.1
>                 http://www.astropy.org/ -->
>         <VOTABLE version="1.3" xmlns="http://www.ivoa.net/xml/VOTable/v1.3"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>  xsi:noNamespaceSchemaLocation="http://www.ivoa.net/xml/VOTable/v1.3">
>          <RESOURCE type="results">
>           <PARAM name="ONE" datatype="long" value="1">
>           <PARAM name="MESSAGE" datatype="string" value="Hello, world!">
>           <PARAM name="PI" datatype="double"
> value="3.14159265"><DESCRIPTION>this is just pi</DESCRIPTION></PARAM>
>           <TABLE>
>           <FIELD ID="x" datatype="long" name="x"/>
>           <DATA>
>            <TABLEDATA>
>            ... (editted out to keep things short) ...
>             </TABLEDATA>
>            </DATA>
>           </TABLE>
>          </RESOURCE>
>         </VOTABLE>
>
> but, in fact, the <PARAM> elements aren't created, i.e. Table doesn't
> store its metadata when the format is VOTable.
>
> I imagine there is a reason for this, since it would have been really
> simple to implement, but I can't imagine what.  If the reason is that Table
> metadata could conceivably be more complex than a simple dictionary (which
> is what 99.9% of all uses probably contain), then why not dump non-trivial
> metadata into an <INFO> with its python representation? - that at least
> would preserve the metadata in some form.  Or at least complain....
>
> There should at least be a mention in the docs that the Table's VOTable
> output is broken (unnecessary loss of data).
>
> Rick
>
> astropy 3.0.1
> Python 3.5.5 (default, Mar 29 2018, 16:25:52)
> [GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)] on darwin
>
> _______________________________________________
> AstroPy mailing list
> AstroPy at python.org
> https://mail.python.org/mailman/listinfo/astropy
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20180816/30020308/attachment.html>


More information about the AstroPy mailing list