Advanced Usage

Inspecting DIPLOMAT Plugins

DIPLOMAT was developed with extensibility in mind, so core functionality can be extended via plugins. DIPLOMAT has two kinds of plugins:

  • Predictors: Plugins that take in model outputs and predict poses, or animal locations from them. Some of these also have additional side effects such as plotting or frame export.

  • Frontends: These are plugins that grab frames from another tracking software and pipe them into the predictor the user has selected. Currently, there is two for DeepLabCut and SLEAP.

To get information about predictors, one can use the commands of the diplomat predictors sub-command space:

# List predictor names and their descriptions (Names are passed to -p flag of track).
diplomat predictors list
# List the settings of a predictor plugin (Can be passed to -ps flag of track to configure them).
diplomat predictors list_settings PredictorName

To get information about frontends, use commands diplomat frontends list all and diplomat frontends list loaded:

# List all frontends available
diplomat frontends list all
# List loaded frontends...
diplomat frontends list loaded

Development Usage

DIPLOMAT is written entirely in python. To set up an environment for developing DIPLOMAT, you can simply pull down this repository and create an environment for it using the commands shown below.

git clone https://github.com/TravisWheelerLab/DIPLOMAT.git
cd DIPLOMAT
# Create and syncronize python environment using uv...
uv sync

# Install DIPLOMAT dependencies with all extras (sleap, dlc, and gui) You may want to change this to only install some extras.
uv sync --extra all --extra test

# Run the diplomat command. You can also just use 'diplomat' if you activate the virtual environment at '.venv'
uv run diplomat

For most development, you’ll most likely want to add additional predictor plugins. Predictors can be found in the diplomat/predictors directory. Classes that extend Predictor are automatically loaded from this directory. To test diplomat, you can use pytest as shown below:

pytest