Skip to content

More efficient algorithm for deriving observer's GCRS position and velocity in TETE frame.  #11067

Closed

Description

@mkbrewer

Description

The current method for deriving the observer's GCRS position and velocity in the TETE<->GCRS intermediate rotation transforms is inefficient as it involves a call to erfa.gst06a() which in turn calls erfa.pnm06a() in order to calculate the equation of the origins. This means that the TETE<->GCRS transforms call the very expensive erfa.pnm06a() twice. Fortunately, this can be easily avoided in one of two ways:

  • Instead of doing the ITRS->TETE transform directly using transform_to(), the required greenwich apparent sidereal time can be inexpensively derived from the BPN already at hand by calling erfa.gst06().

  • Simply go through CIRS instead of TETE to derive the GCRS position and velocity. The required celestial to intermediate matrix can be inexpensively derived from the BPN at hand in the same manner as is done in erfa.apco() after extracting the CIP coordinates and CIO locator from the BPN.

Additional context

Celestial to intermediate matrix from classical BPN.

   # Extract CIP coordinates.
   x, y = erfa.bpn2xy(rnpb)

   # The CIO locator, s. 
   s = erfa.s06(tta, ttb, x, y)

   # CIO based BPN matrix. 
   rc2i = erfa.c2ixys(x, y, s)

Activity

  1. mhvk commented on Nov 20, 2020

    @mhvk
    Contributor

    @mkbrewer - thanks! It looks like my quick adaptation of the routine for CIRS was not so clever... But I think your suggestion combined with the matrix chain idea of @StuartLittlefair means we can fairly easily improve on this.

    Just to be clear, your first option would basically involve implementing a different version of tete_to_itrs_mat in which the only difference is how gast is called? I'll try to put up a quick PR just to have something to look at...

    p.s. It sounds like beyond the problem directly at hand, it would be good to start making the transform graph aware that some steps are considerably more expensive than others (in principle, IIRC, there is a way to assign weights exactly for this purpose).

  2. mkbrewer commented on Nov 20, 2020

    @mkbrewer
    ContributorAuthor

    That would be one option. One could add an argument: tete_to_itrs_mat(time, rbpn=None). Then if given a BPN matrix, it could call erfa.gst06() rather than erfa.gst06a(). If you look at erfa.gst06a(), you will see that is exactly what it does.

  3. mhvk commented on Nov 20, 2020

    @mhvk
    Contributor

    Hey, that is exactly what I did in my trial! It keeps it simple. See #11069.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions