Skip to main content
`Ctrl`+`K`

# Dynamics

Class to manage cinematic computations on GPS tracks

tracklib.algo.Dynamics.DYN_MAT_2D_CST_POS()

  TODO

tracklib.algo.Dynamics.DYN_MAT_3D_CST_POS()

  TODO

tracklib.algo.Dynamics.DYN_MAT_2D_CST_SPEED(dt)

  TODO

tracklib.algo.Dynamics.DYN_MAT_2D_CST_ACC(dt)

  TODO

tracklib.algo.Dynamics.DYN_MAT_3D_CST_SPEED(dt)

  TODO

tracklib.algo.Dynamics.DYN_MAT_3D_CST_ACC(dt)

  TODO

tracklib.algo.Dynamics.DYN_MAT_2D_CST_SPEED_COV(dt, std_acc)

  TODO

tracklib.algo.Dynamics.DYN_MAT_3D_CST_SPEED_COV(dt, std_acc)

  TODO

tracklib.algo.Dynamics.DYN_MAT_2D_CST_ACC_COV(dt, std_jrk)

  TODO

tracklib.algo.Dynamics.DYN_MAT_3D_CST_ACC_COV(dt, std_jrk)

  TODO

class tracklib.algo.Dynamics.Kalman(F=None, Q=None, H=None, R=None, X0=None, P0=None, spreading=None, iter=1)

  Class to define a Kalman filter

  __init__(F=None, Q=None, H=None, R=None, X0=None, P0=None, spreading=None, iter=1)

    Constructor of `Kalman` class

    Unscented Kalman Filter is designed to perform non-linear and non-gaussian estimation on a sequence of unknown states, given a dynamic model F and an observation model H

    Parameters

      - F – A function taking as input an [n x 1] state vector x(t) and returning x(t+1), the prior mean of state vector at time t+1. If F is a matrix transition is handled as standard KF or EKF.

      - Q – The [n x n] state transition covariance matrix where \(Qij = Cov(vi, vj)\), with: \(xi(t+1) = F(xi(t)) + vi\)

      - H – A function taking as input an [nx1] state vector x(t) and returning an `[m x 1]` vector y(t), the observation vetcor at time t. If H is a matrix observation is handled as a standard KF or EKF.

      - R – The `[m x m]` state observation covariance matrix where \(Rij = Cov(wi, wj)\), with: \(yi(t) = H(xi(t)) + wi\)

      - X0 – A :`[n x 1]` initial state vector

      - P0 – A :`[n x n]` initial state covariance matrix

      - spreading – Parameter describing the distance between central mean and sampled sigma points. As a default 2n+1 sigma points are generated.

      - iter – TODO

  setTransition(F, Q=None)
  setObservation(H, R=None)
  setInitState(X0, P0)
  setSpreading(spreading)
  setRestart(restart)
  setIterations(iter)
  setInnovationControl(control)
  getQ(k, track)
  getR(k, track)
  summary()
  __sampleSigmaPts(mu, S)
  __sampleSigmaWeights()
  __mean(SIGMA, W)
  __cov(SIGMA, W, M=None)
  __cross_cov(X, Z, W, MX=None, MZ=None)
  __apply(function, SIGMA, k, track)
  __getObs(track, obs, k, mode)
  estimate(track, obs, out=[], mode=-1, verbose=True)

class tracklib.algo.Dynamics.HMM(S=None, Q=None, P=None, log=False, stationarity=False)

  Hidden Markov Model is designed to estimate discrete sequential variables on tracks, given a probabilistic transition model Q and observation model P on S:

  > - S is a two-valued function, where S(t, k)

  >     provides a list of all the possible states of track t at epoch k.

  > - Q is a four-valued function, giving the (possibly non-normalized) probability function Q(s1,s2,k,t) to observe a transition from state s1 to state s2, at in track t at epoch k.

  > - P is a four-valued function, giving the (possibly non-normalized) probability P(s,y,k,t) = P(y|si), the probability to observe y when (actual) state is s in track t at epoch k.

  Note that s1 and s2 arguments in transition Q must belong to the sets S(t,k) and S(t,k+1), respectively. Observation y may be any value (continuous or discrete, even string or boolean). It may also be a list of values for multi-dimensional hidden markov model. If the underlying Markov model is stationnary, then Q, P and S do not depend on k. In this case, track t and epoch k are no longer mandatory in S, Q and P functions. They can be 0-valued (constant output), 2-valued and 2-valued (respectively), if the boolean member value “stationarity” is set to True. log: set to True if Q and P are already log values

  __init__(S=None, Q=None, P=None, log=False, stationarity=False)

    TODO

  setLog(log)

    TODO

  setStationarity(stat)

    TODO

  setStates(S)

    TODO

  setObservationModel(P)

    TODO

  setTransitionModel(Q)

    Set the transition model.

    Parameters

      Q – four-valued function, giving the probability function Q(s1,s2,k,t) to observe a transition from state s1 to state s2, at in track t at epoch k.

  Qlog(s1, s2, k, track)

    TODO

  Plog(s, y, k, track)

    TODO

  __getObs(track, obs, k, mode)

    Internal function to get all observations at epoch k in a track, from a list of analytical feature names (obs) and a mode if retrieved values must be converted to positions

    TODO

  printTrace(message, importance, level)

    TODO

  printSeparator(importance, level, type)

    TODO

  estimate(track, obs, log=False, mode=0, verbose=3)

    Main function of HMM object, to estimate (decode) the maximum a posteriori sequence of states given observations

    Inputs: :param track: the track on which estimation is performed :param obs: the name of an analytical feature (may also a list

    > of analytical feature names for multi-dimensional HMM) All the analytical features listed must be in the track

    Parameters

      mode –

      to specify how observations are used - MODE_OBS_AS_SCALAR: list of values (default) - MODE_OBS_AS_2D_POSITION: the first two fields

      > of obs are used to make a Coords object. Z component is set to 0 as default.

      - MODE_OBS_AS_3D_POSITIONS: the first three fields of obs are used to make a Coords object

      For MODE_OBS_AS_2D_POSITIONS / MODE_OBS_AS_3D_POSITIONS modes, coordinates SRID is the same as track SRID.

    Returns

      void