=====
thLib
=====

*thLib* utility primarily contains unctions for working with 3D kinematics.
(i.e. quaternions and rotation matrices). In addition, it has a number of
routines for fitting circles, lines, sine-waves, and exponential decays. For
signal processing,a Savitzky-Golay filter is included, as well as a
demonstration of the calculation of a power spectrum.

Should be compatible with Python 2 and 3.

Author:  Thomas Haslwanter
Date:    03-Nov-2013
Ver:     3.4
Licence: This work is licensed under a Creative Commons Attribution-NonCommercial 3.0
         Unported License.

Quaternions
===========

Note that all these functions work with single quaternions and quaternion vectors,
as well as with arrays containing these.

Functions for working with quaternions
--------------------------------------

- quat.quatinv ... Quaternion inversion
- quat.quatmult ... Quaternion multiplication
- quat.rotate_vector ... Rotation of a vector

Conversion routines
-------------------

- quat.deg2quat ... Convert number or axis angles to quaternion vectors
- quat.quat2deg ... Convert quaternion to corresponding axis angle
- quat.quat2rotmat ... Convert quaternion to corresponding rotation matrix
- quat.quat2vect ... Extract the vector part from a quaternion
- quat.rotmat2quat ... Convert a rotation matrix to the corresponding quaternion
- quat.vect2quat ... Externd a quaternion vector to a unit quaternion.
- quat.vel2quat ... Calculate orientation from a starting orientation and angular velocity.


Rotation Matrices
=================

Definition of rotation matrices
-------------------------------

- rotmat.R1 ... 3D rotation matrix for rotation about the 1-axis
- rotmat.R2 ... 3D rotation matrix for rotation about the 2-axis
- rotmat.R3 ... 3D rotation matrix for rotation about the 3-axis

Conversion Routines
-------------------
- rotmat.rotmat2Fick ... Calculation of Fick angles
- rotmat.rotmat2Helmholtz ... Calculation of Helmholtz angles

Symbolic matrices
-----------------

- rotmat.R1_s() ... symbolix matrix for rotation about the 1-axis
- rotmat.R2_s() ... symbolix matrix for rotation about the 2-axis
- rotmat.R3_s() ... symbolix matrix for rotation about the 3-axis

For example, you can e.g. generate a Fick-matrix, with

>>> R_Fick = R3_s() * R2_s() * R1_s()
    
Fits
====

Functions
---------

- fits.demo_ransac ... RANSAC fit of best circle in image
- fits.fit_circle ... basic circle fit
- fits.fit_exp ... exponential fit
- fits.fit_line ... linear regression fit, complete with confidence intervals for mean and values, and with plotting
- fits.fit_sin ... sine fit
- fits.regress ... regression fit, similar to MATLAB
    
Signal Processing Utilities
===========================

- signals.pSpect ... simple power spectrum from FFT
- signals.savgol ... Savitzky-Golay filter

GUI Utilities
=============

- ui.getfile ... GUI for selecting an existing file
- ui.getdir ... GUI for selecting a directory
- ui.savefile ... GUI for saving a file


