Skip to main content
braincontrol logo

braincontrol

braincontrol provides Network Control Theory (NCT) tools for neuroimaging data. Its main estimator, Transitioner, computes node-level control energy for transitions between brain states using the nctpy package, with support for NumPy, pandas, and Niimg-like state inputs.

Installation

pip install braincontrol

braincontrol requires Python 3.9 or newer.

Quick start

Transitioner follows a scikit-learn-style fit / transform workflow. Estimator parameters such as the time horizon and transition strategy are configured when the estimator is created. Empirical matrices and states are supplied to fit, transform, or fit_transform.

import numpy as np

from braincontrol.transitions import Transitioner

# Example network with three nodes.
A = np.array([
    [0.0, 0.4, 0.2],
    [0.4, 0.0, 0.3],
    [0.2, 0.3, 0.0],
])

# Rows are states, columns are nodes.
X = np.array([
    [1.0, 0.0, 0.0],
    [0.0, 1.0, 0.0],
    [0.0, 0.0, 1.0],
])

transitioner = Transitioner(
    T=1.0,
    transitions="directed",
)

energy = transitioner.fit_transform(
    A=A,
    X=X,
)

print(energy)

For unlabeled NumPy input, the returned energy has shape (n_transitions, n_nodes). If node or state labels are available, Transitioner preserves them in a pandas DataFrame.

Development

Install the development dependencies and run the test suite with:

python -m pytest -q

License

braincontrol is distributed under the MIT License.

Metadata

Release files for braincontrol 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for braincontrol 0.5.0
File Size Uploaded
braincontrol-0.5.0.tar.gz 27.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for braincontrol 0.5.0
File Interpreter ABI Platform
braincontrol-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 52.7 kB

Release files / braincontrol-0.5.0.tar.gz

Download URL braincontrol-0.5.0.tar.gz
Size 27.2 kB
Tags Source
SHA-256 checksum
How to use checksums
09fac588b5cd77bf83db41fc201dc7b3cfe372ad78d10d53ef0d72c9c8692dc1
BLAKE2b-256 checksum
How to use checksums
027301c89563d05baf541fd46ebe527da2161afd4b2c99d046ab3da84286cbf6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / braincontrol-0.5.0-py3-none-any.whl

Download URL braincontrol-0.5.0-py3-none-any.whl
Size 25.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d783945684ddbddf014f77286e58f6876496bca1310dbc882e80143c2f44e3b3
BLAKE2b-256 checksum
How to use checksums
fb0f7fd44304c23dc035460b69ae3e8f5e07eca40da8950734becec6a1caf98c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page