Repository navigation
Votable/table interface - #524
Conversation
There was a problem hiding this comment.
astropy.io.votable.table.from_table will create the VOTableFile from a Table. I don't think there's a need for the following lines, other than to_xml to write out.
There was a problem hiding this comment.
Ah -- I see why you're doing this -- to set the ID of the table -- but it looks like you're setting the ID of the VOTable file, not the table anyway. I think the better thing is to add ID support to astropy.io.votable.table.from_table and handle it there.
There was a problem hiding this comment.
Does it make sense to change from_table to:
def from_table(cls, votable, table, id=None, name=None, ref=None, ucd=None, utype=None, description=None)
and then read the values from meta if available and not specified in the above call? Or would it make sense to just do it for ID?
There was a problem hiding this comment.
That's an interesting idea. The meta stuff there now is just to make everything round trip when converting to a Table and back... I think it's probably best to just have the user set these things after the fact (since this set of things may change over time). But I'll think on it -- my view may change. In any case, that probably doesn't matter for this PR.
There was a problem hiding this comment.
Ok - so for the ID stuff, shall I add the id argument to from_table for now since I think that is what you were suggesting before? (unless I misunderstood). Or should we just require the user to set t.meta['ID'] before writing to a file if they want to set a custom ID?
There was a problem hiding this comment.
I just submitted a pull request and in it I just added a kwarg for table_id. I think that's a common case that is easily handled this way. As for the other metadata, I'm not sure...
There was a problem hiding this comment.
Thanks for the PR! I don't think the other meta-data are important for now - the table ID is important because it's used to identify the table when reading.
…table core to better support io.table read/write integration. Adds support for identifying VOTables from their header (is_votable). Adds support for loading a single table by its ID (and ignoring all other tables). Adds support for setting the ID of the table being created using `from_table`. Adds some unit tests.
There was a problem hiding this comment.
Question: I wrote this so that the extension ".xml" isn't enough to have the Table code automatically write out a VOTable file -- that is, the format needs to be explicitly set -- because "xml" is so generic. We could have this trigger on votable.xml (though I'm totally making that up) or vot (which I've seen in the wild), but most of the time people use xml for VOTable files.
There was a problem hiding this comment.
I think it's ok to require users to specify the format to write tables out. I agree that xml is too generic, and that's probably the right extension to use.
|
Travis is failing on some configurations. I'm looking into it... |
|
Ok. I think I have a fix here: https://github.com/astrofrog/astropy/pull/21/files |
Fix tests on Numpy 1.4 and Python 3.x
|
I need to write the docs for this, and tidy up the API for all the readers/writers for the |
|
I've tidied up the docs for the table I/O, to make them more user friendly. The issue before was that I was pointing people to various API pages across the Astropy website and just telling users to go there to see what arguments could be passed to @mdboom - are you ok with the new docs? Is there anything else you think I should implement in terms of VO tables before I merge this? @taldcroft - could you take a look at the updated docs, since I updated the section for ASCII I/O too? |
There was a problem hiding this comment.
Perhaps a wild suggestion, since I'm not terribly familiar with IPAC tables, but maybe a short example would be helpful here to explain when one would use definition='left' etc.
|
This looks great -- other than my documentation comments (and the suggestion of moving overwrite into the core rather than in each file type -- which of course could be a follow-on PR), I think this is good to go. |
|
@mdboom - for now, I've ensured that the |
|
Sounds right to me. |
This PR adds the ability to read/write VO table directly from the
astropy.table.Tableclass. I still need to add tests. In the mean time, @mdboom, do you see any issues with this approach? This allows users to do:If there is nothing fundamentally wrong with this, I will start adding some tests.