Skip to content

Fix gcrs transforms for non geocentric frames - #4894

Closed
StuartLittlefair wants to merge 9 commits into
astropy:masterfrom
StuartLittlefair:fix_gcrs_transform
Closed

StuartLittlefair wants to merge 9 commits into
astropy:masterfrom
StuartLittlefair:fix_gcrs_transform

Conversation

@StuartLittlefair

Copy link
Copy Markdown
Contributor

There was a bug when transforming to and from GCRS frames with non-geocentric coordinates (i.e those with non-zero values of obsgeoloc and obsgeovel. This is because the erfa routine apcs13 expects a position and velocity in GCRS coordinates.

Previously obsgeoloc and obsgeovel were being passed naively, but these are defined in ITRS coordinates. I have added a helper routine get_gcrs_posvel to icrs_cirs_transforms to compute the proper pv array to supply to apcs13.

@astrofrog

Copy link
Copy Markdown
Member

@StuartLittlefair - can you do a rebase? It should get rid of the merge commits (you don't need to squash, I think merge commits get removed automatically)


# now add rotational velocity of GCRS frame w.r.t to ITRS
# rotation of earth
V = u.Quantity([0, 0, 7.292115855306589e-5])*u.rad/u.s

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.

Can this be defined as a constant, along with a reference for where it comes from?

@astrofrog astrofrog added this to the v1.1.3 milestone May 13, 2016
@astrofrog

Copy link
Copy Markdown
Member

@eteq will need to review this, but in the mean time @StuartLittlefair can you add a regression test, as well as a changelog entry in 1.1.3?

@astrofrog astrofrog added the Bug label May 13, 2016
@astrofrog

Copy link
Copy Markdown
Member

@StuartLittlefair - ah sorry. What I mean is that you should add a test with an example that would have failed before this fix and that now works.

@astrofrog

Copy link
Copy Markdown
Member

3434985.71204565])*u.m)
icrs_coo = ICRS(ra=184.285*u.deg, dec=-1.8802*u.deg, distance=148101810.2*u.km)
gcrs_coo = icrs_coo.transform_to(gcrs_frame)

@astrofrog astrofrog May 13, 2016 •

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.

@StuartLittlefair - remove the spaces from line 143 (empty lines should not have spaces). This is causing a PEP8 failure on Travis.

@mhvk

mhvk commented May 13, 2016 •

Copy link
Copy Markdown
Contributor

@StuartLittlefair - an annoying whitespace error... astropy/coordinates/tests/test_intermediate_transformations.py:143:1: W293 blank line contains whitespace

[EDITED] sorry, I see this was caught already...



"""
rotational velocity of Earth in radians per (UT1) second

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This confused me at first, since if it really was per UT1 seconds, it should just be 2 pi / 24 / 3600. But the rotational velocity given is actually per TAI second. Maybe rephrase the docstring

Rotational velocity of the Earth. In UT1 seconds, this would be 2 pi / (24 * 3600),
but we need the value in SI seconds.

@mhvk

mhvk commented May 13, 2016

Copy link
Copy Markdown
Contributor

See some further small comments. I'm convinced enough that this is right to merge it with those in place, but ideally @eteq has a look too.

Comment thread CHANGES.rst
- Transformations between ``GCRS`` frames and other frames now properly handles
frames with non-zero ```obsgeoloc```. Previously this was in slight error for
nearby objects, leading to position errors of a few arcseconds for solar system
planets, to a degree for the Moon.

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.

Add [#4894] to the end of this just so interested parties get a link to this issue.

@eteq

eteq commented May 13, 2016

Copy link
Copy Markdown
Member

@StuartLittlefair - Sorry, I'm confused by this. Why do you say obsgeoloc and obsgeovel are in ITRS? The documentation for them says that they are "oriented the same as BCRS/ICRS", which means they are not ITRS, right? Or am I missing something?

@StuartLittlefair

StuartLittlefair commented May 13, 2016 •

Copy link
Copy Markdown
Contributor Author

@eteq poo. the documentation does say this, I had missed that.

This PR came about because @bmorris was initialising the obsgeoloc attribute of a frame with the geocentric attribute of an EarthLocation (ITRS) and I didn't realise this was incorrect. Perhaps the correct place for the function I've written here is a get_gcrs_posvel attribute of an EarthLocation?

This raises a slight issue:

The documentation also says obsgeoloc and obsgeovel should be 3-vectors, which is not really possible in the use case of a single observatory on Earth and non-scalar times, in which case the GCRS position/velocity is time dependent. Would it be an issue if they had higher dimensionality?

@eteq

eteq commented May 13, 2016 •

Copy link
Copy Markdown
Member

@StuartLittlefair - yep, your solution of putting get_gcrs_posvel in EarthLocation sounds perfect - hopefully you can just copy-and-paste this there. (presumably as part of #4890, or as a separate quick/small PR)

As for "3-vectors", I'm 95% sure that's a subtle lie: it's actually that the trailing (or maybe leading?) dimension has to be 3, but otherwise it can be whatever dimensionality is required. "3-vector" is just there to indicate they are cartesian x/y/z in the same frame as GCRS, rather than spherical or however else someone might want to represent a 3-coordinate. Feel free to also clear up those docs (ideally once you've figured out if it's trailing or leading... easiest way to find out is try one or the other and see which raises exceptions...)

@eteq

eteq commented May 13, 2016

Copy link
Copy Markdown
Member

Oh, and I'm going to kill the tests here just because I'm pretty sure you'll want to close this given the discussion above. But I can re-start them if we end up thinking this is needed after all.

@StuartLittlefair

Copy link
Copy Markdown
Contributor Author

No - I'm pretty sure this is not needed. I'm going to add the changes to EarthLocation in #4890.

@eteq

eteq commented May 13, 2016

Copy link
Copy Markdown
Member

OK, great. Once you've decided that for sure, @StuartLittlefair, feel free to just close this.

@astrofrog astrofrog removed this from the v1.1.3 milestone May 17, 2016
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.

5 participants