๐Ÿ“– API Reference๏ƒ

This section provides a categorized reference of SimBAโ€™s modules and methods, grouped by their functionality such as feature extraction, plotting, transformation, and modeling.

๐Ÿ“‘ Find anything fast

Browse the Module Index โ€” an alphabetical list of every SimBA module, and the quickest way to find where a class or function lives.

Or jump to the General Index (every class, function and term, Aโ€“Z), or use full-text search.

๐Ÿ” Blob tracking tools๏ƒ

Track animals in videos using background subtraction and blob detection โ€” an alternative to pose-estimation that needs no trained keypoint model. Detected blob contours are converted into geometric features such as the animalโ€™s center, nose, tail, and left/right flank points, so downstream movement, ROI, and geometry analyses work from the silhouette alone. Well suited to single-animal, high-contrast recordings where a full pose model is unnecessary.

๐Ÿ“ฆ Bounding-box tools๏ƒ

Build bounding boxes and anchored polygons around animals from pose-estimation data, then quantify how they overlap through time. Useful for detecting proximity-based social interactions โ€” one animal entering anotherโ€™s space, or body parts coming into contact โ€” without training a dedicated classifier. Overlap statistics can be aggregated per-animal and per-frame for downstream analysis.

See tutorial: Anchored ROI (bounding box) tutorial

๐Ÿ” Circular transformations๏ƒ

Statistical operations for circular data such as head direction and heading angle, where values wrap around 360ยฐ. Wraparound-aware and multi-animal capable, these methods derive base angles from body-part triplets and compute quantities like mean resultant vector length, angular difference, directional dispersion, and the Rayleigh test โ€” in both sliding-window and whole-session forms. GPU-accelerated variants are available for large datasets.

๐Ÿ”ง Config reader๏ƒ

Parse SimBA project configuration (project_config.ini) and expose project metadata โ€” file paths, animal and body-part definitions, video parameters, and classifier settings. Most SimBA classes inherit from this reader so they can locate data and resolve project-wide options consistently, rather than re-parsing the config themselves.

๐Ÿ’ก Cue-light tools๏ƒ

Link animal behavior to the on/off state of cue lights in the arena. Detect illumination changes from ROI pixel intensity, then summarize movement and classified behavior in the periods before, during, and after each light event โ€” for analyses of conditioned or stimulus-driven responses.

See tutorial: Cue-light tutorial

๐Ÿ”ง Data processing tools๏ƒ

Transform classification, tracking, and image data after feature extraction or model inference. Includes interpolation and smoothing of pose data, aggregation of classifier results, and specialized calculators such as Kleinberg burst detection, the forward spike-time tiling coefficient (FSTTC), and movement and severity scoring.

๐Ÿ“ Feature extraction mixins๏ƒ

Core low-level feature methods โ€” distances, angles, velocities, areas, and body-part relationships โ€” that the default extraction pipelines assemble into full feature sets. Use these directly to compose custom features from raw tracking coordinates when the out-of-the-box extractors donโ€™t fit your schema.

๐Ÿ“ Feature extraction wrappers๏ƒ

Pre-configured โ€œout-of-the-boxโ€ feature extraction modules for common pose-estimation schemas, spanning a range of single- and multi-animal body-part layouts. Each wrapper turns raw tracking coordinates into the tabular feature set that SimBA classifiers are trained and run on, so most users never have to write feature code by hand.

๐Ÿ“ Geometry transformations๏ƒ

Transform pose-estimated body-part coordinates into geometric shapes โ€” bounding boxes, polygons, circles, and lines โ€” and compute spatial relationships between them. Supports buffering, unions and intersections, point-in-shape tests, inter-shape distances, overlap, and directionality. Built on Shapely, with GPU-accelerated variants for many of the heavier operations.

โš™๏ธ Global configuration๏ƒ

Global SimBA settings and environment variables โ€” GPU toggles, default paths, and feature flags โ€” that tune runtime behaviour across the package. Set these once to change how modules execute (for example, enabling numba eager compilation or GPU code paths) without editing individual scripts.

โšก GPU acceleration๏ƒ

CUDA/CuPy-accelerated versions of SimBAโ€™s compute-heavy routines โ€” geometry, image, background subtraction, statistics, circular statistics, time-series, and SHAP โ€” consolidated in one place. On a supported NVIDIA GPU they produce the same results as their CPU counterparts but run orders of magnitude faster on large datasets, with per-function expected-runtime tables to help you gauge the speed-up.

๐Ÿ–ผ๏ธ Image transformations๏ƒ

Manipulate video frames and extract visual information from tracking data โ€” crop, slice, rotate, and greyscale frames, isolate regions around body parts, and compute pixel-based features. Includes methods for comparing image features across time (e.g. frame-to-frame change), with both CPU and GPU implementations.

๐Ÿท๏ธ Labeling tools๏ƒ

Interactive tools for annotating behavioral events frame by frame. Create and edit the ground-truth labels used to train classifiers, review and correct model predictions directly on the video, and manage annotations across a projectโ€™s videos.

๐Ÿงฉ Mixins (overview)๏ƒ

Entry point to SimBAโ€™s mixin classes โ€” the reusable method libraries (feature, geometry, statistics, plotting, image, network, timeseries, model) that the other topical sections draw on. Grouping shared functionality here keeps it consistent and testable across the package; most user-facing tools are thin wrappers that combine these mixins.

๐Ÿค– Model tools๏ƒ

Create, train, evaluate, and apply SimBAโ€™s behavior classifiers (random-forest based). Configure hyperparameters, run cross-validation, generate evaluation metrics and plots such as feature importances and learning curves, and batch-apply trained models to new videos to produce per-frame behavior probabilities.

โš ๏ธ Outlier correction๏ƒ

Heuristic filtering of implausible body-part tracking. Location- and movement-based criteria โ€” scaled by a reference inter-body-part distance โ€” flag and correct jitter and sudden, physically impossible jumps before feature extraction, improving the quality of downstream features and classification.

๐ŸŽจ Plotting and visualization tools๏ƒ

Visualize behavioral data and pose-tracking outputs โ€” Gantt plots, path, distance and velocity plots, heatmaps, classification-probability charts, and data overlays rendered onto the original video. Produces both static figures and frame-by-frame videos, with multiprocessing support for large batches.

๐Ÿ“ฆ Pose-estimation import tools๏ƒ

Parse, load, and standardize pose-estimation output from common trackers (e.g. DeepLabCut, SLEAP, DeepPoseKit, MARS) across H5, CSV, and JSON formats. Handles single- and multi-animal data and can interpolate and smooth tracking on import, producing the consistent internal format the rest of SimBA expects.

๐Ÿ—บ๏ธ ROI tools๏ƒ

Define regions-of-interest โ€” rectangles, circles, and polygons โ€” and analyze tracking in relation to them. Compute zone entries and exits, time and distance spent in each region, distance to ROI boundaries, and whether animals are oriented toward a region, with visualization tools for the results.

๐Ÿ“Š Statistics transformations๏ƒ

Compute statistical features from tracking and classification data โ€” descriptive statistics, distribution comparisons, distance metrics, and drift/change detection โ€” over sliding or static time windows. Underpins much of SimBAโ€™s feature extraction, and many methods have GPU-accelerated counterparts for large datasets.

๐Ÿ“ฅ Third-party label appenders๏ƒ

Import behavioral annotations produced by external tools (e.g. BORIS, Ethovision, Observer, DeepEthogram, SOLOMON) and align them, frame by frame, to SimBAโ€™s pose-estimation and feature data. Lets you reuse existing human or third-party labels as classifier training targets without re-annotating.

๐Ÿ• Time-series transformations๏ƒ

Analyze the temporal structure of tracking and feature signals using sliding-window methods โ€” complexity and entropy measures, autocorrelation, and windowed descriptive statistics โ€” to capture how behavior evolves over time. GPU-accelerated variants are available for the heavier computations.

๐Ÿ”ฎ Unsupervised learning๏ƒ

Discover behavioral structure without labels. Combines dimensionality reduction (e.g. UMAP, PCA) with clustering (e.g. HDBSCAN, K-means), plus tools to embed, visualize, and quantify the resulting clusters โ€” a workflow for surfacing candidate behavioral motifs from feature data.

๐Ÿ–ฅ๏ธ User Interface (UI) tools๏ƒ

SimBAโ€™s graphical interface components โ€” the Tkinter windows, pop-ups, and menus that drive project creation, configuration, and each step of the analysis workflow. The entry point for users who prefer clicking through SimBA rather than scripting it.

โš™๏ธ Utilities๏ƒ

Helper methods used throughout the package โ€” logging, CLI execution, input and argument validation, warnings, timing, and reading/writing project files. The shared plumbing that keeps SimBAโ€™s error messages, checks, and file handling consistent across every module.

See also

Further utility modules are documented alongside the features they support: YOLO utilities (dataset conversion and training/inference helpers), CUDA / GPU utilities (low-level device primitives and the NVDEC video-decoder factory), and the custom feature extractor.

๐Ÿ“น Video processing tools๏ƒ

Video processing tools built on OpenCV and FFmpeg โ€” clip, crop, concatenate, downsample, re-encode, rotate, and greyscale videos, and compute average/background frames. Covers the common pre-processing steps needed to get raw recordings ready for tracking and analysis, with multiprocessing support for batch jobs.

๐Ÿ‘๏ธ YOLO Methods๏ƒ

Methods for training YOLO models, creating training and validation datasets, and converting behavioral neuroscience-specific datasets to YOLO datasets.

Uses the Ultralytics package.