attitude.orientation package¶
Subpackages¶
Submodules¶
attitude.orientation.base module¶
-
class
attitude.orientation.base.BaseOrientation[source]¶ Bases:
objectAbstract class to define common methods used by other orientation classes (e.g. reconstructed orientations, pca orientations)
-
center¶
-
centered_array¶
-
disabled= False¶
-
hash¶
-
principal_axes¶
-
rotated_covariance¶
-
attitude.orientation.grouped module¶
attitude.orientation.pca module¶
-
class
attitude.orientation.pca.PCAOrientation(arr, weights=None, axes=None)[source]¶ Bases:
attitude.orientation.base.BaseOrientationGets the axis-aligned principle components of the dataset.
-
U¶ Property to support lazy evaluation of residuals
-
angular_error(axis_length)[source]¶ The angular error for an in-plane axis of given length (either a PCA major axis or an intermediate direction).
-
angular_errors(degrees=True)[source]¶ Minimum and maximum angular errors corresponding to 1st and 2nd axes of PCA distribution.
-
azimuth¶
-
center¶
-
centered_array¶
-
coefficients¶
-
covariance_matrix¶ The data covariance matrix is related to the cross-product matrix M^T M but scaled by the number of samples.
-
eigenvalues¶ Eigenvalues of the data covariance matrix
-
explained_variance¶ Proportion of variance that is explained by the first two principal components (which together represent the planar fit). Analogous to R^2 of linear least squares.
-
classmethod
from_axes()[source]¶ Recovers a principal component dataset from a set of axes (singular values*principal axes) of the dataset.
-
hyperbolic_axes¶
-
residuals()[source]¶ Returns residuals of fit against all three data axes (singular values 1, 2, and 3). This takes the form of data along singular axis 3 (axes 1 and 2 define the plane)
-
rotated()[source]¶ Returns a dataset ‘despun’ so that it is aligned with the princpal axes of the dataset.
-
slope¶
-
-
attitude.orientation.pca.axis_transform(pca_axes)[source]¶ Creates an affine transformation matrix to rotate data in PCA axes into Cartesian plane
-
attitude.orientation.pca.compose_affine(*transforms)[source]¶ Returns a composite of several affine transformations.
-
attitude.orientation.pca.covariance_matrix(self)[source]¶ Constructs the covariance matrix of input data from the singular value decomposition. Note that this is different than a covariance matrix of residuals, which is what we want for calculating fit errors.
Using SVD output to compute covariance matrix X=UΣV⊤ XX⊤XX⊤=(UΣV⊤)(UΣV⊤)⊤=(UΣV⊤)(VΣU⊤) V is an orthogonal matrix (V⊤V=I), covariance matrix of input data: XX⊤=UΣ2U⊤
Because the axes represent identity in the PCA coordinate system, the PCA major axes themselves represent an affine transformation matrix from PCA to Cartesian space
-
attitude.orientation.pca.norm(x)¶
attitude.orientation.reconstructed module¶
-
class
attitude.orientation.reconstructed.ErrorShell(axes, covariance)[source]¶ Bases:
objectObject representing a specific error level
-
class
attitude.orientation.reconstructed.ReconstructedPlane(strike, dip, rake, *angular_errors, **kwargs)[source]¶ Bases:
attitude.orientation.reconstructed.ErrorShell,attitude.orientation.base.BaseOrientationThis class represents a plane with errors on two axes. This error is presumably the result of some statistical process, and is a single confidence interval or shell derived from this result.
-
hash¶
-
attitude.orientation.test_pca module¶
-
attitude.orientation.test_pca.test_builtin_recovery()[source]¶ Test recovery functions that are built into basic API
-
attitude.orientation.test_pca.test_error_angles()[source]¶ Test simplistic formulation of error angle measurement
-
attitude.orientation.test_pca.test_hyperbola_axes()[source]¶ Test that the hyperbolic axes are the same as the squared covariance matrices
-
attitude.orientation.test_pca.test_normal_errors()[source]¶ Test the reconstruction of normal vector errors from PCA and conversion back to hyperbolic errors
-
attitude.orientation.test_pca.test_pca_regression_variable()[source]¶ The $hateta$ regression variable is considered the canonical representation of the regressor for OLS. This is also defined for TLS/unweighted PCA regression.
-
attitude.orientation.test_pca.test_recovery_from_axes()[source]¶ Tests the recovery of a Principal Component dataset from a set of precomputed axes.
-
attitude.orientation.test_pca.test_rotation()[source]¶ Make sure we can rotate between PCA and global coordinate systems
-
attitude.orientation.test_pca.test_singular_values()[source]¶ Singular values should represent the standard deviations along major axes of the dataset, scaled by the size of the dataset. E.g. they represent the sqrt(sum of deviations) along that axis of the dataset.
See https://docs.scipy.org/doc/numpy/reference/generated/numpy.std.html for more information
attitude.orientation.test_reconstructed module¶
attitude.orientation.tests module¶
-
attitude.orientation.tests.test_coordinates()[source]¶ Tests to make sure we don’t lose coordinates in the Orientation object
-
attitude.orientation.tests.test_covariance()[source]¶ Make sure we don’t get empty covariance matrices in the Orientation object
Module contents¶
The core orientation module contains classes implementing different planar fitting algorithms. These methods generally produce an object describing a planar fit.
The most useful of these methods is described by