Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pr 5891 revised -- fix multidimensional skycoord problems #5897

Merged
merged 6 commits into from Mar 24, 2017

Conversation

mhvk
Copy link
Contributor

@mhvk mhvk commented Mar 21, 2017

fixes #5889, #5890
replaces #5891 with a simpler implementation.

@mhvk
Copy link
Contributor Author

mhvk commented Mar 21, 2017

Note that this just fixes transform_to -- it is possible that it is still possible to get problems with initializing a SkyCoord in way that transform_to used to do: passing it a frame as well as keywords which are exactly the same as the frame attributes. But frankly I think this should not be OK to start with...

Also, I had started on revamping the parsing (which presently is very hard to understand), so maybe it is best to leave that for another time (see #5751 (comment))

@StuartLittlefair
Copy link
Contributor

Can't fault this for elegance @mhvk. It doesn't look like there's any significant performance hit for large representations either. :+1 from me.

return np.concatenate([coo.reshape(sh).value for coo in coordinates],
axis=-1).view(dtype).squeeze()
# For PY2, convert possible unicode literal to string
coo_items = [(str(c) if six.PY2 else c, getattr(self, c))
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason not to move if six.PY2 out of the loop? Besides making the loop (slightly) faster it would be easier to remove it when python2 support is dropped.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It used to do str(c) unconditionally which is guaranteed to work, and really the only reason I put this here was to be sure we would clean it up correctly for astropy 3.0. But on second thought, probably anybody doing that would do a grep for PY2, so then this would be found anyway.
Let me change it back...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

actually, on second thought, I wonder if this was just for numpy 1.6. I'll try without and see if travis signals any problems.

Copy link
Contributor

Choose a reason for hiding this comment

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

seems to fail, so it's a python 2 thing. :(

@mhvk
Copy link
Contributor Author

mhvk commented Mar 22, 2017 via email

@mhvk
Copy link
Contributor Author

mhvk commented Mar 22, 2017

OK, tests now all pass.

@mhvk
Copy link
Contributor Author

mhvk commented Mar 24, 2017

Merging since everybody seemed happy with this.

@mhvk mhvk merged commit 43c64ab into astropy:master Mar 24, 2017
@mhvk mhvk deleted the pr-5891-revised branch March 24, 2017 19:27
bsipocz pushed a commit that referenced this pull request Mar 30, 2017
Pr 5891 revised -- fix multidimensional skycoord problems
bsipocz pushed a commit that referenced this pull request Mar 30, 2017
Pr 5891 revised -- fix multidimensional skycoord problems
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

__repr__ method of BaseRepresentation can fail
3 participants