Skip to content

vstack, hstack, and join on QTable instances holding Quantity - #5811

Closed
mhvk wants to merge 9 commits into
astropy:masterfrom
mhvk:qtable-vstack
Closed

mhvk wants to merge 9 commits into
astropy:masterfrom
mhvk:qtable-vstack

Conversation

@mhvk

@mhvk mhvk commented Feb 15, 2017

Copy link
Copy Markdown
Contributor

With this PR, table stacking/joining becomes possible also for QTable instances holding Quantity columns, with units properly taken into account.

@taldcroft - this required more of a rewrite of operations.py than I had hoped, mostly because in order to do this the output column attributes have to be determined before creating the column (as they need to be used in the creation). Once that worked, it seemed better to just clean up the code too (e.g., renaming arrays to tables everywhere, as the former were [I think] a left-over of the time that tables had structured arrays underneath). With that, it may be better to look at operations.py itself rather than at the diff...

@mhvk mhvk added this to the v2.0.0 milestone Feb 15, 2017
kwargs['mask'] = True

kwargs.update(**out_attrs)
cols.append(out.ColumnClass(**kwargs))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@taldcroft - the key difference is here: instead of creating an empty array that becomes a column without attributes, I create an empty base column with all the attributes already set (this will be Column even for QTable, but is then converted to Quantity by addcolumns below).

@mhvk

mhvk commented Feb 15, 2017

Copy link
Copy Markdown
Contributor Author

p.s. There's an argument to be made to move _vstack, _hstack and _join inside the main functions, now that there no longer is a clean separation between the table and the underlying structured array.

@mhvk

mhvk commented Feb 16, 2017

Copy link
Copy Markdown
Contributor Author

fixes #4599

@taldcroft

Copy link
Copy Markdown
Member

@mhvk - is there any way to make an isolated version that shows only the very minimal changes needed to accomplish the original goal? I am really surprised that it had to be so invasive. I had thought that the plan would be to make Quantity behave more Column-like so that it just drops in with minor changes to operations.py. This relates to other conversations about making Quantity more drop-in compliant with ndarray . I have not studied the changes here in detail, but as you said it is more like an ab-initio review at this point, which isn't so easy...

@mhvk

mhvk commented Feb 17, 2017

Copy link
Copy Markdown
Contributor Author

It is not easy to make a more minimal version -- for Quantity, the unit has to be set before entries are inserted, which means an initially empty Column with a unit has to be created.

But I did do this work in stages, so I think if you look just at the first three commits (in order), you'll get a very good sense of what and why it happened....

@bsipocz

bsipocz commented May 9, 2017

Copy link
Copy Markdown
Member

@mhvk - now that #5841 is merge, should we close this or there are some things here still that can be reused?

@bsipocz bsipocz added the Close? Tell stale bot that this issue/PR is stale label May 9, 2017
@mhvk

mhvk commented May 9, 2017 •

Copy link
Copy Markdown
Contributor Author

This was supercedde by #5841, so closing

@mhvk mhvk closed this May 9, 2017
@mhvk
mhvk deleted the qtable-vstack branch May 9, 2017 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Close? Tell stale bot that this issue/PR is stale Enhancement table

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants