Skip to content
This repository has been archived by the owner on Dec 22, 2020. It is now read-only.

Proposal: Frames

Frazer McLean edited this page Mar 30, 2016 · 3 revisions

Requirements

  • Ability to transfer from one frame to any other.
  • Transformations should support up to the second derivative of both translation and rotation.
  • Frames should do as much work for the user as possible.

Proposals

#1: Frame Hierarchy with lazy initialisation using a proxy class.

Frame hierarchy, similar to Orekit. We can store the transform to the parent, and conversion from one frame to another is just the sum of the transforms to their common ancestor and back.

I would implement this using factory functions and a proxy class.

class Frame:
    def __init__(translation, ...):
        ...

class FrameProxy:
    def __init__(self, factory):
        self._factory = factory
        self._frame = None

    def __getattr__(self, name):
        if self._frame is None:
            self._frame = self._factory()
        return getattr(self._frame, name)

That is, a FrameProxy class that is given a function to be lazily evaluated the first time the FrameProxy is used. This has the advantage of lazy initialisation (because a user might not have the source data for all the frames at runtime) while not requiring the user to use a factory method or class.

Pros:

  • User just imports a frame instance, doesn't need to care that it's a FrameProxy.

Cons:

  • __repr__ won't be very helpful if the user prints. I think the best option may be to allow __repr__ to call the factory and show the frame information, e.g. as FrameProxy<name='GCRF', translation=...>. I don't think this would cause any problems, except maybe when trying to build documentation if source data is missing? In this case the __repr__ could be failable by making failed Frame initialisation adhere to a specific exception.

Frames and their Transformations

Hopefully can make some use of the IAU SOFA (Standards of Fundamental Astronomy) libraries via liberfa/erfa. AstroPy have a currently-private Python wrapper in astropy._erfa. The SOFA library manual can be found here. For example, should we use eraBi00 to load the constants for the EME2000 ↔︎ GCRF transformation or just duplicate them in astrodynamics?

We can use IERS table class provided by astropy. I'm starting by implementing the frames below with the IERS 2010 conventions. I've listed the erfa functions that can be used.

Frame IERS Conventions useful erfa functions
EME2000 bi00
MOD 1996 bp00, obl80
2003
2010 obl06, p06e
CIRF 1996
2003 xys00a (deconstructed to bpn2xy, s00, pnm00a to use dx/dy from EOP)
2010 xys06a (deconstructed to bpn2xy, s06, pnm06a to use dx/dy from EOP)