deeptrack.backend.core Module#

Core data structures for DeepTrack2.

This module provides the core DeepTrack2 classes to manage and process data. In particular, it enables users to:

  • Construct flexible and efficient computational pipelines.

  • Manage data and dependencies in a hierarchical structure.

  • Perform lazy evaluations for performance optimization.

Main Features#

  • Data Management

    DeepTrackDataObject and DeepTrackDataDict provide tools to store, validate, and manage data with dependency tracking. They enable nested data structures and flexible indexing for complex data hierarchies.

  • Computational Graphs

    DeepTrackNode forms the backbone of DeepTrack2 computation pipelines, representing computation nodes in a computation graph. Nodes support lazy evaluation, dependency tracking, and caching for improved computational performance. They implement mathematical operators for easy composition of computational graphs.

  • Citations

    Supports citing the relevant publication to ensure proper attribution (e.g., Midtvedt et al., 2021).

Module Structure#

Data Containers:

  • DeepTrackDataObject: Basic data container with validation status.

    A basic container for data with validation status.

  • DeepTrackDataDict: Dictionary to store multiple data with validation.

    A data container to store multiple data objects (DeepTrackDataObject) indexed by unique access IDs (consisting of tuples of integers), enabling nested data storage.

Computation Nodes:

  • DeepTrackNode: Node in a computation graph.

    Represents a node in a computation graph, capable of lazy evaluation, caching, and dependency management.

Example#

Create two DeepTrackNode objects:

>>> parent = DeepTrackNode()
>>> child = DeepTrackNode(lambda: 2 * parent())
>>> parent.add_child(child)

Set the value of the parent:

>>> parent.store(5)

And print the value of the child:

>>> print(child())  # Output: 10

Classes#

DeepTrackDataDict()

Stores multiple data objects indexed by a tuple of integers (ID).

DeepTrackDataObject()

Basic data container for DeepTrack2.

DeepTrackNode([action])

Object corresponding to a node in a computation graph.

WeakSet([data])