Repository navigation
Update astropy.io.vo to use the astropy.table.Table class - #363
Conversation
|
Thanks for filing this. I'm aware of the issue, and have taken a kick at this can a few times. The main sticking point is the mask functionality. Numpy's masked array functionality alone is not able to mask individual elements of individual table cells (i.e. if a cell itself is an array, the array elements need to be masked individually) as required by the VOTable standard. Bringing all of my hairy hacks over to the table class to make that work is the sticking point. Does anyone know the status of this NEP? It seems like a much better way out of this mess: |
|
@mdboom - ok, so this ties back to #149. The NEP looks interesting, but I guess it'll be a while before we can make use of it? (not sure what the status is). Maybe we should implement our own masking scheme as part of #149? (feel free to comment on there if you have ideas). I guess the point you raise of masking individual elements in cells would pretty much rule out using |
|
I've attached a PR that is a reasonable first stab at this, completely throwing out masking for now. This might not be a bad first step to have something working, and then we can work on adding mask support to Table and then tie it in to this. |
There was a problem hiding this comment.
I would recommend putting this sentence in a .. warning:: directive given that it's potentially destructive.
|
Any thoughts on this PR? |
|
I don't know enough about VOTable to comment too intelligently, but it looks like a good start. The way I envisioned doing this for PyFITS, and thought you were going to do too, is actually create a subclass of astropy's Table and tack on format-specific methods/attributes/initializers/etc. For example I thought of making a That said, part of why I want to do that is that the existing FITS_rec class currently used in PyFITS to represent a table is clumsy and not very user-friendly, and I'm anxious to do away with it altogether. I don't know that the same could be said for votable.Table. So I can see why you might want an approach that doesn't change or remove the existing interface at all, but instead makes it possible to convert to an Astropy table. If nothing else it's a good transitional approach, since it doesn't break the existing interface. But do you think in the long term you would want to consider something like I've proposed--a subclass of astropy's Table? Or would that not work very well in this case? |
|
I had hoped to do it that way as well, but ultimately thought this was better. The other problem is that the masking required by the VOTable standard doesn't match Note also that a VOTable file is actually a heirachy of tables -- it's not a single table. PyFITS has this issue, too, of course, in that there is a list of header/data units, but in VOTable they are actually structured. That would be fine (we could still use a subclass of |
|
I should add, also, that I envision some sort of generic tool (a la |
|
Hmm... In principal I would have preferred it being a subclass of @astrofrog and @taldcroft - do you have any thoughts about this? |
|
Oh, and I also your point that a (Oh, @iguananaut - if you think you can make FITS binary table HDUs work as a subclass, that would be great - I guess in a way, that's more like what @mdboom is doing here, anyway) |
|
As I said, I had hoped to subclass PyFITS, of course, doesn't have these complications, so it may make more sense that it subclasses |
|
I also had in mind we would subclass from Note that the identifier functions for |
|
Note that the multiple table issue makes me think we might want some kind of |
|
@mdboom Thanks for the explanation: I figured there must be some features of the VOTable format that didn't translate over well. If the desire arises we can provide functions in the future that return a given file wrapped in a generic Table format a la ATPy like you mentioned. In the meantime, yes, FITS tables translate over much more naturally. They still have quite a few oddities (variable length arrays especially) that complicate matters. But I don't think much if any functionality is lost by putting a more generic table format on top of it, so long as it's still possible to create a table from FITS column specifiers. Anyways, enough about pyfits for this thread. |
|
Little late to the discussion but I think the current PR approach is sensible given the features of VOTable. |
|
I guess what I was getting at before is that if we want to implement So if we actually think we would want to do that, it might be unwise to do this now, because then there's two distinct ways of converting from Having said that, at first glance I'm against a (Aside from this question, the PR looks mergeable to me, though). |
|
@mdboom - note that the travis build is currently failing for this branch |
|
I have rebased this on #429 (which makes the diff look enormous until that gets merged). Furthermore, votable now stores a single Numpy masked array for it's internal data, instead of a pair of (data, mask). Removed the warnings about losing masks when going to |
…" convenience function at the top level.
|
Rebased on master so the diff is reasonable again. |
|
This now appears to be failing only for numpu == 1.4.1 . Any idea what's going on there? |
|
Numpy 1.4.1 doesn't have a dtype called |
|
@mdboom - you commented that masks are no longer lost when going over to Also, once this is merged, I will submit a pull request linking |
|
Apart from possibly adding the warning back, this looks good to me. |
|
There's perhaps some argument here that we should hold off merging this until the mask support is in |
|
This looks fine to me now... @mdboom, is there a reason not to merge this now and then do a separate PR for the mask support? I'm just thinking it might be easier for merging in case any other PR's for |
|
Probably no reason not to merge. I will add the warning about losing mask back in, as already pointed out, however. |
|
I'd vote for merging this now and then we can always update things when merging in masking if there are any issues. |
|
Ok. I've put the warning back in about the mask being thrown out. |
|
BTW: The Travis build failure currently appears to be a false negative -- the build crashed on a couple of the configurations. |
|
This looks good to me now. |
|
Looks good to me, too - @mdboom I'll leave it to you to merge in case you had some last-minute changes in mind. |
Update astropy.io.vo to use the astropy.table.Table class
Update astropy.io.vo to use the astropy.table.Table class
Updating version number to 4.0
It would be great if astropy.io.vo could use the Table class from astropy.table as the base class to avoid code duplication, and to make it easier to integrate astropy.io.vo into the Table.read and Table.write methods.
(@mdboom - I know this is probably already on your to-do list, but I just realized when working on the Table I/O that there was no formal issue to keep track of it)