Teetool Probabilistic modelling of trajectories

Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
teetool.world.World Class Reference

World class handles all trajectory data. More...

Inheritance diagram for teetool.world.World:

## Public Member Functions
def | __init__ (self, name="", ndim=3, resolution=[10)
| initialise World More...
def | clear (self)
| clear previously stored calculations More...
def | overview (self)
| prints an overview (text) More...
def | addCluster (self, cluster_data, cluster_name="")
| add a cluster to the world More...
def | getName (self)
| returns the name of the world More...
def | getCluster (self, list_icluster=None)
| obtain cluster data More...
def | getClusterPoints (self, x1, list_icluster=None)
| obtain cluster data at specific points [0, 1] More...
def | getTubeStats (self, list_icluster=None, sdwidth=1., resolution=None)
| obtain statistics of confidence region in scenarios More...
def | isInside (self, P, sdwidth=1, list_icluster=None)
def | getSamples (self, icluster, nsamples=50)
| returns samples in a list of (x, Y) data More...
def | buildModel (self, settings, list_icluster=None)
| generates a model from the trajectory data More...
def | getMean (self, list_icluster=None)
| returns the mean trajectory [x, y, z] for list_icluster More...
def | getTube (self, list_icluster=None, sdwidth=1, resolution=None, z=None)
| returns a grid with bools to specify whether a point falls within the confidence region or not More...
def | getLogLikelihood (self, list_icluster=None, resolution=None, z=None)
| returns a grid with the maximum log-likelihood More...

## Public Attributes
| fraction_to_expand
| fraction on edges, default 0.1 More...

## Private Member Functions
def | _check_icluster (self, icluster)
| checks the validity of icluster More...
def | _check_list_icluster (self, list_icluster)
| checks the validity of a list of icluster More...
def | _getGrid (self, outline, resolution=None)
| returns a grid based on outline and resolution More...
def | _get_outline_expanded (self, list_icluster=None, fraction_to_expand=0.1)
| returns an expanded grid based on the outline of trajectory data in list_icluster More...
def | _get_outline (self, list_icluster=None)
| returns a grid based on the outline of trajectory data in list_icluster More...
def | _get_outline_tube (self, sdwidth=1, list_icluster=None)
| returns the outline of a tube of specified clusters More...
def | _get_point_from_cluster_data (self, cluster_data, x1)
def | _get_point_from_xY (self, x, Y, x1)
| returns the points nearest to x1 More...

## Private Attributes
| _name
| name of world More...
| _ndim
| number of dimensions trajectory data More...
| _clusters
| list holding clusters More...
| _resolution
| resolution of grid More...

## Detailed Description

World class handles all trajectory data.

This class provides the direct interface to the trajectory data and produce models

## Constructor & Destructor Documentation

## § __init__()

def teetool.world.World.__init__ | ( |  | self,
|  |  | name = `""`,
|  |  | ndim = `3`,
|  |  | resolution = `[10`
| ) |  |

initialise World

Parameters

  self | object pointer
  name | world name, used in title and saving image
  ndim | number of dimensions in trajectory data
  resolution | specify resolution of grid

## Member Function Documentation

## § _check_icluster()

def teetool.world.World._check_icluster | ( |  | self,
|  |  | icluster
| ) |  |
| private

checks the validity of icluster

Parameters

  self | object pointer
  icluster | value to test

## § _check_list_icluster()

def teetool.world.World._check_list_icluster | ( |  | self,
|  |  | list_icluster
| ) |  |
| private

checks the validity of a list of icluster

Parameters

  self | object pointer
  list_icluster | list of icluster to test

## § _get_outline()

def teetool.world.World._get_outline | ( |  | self,
|  |  | list_icluster = `None`
| ) |  |
| private

returns a grid based on the outline of trajectory data in list_icluster

Parameters

  self | object pointer
  list_icluster | list of clusters to take into account

Returns
  xx grid in x-domain
  yy grid in y-domain
  zz grid in z-domain

      returns the outline of specified clusters

      list_icluster is list of clusters, if None, show all

## § _get_outline_expanded()

def teetool.world.World._get_outline_expanded | ( |  | self,
|  |  | list_icluster = `None`,
|  |  | fraction_to_expand = `0.1`
| ) |  |
| private

returns an expanded grid based on the outline of trajectory data in list_icluster

Parameters

  self | object pointer
  list_icluster | list of clusters to take into account
  fraction_to_expand | fraction to expand the outline with

Returns
  xx grid in x-domain
  yy grid in y-domain
  zz grid in z-domain

## § _get_outline_tube()

def teetool.world.World._get_outline_tube | ( |  | self,
|  |  | sdwidth = `1`,
|  |  | list_icluster = `None`
| ) |  |
| private

returns the outline of a tube of specified clusters

Parameters

  self | object pointer
  sdwidth | variance to evaluate confidence region on
  list_icluster | clusters to evaluate confidence on. None shows all

Returns
  global_outline global outline of the tube (maximum dimensions)

## § _get_point_from_cluster_data()

def teetool.world.World._get_point_from_cluster_data | ( |  | self,
|  |  | cluster_data,
|  |  | x1
| ) |  |
| private

## § _get_point_from_xY()

def teetool.world.World._get_point_from_xY | ( |  | self,
|  |  | x,
|  |  | Y,
|  |  | x1
| ) |  |
| private

returns the points nearest to x1

Parameters

  self | object pointer
  x | x from (x, Y), to find the relevant index
  Y | Y from (x, Y), one of these values gets returned
  x1 | timing [0, 1] to visualise points

Returns
  a a point in space, along the position x, value Y

## § _getGrid()

def teetool.world.World._getGrid | ( |  | self,
|  |  | outline,
|  |  | resolution = `None`
| ) |  |
| private

returns a grid based on outline and resolution

Parameters

  self | object pointer
  outline | outline to generate grid from
  resolution | resolution to generate grid from

Returns
  xx grid in x-domain
  yy grid in y-domain
  zz grid in z-domain

## § addCluster()

def teetool.world.World.addCluster | ( |  | self,
|  |  | cluster_data,
|  |  | cluster_name = `""`
| ) |  |

add a cluster to the world

Parameters

  self | object pointer
  cluster_data | list of (x, Y) trajectory data
  cluster_name | name of added cluster

## § buildModel()

def teetool.world.World.buildModel | ( |  | self,
|  |  | settings,
|  |  | list_icluster = `None`
| ) |  |

generates a model from the trajectory data

Parameters

  self | object pointer
  settings | specify settings in dictionary model_type is resampling, ML, or EM ngaus is number of Gaussians
  list_icluster |

## § clear()

def teetool.world.World.clear | ( |  | self | ) |

clear previously stored calculations

Parameters

  self | object pointer

## § getCluster()

def teetool.world.World.getCluster | ( |  | self,
|  |  | list_icluster = `None`
| ) |  |

obtain cluster data

Parameters

  self | object pointer
  list_icluster | list of clusters to return

Returns
  clusters a list of clusters as specified, holds (x, Y)

## § getClusterPoints()

def teetool.world.World.getClusterPoints | ( |  | self,
|  |  | x1,
|  |  | list_icluster = `None`
| ) |  |

obtain cluster data at specific points [0, 1]

Parameters

  self | object pointer
  x1 | timing [0, 1] to visualise points
  list_icluster | list of clusters to return

Returns
  clusters a list of points A, with points

## § getLogLikelihood()

def teetool.world.World.getLogLikelihood | ( |  | self,
|  |  | list_icluster = `None`,
|  |  | resolution = `None`,
|  |  | z = `None`
| ) |  |

returns a grid with the maximum log-likelihood

Parameters

  self | object pointer
  list_icluster | which clusters to return
  resolution | the resolution to produce the grid on
  z | (optional) height parameter to produce 2d grids for 3d trajectories

Returns
  ss_list a list with ss, representing the bools for each cluster
  xx grid in x-domain
  yy grid in y-domain
  zz grid in z-domain

## § getMean()

def teetool.world.World.getMean | ( |  | self,
|  |  | list_icluster = `None`
| ) |  |

returns the mean trajectory [x, y, z] for list_icluster

Parameters

  self | object pointer
  list_icluster | specify clusters

Returns
  mean_list a list of means

## § getName()

def teetool.world.World.getName | ( |  | self | ) |

returns the name of the world

Parameters

  self | object pointer

Returns
  name of the world

## § getSamples()

def teetool.world.World.getSamples | ( |  | self,
|  |  | icluster,
|  |  | nsamples = `50`
| ) |  |

returns samples in a list of (x, Y) data

Parameters

  self | object pointer
  icluster | specify from which cluster to sample
  nsamples | number of samples to generate

## § getTube()

def teetool.world.World.getTube | ( |  | self,
|  |  | list_icluster = `None`,
|  |  | sdwidth = `1`,
|  |  | resolution = `None`,
|  |  | z = `None`
| ) |  |

returns a grid with bools to specify whether a point falls within the confidence region or not

Parameters

  self | object pointer
  list_icluster | which clusters to return
  sdwidth | variance to test
  resolution | the resolution to produce the grid on
  z | (optional) height parameter to produce 2d grids for 3d trajectories

Returns
  ss_list a list with ss, representing the bools for each cluster
  xx grid in x-domain
  yy grid in y-domain
  zz grid in z-domain

## § getTubeStats()

def teetool.world.World.getTubeStats | ( |  | self,
|  |  | list_icluster = `None`,
|  |  | sdwidth = `1.`,
|  |  | resolution = `None`
| ) |  |

obtain statistics of confidence region in scenarios

Parameters

  self | object pointer
  list_icluster | list of clusters to analyse
  sdwidth | variance to evaluate
  resolution | resolution of grid

## § isInside()

def teetool.world.World.isInside | ( |  | self,
|  |  | P,
|  |  | sdwidth = `1`,
|  |  | list_icluster = `None`
| ) |  |

    returns list of bools, whether or not the points P are inside any of the models

    list_icluster can be set to limit the check to a single values

## § overview()

def teetool.world.World.overview | ( |  | self | ) |

prints an overview (text)

Parameters

  self | object pointer

## Member Data Documentation

## § _clusters

teetool.world.World._clusters
| private

list holding clusters

## § _name

teetool.world.World._name
| private

name of world

## § _ndim

teetool.world.World._ndim
| private

number of dimensions trajectory data

## § _resolution

teetool.world.World._resolution
| private

resolution of grid

## § fraction_to_expand

teetool.world.World.fraction_to_expand

fraction on edges, default 0.1

The documentation for this class was generated from the following file:

- teetool/world.py