Skip to content

Added new attributes to the frame classes for easier access to velocity data - #6869

Merged
eteq merged 10 commits into
astropy:masterfrom
adrn:coordinates/velocity-shortcut
Dec 13, 2017
Merged

eteq merged 10 commits into
astropy:masterfrom
adrn:coordinates/velocity-shortcut

Conversation

@adrn

@adrn adrn commented Nov 17, 2017 •

Copy link
Copy Markdown
Member

This adds three new attributes to the frame classes to provide access to the cartesian velocity data (frame.velocity is equivalent to frame.cartesian.data.differentials['s']), the 2D proper motion data (rather than the two components separately via frame.pm_..., frame.pm_...), and the radial velocity.

Fixes #6854

@adrn adrn added this to the v3.0.0 milestone Nov 17, 2017
@adrn
adrn requested a review from eteq November 17, 2017 19:33
@astropy-bot

astropy-bot Bot commented Nov 17, 2017 •

Copy link
Copy Markdown

Hi there @adrn 👋 - thanks for the pull request! I'm just a friendly 🤖 that checks for issues related to the changelog and making sure that this pull request is milestoned and labeled correctly. This is mainly intended for the maintainers, so if you are not a maintainer you can ignore this, and a maintainer will let you know if any action is required on your part 😃.

Everything looks good from my point of view! 👍

If there are any issues with this message, please report them here.

@eteq eteq left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Mostly good, but a few clarifications to suggest in the docs and the error messages

Comment thread CHANGES.rst Outdated
always have ``.velocity``, ``.proper_motion``, and ``.radial_velocity``
properties that provide shorthands to the full-space Cartesian velocity as
a ``CartesianDifferential``, the 2D proper motion as a ``Quantity``, and the
radial or line-of-sigh velocity as a ``Quantity``. [#6869]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

line-of-sigh sounds like a lot of code I write regularly... But I think you meant line-of-sight.

try:
v = self.cartesian.differentials['s']
except Exception as e:
raise ValueError('Could not retrieve a Cartesian velocity. Your '

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this error is a bit confusing. I can have a coordinate with only PMs and no radial velocity and no distance and this will still work fine (and it should). Maybe instead "Your frame data must include velocity information for this to work"?

Comment thread astropy/coordinates/baseframe.py Outdated
def velocity(self):
"""
Shorthand for the Cartesian velocity as a `CartesianDifferential`
object.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Perhaps also note that it is equivalent to self.cartesian.differentials['s']? I think this is a likely route users will take to starting to understand the necessary complexity of the differential stuff.

And maybe also "velocity" -> "space motion"? but that's not a big deal either way.

@adrn

adrn commented Dec 8, 2017

Copy link
Copy Markdown
Member Author

OK I made the suggested changes and fixed the obvious test failures.

@adrn
adrn force-pushed the coordinates/velocity-shortcut branch from a41ce98 to 8b17912 Compare December 9, 2017 16:56
@eteq
eteq merged commit 6d15232 into astropy:master Dec 13, 2017
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.

2 participants