attitude.geom package

Submodules

attitude.geom.conics module

class attitude.geom.conics.Conic[source]

Bases: numpy.ndarray

angle_subtended(**kwargs)

Compute the half angle subtended (or min and max angles) for an offset elliptical conic from the origin or an arbitrary viewpoint.

kwargs:
tangent Return tangent instead of angle (default false) viewpoint Defaults to origin
center()[source]
contains(p, shell_only=False)[source]

Check to see whether point is inside conic.

Parameters:exact – Only solutions exactly on conic are considered (default: False).
dual()[source]

The inverse conic that represents the bundle of lines tangent to this conic.

Conics and their duals, p 159

classmethod from_axes(axes)[source]

Get axis-aligned elliptical conic from axis lenths This can be converted into a hyperbola by getting the dual conic

classmethod from_semiaxes(axes)[source]

Get axis-aligned elliptical conic from axis lenths This can be converted into a hyperbola by getting the dual conic

is_elliptical()[source]

Check that geometry is an ellipse, ellipsoid, or n-dimensional equivalent.

is_hyperbolic()[source]
is_parabolic()[source]
major_axes()[source]

Gets major axes of ellipsoids

polar_plane(vector)[source]

Calculates the polar plane to a vector (a ‘pole’) for a given conic section. For poles outside the conic, the polar plane contains all vectors of tangency to the pole.

pole(plane)[source]

Calculates the pole of a polar plane for a given conic section.

projection(**kwargs)[source]

The elliptical cut of an ellipsoidal conic describing all points of tangency to the conic as viewed from the origin.

semiaxes()[source]

Semiaxial lengths for ellipsoid and hyperboloid (need to be aligned with coordinate system for now, could integrate with major_axes method below for added clarity.

slice(plane, **kwargs)[source]
solve(v)[source]

Solves a conic for a particular vector. Similar to Conic.transform, but returns a regular array

transform(T)[source]

Transforms a conic or quadric by a transformation matrix.

translate(vector)[source]

Translates a conic by a vector

attitude.geom.conics.angle_subtended(ell, **kwargs)[source]

Compute the half angle subtended (or min and max angles) for an offset elliptical conic from the origin or an arbitrary viewpoint.

kwargs:
tangent Return tangent instead of angle (default false) viewpoint Defaults to origin
attitude.geom.conics.conic(x)[source]

attitude.geom.symbolic_math module

attitude.geom.test_conics module

attitude.geom.test_conics.get_offset_center(a, b)[source]

Get the center of an offset ellipse corresponding to the lengths of the hyperbolic axes

attitude.geom.test_conics.skew_symmetric(arr)[source]
attitude.geom.test_conics.symmetric(arr)[source]
attitude.geom.test_conics.test_angular_shadow()[source]

Check that we can compute the angular shadow of an offset error ellipse.

attitude.geom.test_conics.test_center_recovery()[source]

Check that we can recover the same center for ellipses for all axes.

attitude.geom.test_conics.test_conic()[source]
attitude.geom.test_conics.test_conic_axes()[source]

attitude.geom.test_errors module

attitude.geom.test_errors.test_conic_errors()[source]

attitude.geom.test_geom module

attitude.geom.test_geom.test_right_hand_rule()[source]

attitude.geom.test_hyperbolic_errors module

Test module to make sure that simple representations of hyperbolic errors are equivalent to more generalized expressions.

attitude.geom.test_hyperbolic_errors.simple_hyperbola(cov, xvals, n=1, level=1)[source]

Simple hyperbolic error bounds for 2d errors using quadratic formulation.

Returns tuple of
( distance from center of distribution,
width of error bar)

in unrotated coordinate space

attitude.geom.test_hyperbolic_errors.test_error_projection()[source]

Test projection of errors into error ellipsoid and hyperboloid, and recovery of angular errors

attitude.geom.test_hyperbolic_errors.test_hyperbolic_projection()[source]

Fully projective mechanism to get hyperbolic error bounds in a generalized way along any axes associated with the plane.

attitude.geom.test_hyperbolic_errors.test_hyperbolic_simple()[source]

Convert to hyperbolic axes before projection into plane of maximum angular variability

attitude.geom.test_hyperbolic_errors.test_minimum_variation()[source]
attitude.geom.test_hyperbolic_errors.test_sampling_covariance()[source]

attitude.geom.test_offset_ellipse module

This test module is designed to show the exact relationship between the PCA error lengths defined from covariance matrices and the hyperbolic and ellipsoidal error bounds

attitude.geom.test_offset_ellipse.test_angular_shadow()[source]

Make sure we can successfully recover an angular shadow from an ellipse offset from the origin, a simple two dimensional case of the more general 3d solution.

BASIS: an ellipse with semiaxes [1,1] centered at [0,2] will have a half angular shadow of 30º

attitude.geom.test_offset_ellipse.test_ellipse_offset()[source]

An error ellipse should be offset a set amount off axis

attitude.geom.transform module

attitude.geom.transform.rotate_2D(angle)[source]

Returns a 2x2 transformation matrix to rotate by an angle in two dimensions

attitude.geom.util module

class attitude.geom.util.Plane[source]

Bases: numpy.ndarray

hessian_normal()[source]

Return the Hessian Normal form of a plane (ax + by + cz + d = 0) where [a,b,c] forms the unit normal vector and d is the distance to the origin.

normal()[source]
offset()[source]

Returns the offset of the plane from the origin or an arbitrary point.

attitude.geom.util.angle(v1, v2, cos=False)[source]

Find the angle between two vectors.

Parameters:cos – If True, the cosine of the

angle will be returned. False by default.

attitude.geom.util.augment(vec)[source]

Augment a vector in any orthonormal basis with a trailing 1 to form a homogeneous coordinate vector in that coordinate system.

attitude.geom.util.augment_tensor(matrix, ndim=None)[source]

Increase the dimensionality of a tensor, splicing it into an identity matrix of a higher dimension. Useful for generalizing transformation matrices.

attitude.geom.util.column(vec)[source]

Return a vector with a new trailing axis (of singular dimension) added.

attitude.geom.util.dot(*matrices)[source]
attitude.geom.util.perpendicular_vector(n)[source]

Get a random vector perpendicular to the given vector

attitude.geom.util.plane(normal, offset=0)[source]
attitude.geom.util.unit_vector(vec)[source]

Return a normalized version of the vector

attitude.geom.util.vector(*args)[source]

A single vector in any coordinate basis, as a numpy array.

Module contents

attitude.geom.aligned_covariance(fit, type='noise')[source]

Covariance rescaled so that eigenvectors sum to 1 and rotated into data coordinates from PCA space

attitude.geom.axis_aligned_transforms()[source]

Generates three transformation matrices to map three-dimensional data down to slices on the xy, xz and yz planes, respectively. The typical use case for this is to iterate over the results of this method to provide arguments to e.g. the HyperbolicErrors function.

attitude.geom.fit_angle(fit1, fit2, degrees=True)[source]

Finds the angle between the nominal vectors

attitude.geom.fit_similarity(fit1, fit2)[source]

Distance apart for vectors, given in standard deviations