Skip to content

Fix gcrs posvel - #6699

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

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

Conversation

@StuartLittlefair

@StuartLittlefair StuartLittlefair commented Oct 9, 2017 •

Copy link
Copy Markdown
Contributor

Fixes #6697 and also fixes #6680, subject to the precision required by that user.

I've removed the incorrect assumption that the rotation axis is aligned with the GCRS pole. This routine now calculates the rotation of the earth in the CIRS frame and rotates into GCRS. This could have been done using the new ability to include differentials in frames, but the current way seemed neater to me.

@astropy-bot

astropy-bot Bot commented Oct 9, 2017 •

Copy link
Copy Markdown

Hi there @StuartLittlefair 👋 - 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! 👍

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

@bsipocz bsipocz added this to the v2.0.3 milestone Oct 9, 2017
@StuartLittlefair

Copy link
Copy Markdown
Contributor Author

Also fixes #6680, subject to the precision required by that user.

@bsipocz

bsipocz commented Oct 9, 2017

Copy link
Copy Markdown
Member

Also fixes #6680, subject to the precision required by that user.

can you mention that in the PR description commit, so merging will autoclose that issue, too?

Comment thread CHANGES.rst Outdated
- Fixed a bug that was preventing ``SkyCoord`` objects made from lists of other
coordinate objects from being written out to ECSV files. [#6448]

- Improved accuracy of velocity calculation in ```EarthLocation.get_gcrs_posvel```. [#6697]

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.

release 2.0.2 is already out, please move the entry to 2.0.3

@MSeifert04

Copy link
Copy Markdown
Contributor

I think astrobot doesn't recognize the PR number because it's off by 2.

@astropy astropy deleted a comment from astrobot Oct 9, 2017
@astropy-bot

astropy-bot Bot commented Oct 9, 2017

Copy link
Copy Markdown

ASTROPY-BOT IS ALWAYS RIGHT!

@StuartLittlefair

Copy link
Copy Markdown
Contributor Author

@eteq for comparison, this is what the routine would look like using differentials:

    def get_gcrs_posvel(self, obstime):
        """
        Calculate the GCRS position and velocity of this object at the
        requested ``obstime``.

        Parameters
        ----------
        obstime : `~astropy.time.Time`
            The ``obstime`` to calculate the GCRS position/velocity at.

        Returns
        --------
        obsgeoloc : `~astropy.coordinates.CartesianRepresentation`
            The GCRS position of the object
        obsgeovel : `~astropy.coordinates.CartesianRepresentation`
            The GCRS velocity of the object
        """
        # do this here to prevent a series of complicated circular imports
        from .builtin_frames import CIRS
        from .builtin_frames.intermediate_rotation_transforms import gcrs_to_cirs_mat

        itrs = self.get_itrs(obstime)
        cirs_frame = CIRS(obstime=obstime)
        cirs_cart = itrs.transform_to(cirs_frame).cartesian
        rotation_vector = CartesianRepresentation(0/u.s, 0/u.s, OMEGA_EARTH)
        cirs_vel = rotation_vector.cross(cirs_cart)
        cirs_posvel=cirs_cart.with_differentials({'s': coord.CartesianDifferential(*cirs_vel.xyz)})
        gcrs_posvel = cirs_posvel.transform(matrix_transpose(gcrs_to_cirs_mat(t)))
        return gcrs_posvel.without_differentials(), gcrs_posvel.differentials['s'].to_cartesian()

Personally I find it a bit harder to follow, but it is marginally faster, as it has one fewer transformation...

@StuartLittlefair

Copy link
Copy Markdown
Contributor Author

Documentation failures look unrelated to changes in this PR @bsipocz ?

@bsipocz

bsipocz commented Oct 10, 2017

Copy link
Copy Markdown
Member

Yes, those warnings are due to #6695

@mhvk

mhvk commented Oct 10, 2017

Copy link
Copy Markdown
Contributor

This looks good to me. I actually like the use of the standard transformation routines, but think it could also be left to a separate issue.

Continuing separate though, might it be more logical to make a new routine get_gcrs that returns the full gcrs position with derivative, and is used here to split out the two parts. Or even to have a more general .transform_to method in analogy with SkyCoord?

@eteq

eteq commented Oct 23, 2017

Copy link
Copy Markdown
Member

(Just as a temporary note: this is on my radar and aim to review it ASAP)

@StuartLittlefair

Copy link
Copy Markdown
Contributor Author

Superceded by #6861

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.

EarthLocation.get_gcrs_posvel is innacurate EOP in Python (Precession Nutation)

5 participants