traccuracy.loaders._point

Module Contents

Functions

load_point_data(, time_column, seg_id_column, name, sep)

Load point-based tracking data into a TrackingGraph from a csv-like file

traccuracy.loaders._point.load_point_data(path: str | None = None, df: pandas.DataFrame | None = None, parent_column: str = 'parent', id_column: str = 'node_id', pos_columns: tuple[str, Ellipsis] = ('z', 'y', 'x'), time_column: str = 't', seg_id_column: str | None = None, name: str | None = None, sep: str | None = None) traccuracy._tracking_graph.TrackingGraph[source]

Load point-based tracking data into a TrackingGraph from a csv-like file

Assumes each row contains:

  • time

  • position, e.g. three columns ‘z’, ‘y’, ‘x’

  • parent, a reference to the node in the previous time frame. A node without a parent can be indicated by -1

Parameters:
  • path (str | None, optional) – Path to the csv-like file to load. Defaults to None.

  • df (pd.DataFrame | None, optional) – A dataframe that has already been loaded. Defaults to None.

  • parent_column (str | None, optional) – A reference to the parent node in the previous time frame. Defaults to “parent”.

  • id_column (str, optional) – Column used to specify node ids. Node IDs should be unique positive integers. Defaults to ‘node_id’

  • pos_columns (tuple[str], optional) – A tuple of columns to use for position. Defaults to (“z”, “y”, “x”).

  • time_column (str, optional) – The column to use for time. Defaults to “t”.

  • seg_id_column (str | None, optional) – Name of an optional column containing a segmentation label id. Defaults to None.

  • name (str | None, optional) – Optional string to name/describe the dataset. Defaults to None.

  • sep (str | None, optional) – Passed to pd.read_csv to set the sep kwarg. Defaults to None.

Raises:
  • ValueError – Must provide either a path or a dataframe

  • ValueError – parent_column not present in data

  • ValueError – id_column not present in data

  • ValueError – id_column does not contain positive integers

  • ValueError – id_column does not contain unique values

  • ValueError – pos_columns not present in data

  • ValueError – time_column not present in data

  • ValueError – seg_id_column not present in data

Returns:

TrackingGraph