Spherical geometry and related helper functions.

class, posUnit, velVals=None, velSUnit=None, velTUnit=None, relativistic=False, slaComp=False)[source]

Bases: object

A container for the conversion from spherical coordinates to 6-Vectors.

You create one with an example of your data; these are values and units of STC objects, and everything may be None if it’s not given.

The resulting object has methods to6 taking values like the one provided by you and returning a 6-vector, and from6 returning a pair of such values.

Further, the converter has the attributes distGiven, posdGiven, and distdGiven signifying whether these items are expected or valid on return. If posVals is None, no transforms can be computed.

The relativistic=True constructior argument requests that the transformation be Lorentz-invariant. Do not use that, though, since there are unsolved numerical issues.

The slaComp=True constructor argument requests that some operations exterior to the construction are done as slalib does them, rather than alternative approaches.

defaultDistance = 2062648062466.9238
distGiven = True
distdGiven = True
classmethod fromSTC(stc, **kwargs)[source]

returns a new 6-vector transform for coordinates in STC.


returns a function that transforms 2- or 3-spherical coordinates using the 6-vector transformation sixTrafo.

Regardless of whether we expect distances, the returned function always returns vectors of the same dimensionality as were passed in.

This is used when transforming areas.

getVelocityTransformer(sixTrafo, basePos)[source]

returns a function that transforms velocities using sixTrafos at basePos.

This is used when transforming velocity intervals.

posGiven = True
posdGiven = True, longZeroCoo, changeHands=False)[source]

returns a transformation matrix to transform from the reference system into a rotated system.

The rotated system is defined by its pole, the spherical coordinates at which it has longitude zero and whether or not it is right handed.

All angles are in rad.[source]

returns zxz Euler angles from a rotation matrix.

This is improvised, and someone should look up a numerically sound way to do this., x, z2)[source]

returns a 3-rotation matrix for the z-x-z Euler angles.

There are some functions to obtain such angles below.[source]

returns a rotation matrix for an Euler vector.

An euler vector gives the rotation axis, its magnitude the angle in rad.

This function is a rip-off of SOFA’s rv2m.

eulerVector is assumed to be a numpy array.[source]

returns spherical coordinates for a cartesian 3-vector.

threeVec needs not be normalized., lat)[source]

returns a cartesian 3-vector for longitude and latitude.[source]