Skip to content

Fix frame.separation_3d() when frames have velocity data - #6326

Merged
eteq merged 3 commits into
astropy:masterfrom
adrn:coordinates/fix-separation-diffs
Jul 5, 2017
Merged

eteq merged 3 commits into
astropy:masterfrom
adrn:coordinates/fix-separation-diffs

Conversation

@adrn

@adrn adrn commented Jul 5, 2017

Copy link
Copy Markdown
Member

At present, separation_3d() doesn't work when a frame has velocity data attached. This fixes the method to drop the differentials before doing the representation arithmetic.

cc @eteq @mhvk

@adrn adrn added Affects-dev PRs and issues that do not impact an existing Astropy release Bug coordinates no-changelog-entry-needed labels Jul 5, 2017
@adrn adrn added this to the v2.0.0 milestone Jul 5, 2017
@adrn
adrn requested a review from eteq July 5, 2017 01:21

@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.

This looks OK to me, but I think there's an alternate implementation that will make it slightly more robust. See adrn#15 - if that's OK with @adrn (and he merges it) I think we are all set.

@astropy-bot

astropy-bot Bot commented Jul 5, 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 labelled 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! 👍

@bsipocz bsipocz added Affects-dev PRs and issues that do not impact an existing Astropy release and removed Affects-dev PRs and issues that do not impact an existing Astropy release labels Jul 5, 2017
@mhvk

mhvk commented Jul 5, 2017

Copy link
Copy Markdown
Contributor

I didn't look in any detail, but do make sure that if differentials are attached, and an obstime is present, this doesn't just work, i.e., the transformation should be done to the other frame before dropping the differentials.

@adrn

adrn commented Jul 5, 2017

Copy link
Copy Markdown
Member Author

The changes we made happen after the transformation, so I can confirm that if obstimes's are present it doesn't work:

icrs = coord.AltAz(az=15*u.deg, alt=61*u.deg, distance=21*u.pc,
                   pm_az_cosalt=-21*u.mas/u.yr, pm_alt=150*u.mas/u.yr,
                   radial_velocity=100*u.km/u.s, obstime=Time('J2015'))

icrs2 = coord.AltAz(az=15*u.deg, alt=61*u.deg, distance=21*u.pc,
                   pm_az_cosalt=-21*u.mas/u.yr, pm_alt=150*u.mas/u.yr,
                   radial_velocity=100*u.km/u.s, obstime=Time('J2000'))

icrs.separation_3d(icrs2)

raises:

ERROR: NotImplementedError: You cannot transform a frame that has velocities to another frame at a different obstime. If you think this should (or should not) be possible, please comment at https://github.com/astropy/astropy/issues/6280 [astropy.coordinates.baseframe]

@eteq
eteq merged commit 217c773 into astropy:master Jul 5, 2017
@adrn

adrn commented Jul 5, 2017

Copy link
Copy Markdown
Member Author

@bsipocz I don't think this needs a changelog entry - this fixes a bug based on functionality that only exists in master.

@bsipocz

bsipocz commented Jul 5, 2017

Copy link
Copy Markdown
Member

@adrn - Agreed. Basically none of the Affects-dev PRs need a changelog entry by default (except when it's good to have an update on the entry of the original implementation).

bsipocz pushed a commit that referenced this pull request Jul 5, 2017
Fix frame.separation_3d() when frames have velocity data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Affects-dev PRs and issues that do not impact an existing Astropy release Bug coordinates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants