Skip to content
This repository has been archived by the owner on Jun 16, 2018. It is now read-only.

First pass at a SkyCoord plotting method. #209

Merged
merged 7 commits into from
Dec 2, 2016

Conversation

Cadair
Copy link
Contributor

@Cadair Cadair commented Aug 23, 2016

No description provided.

@hamogu
Copy link

hamogu commented Sep 15, 2016

I was just looking for a feature like this in the docs and then went to open an issue to request it. Seems you've started already. Thanks!

@Cadair
Copy link
Contributor Author

Cadair commented Nov 23, 2016

@astrofrog I added tests, does this need anything else?

ax.set_ylim(-0.5, 720.5)

c = SkyCoord(359.76045223*u.deg, 0.26876217*u.deg)
ax.plot_coord(c, 'o', transform=ax.get_transform('galactic'))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This demonstrates that the transform always wins. I am not sure this is actually the behaviour we want though right?!
What about converting the frame to the transform frame?!

Copy link
Owner

Choose a reason for hiding this comment

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

Woah that is confusing. I would say that we should ignore transform for plot_coord? (or emit an error that it can't be specified?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not allowing the transform arg would work. Or we could convert the input frame to the transform?

Copy link
Owner

Choose a reason for hiding this comment

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

If we did that, there would be no point since in the end it gets converted to the image frame, so I'd prefer we just disallow transform

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The only reason for it is if we allowed a list of SkyCoords as input, but that won't really work so I will remove it.

ax.set_xlim(-0.5, 720.5)
ax.set_ylim(-0.5, 720.5)

c = SkyCoord(359.76045223*u.deg, 0.26876217*u.deg)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

for the record these are in galactic.

Copy link
Owner

@astrofrog astrofrog left a comment

Choose a reason for hiding this comment

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

You'll also need to do a PR to data.astropy.org to add the reference images. I need to write instructions about that...

@@ -3,6 +3,7 @@
from matplotlib.axes import Axes, subplot_class_factory
from matplotlib.transforms import Affine2D, Bbox, Transform

import astropy.coordinates
Copy link
Owner

Choose a reason for hiding this comment

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

Maybe just import the classes you need (SkyCoord and BaseCoordinateFrame)

elif coord.coord_type == 'latitude':
plot_data.append(frame0.data.lat.to(coord.coord_unit).value)
else:
raise NotImplementedError("Scalar Coordinate Support is Not Implemented.")
Copy link
Owner

Choose a reason for hiding this comment

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

I wonder if you could make this clearer, e.g. 'Coordinates cannot be plotted with this method because the WCS does not represent longitude/latitude'

raise NotImplementedError("Scalar Coordinate Support is Not Implemented.")

if 'transform' in kwargs.keys():
raise TypeError("The 'transform' keyword argument is not allowed,"
Copy link
Owner

Choose a reason for hiding this comment

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

Why TypeError? (just curious)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

because:

bob(asdj=8)
Traceback (most recent call last):
  File "/usr/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 10216, in default
    run_compiled_code(code, self.ctx, None, 'single')
  File "/usr/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 1961, in run_compiled_code
    func(code, glb, loc)
  File "<xonsh-code>", line 1, in <module>
TypeError: bob() got an unexpected keyword argument 'asdj'

i.e. that's the type of error Python raises for unknown kwarg.

Copy link
Owner

Choose a reason for hiding this comment

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

Huh, I learn stuff every day!

@astrofrog
Copy link
Owner

I'll add the image references later, the priority is to get this into the astropy wcsaxes merge.

@astrofrog astrofrog merged commit da0b8d0 into astrofrog:master Dec 2, 2016
@Cadair Cadair deleted the plot_sc branch December 2, 2016 12:29
astrofrog added a commit that referenced this pull request Dec 2, 2016
First pass at a SkyCoord plotting method.
astrofrog added a commit that referenced this pull request Dec 2, 2016
First pass at a SkyCoord plotting method.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants