You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
More efficient algorithm for deriving observer's GCRS position and velocity in TETE frame. #11067
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)
@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).
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.
Activity
mhvk commentedon Nov 20, 2020
@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_matin which the only difference is howgastis 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).
mkbrewer commentedon Nov 20, 2020
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 callerfa.gst06()rather thanerfa.gst06a(). If you look aterfa.gst06a(), you will see that is exactly what it does.mhvk commentedon Nov 20, 2020
Hey, that is exactly what I did in my trial! It keeps it simple. See #11069.