hpc4cmb / toast

Time Ordered Astrophysics Scalable Tools
Other
44 stars 39 forks source link

Quaternion representation #335

Open tskisner opened 4 years ago

tskisner commented 4 years ago

Our quaternion operations assume that the scalar part is the last element of each set of 4 numbers. This matches the definitions in the quaternionarray python package. Unfortunately, the opposite convention (scalar at the front) is used by the Boost quaternion library and packages using that (like spt3g). To reduce interface friction, we should support both conventions and eventually migrate to using the alternate format as the default. This will require several steps:

  1. Add new environment variables TOAST_FUTURE_QUAT and TOAST_LEGACY_QUAT. If either is set, select explicitly the convention to use. If neither is set, issue a warning that a future release will change the default.

  2. At some future point release, swap the default.

tskisner commented 4 years ago

It was recently brought to my attention that scipy.spatial.transform.Rotation also uses "scalar last" notation (the opposite of Boost). So I think that TOAST will need to support both in the long term (i.e. not just switch). So the environment variables to control that should be named accordingly.

tskisner commented 2 years ago

This task has moved up the priority list. As a first pass, we could at least provide conversion utilities to go between formats. The global toggle to switch between Boost / Scipy format should also have set / get methods in the Environment class. We need to implement this to avoid downstream workarounds (e.g. https://github.com/simonsobs/sotodlib/pull/171).