Threshold-Free Network-Based Statistics in Neuroscience
TFNBS
TFNBS Toolbox is a Python package for computation and generation of network-based statistics for neuroscience data (i.e. fMRI, EEG data). The core concept is based on eliminating the use of a hardcoded threshold using threshold-free cluster enhancement (TFCE) scores to assess statistical significance. It works on the principle of networks, where TFCE statistical values are computed across a range of thresholds over n cycles of permutations to uncover possible significance in the data. Our implementation of TFNBS follows efficient computing and allows for computations to be performed on parallel cores therefore massively reducing computation time and resources.
Installation
TFNOS toolbox can be installed using:
!pip install tfnbs
Documentation
For more information on TFNBS's features, modules and usage, please refer to the official documentation.
Examples of usage on fMRI and EEG data are avaialble in notebooks and data.
Permutation p-values (compute_p_val)
The main entry point for permutation-based inference is tfnbs.pairwise_stats.compute_p_val.
Supported method values:
tstat: raw t-statistics (max-stat correction)tfnbs: threshold-free NBS / TFCE-style enhancementnbs: classical NBS with fixed threshold (nbs_stat="extent"or"intensity")cnbs: constrained NBS (requiresnet_labels)ni_tfnbs: network-informed TFNBS (requiresnet_labels)fbc_tfnbs: functional-block clustering TFNBS (requiresnet_labels)
Minimal example (two-sample):
from tfnbs.pairwise_stats import compute_p_val
from tfnbs.utils import fisher_r_to_z
# group1, group2: arrays of shape (n_subjects, N, N), symmetric, diagonal=0
group1_z = fisher_r_to_z(group1)
group2_z = fisher_r_to_z(group2)
p_vals = compute_p_val(
group1_z,
group2_z,
n_permutations=1000,
test_type="two-sample",
method="tfnbs",
use_mp=True,
)
Notes:
- Constrained methods (
cnbs,ni_tfnbs,fbc_tfnbs) requirenet_labels: ndarray[int]of shape(N,). - NBS uses
thresholdandnbs_stat; TFNBS-family usese,h,n, andstart_thres(plusmin_cluster_sizeforfbc_tfnbs).
Synthetic method-comparison example
See examples/sim_method_comparisons.py which compares all methods via compute_p_val and saves GT/t-stat/1-p heatmaps:
python examples/sim_method_comparisons.py --all-scenarios --effect-size 0.25 --time-points 50 --n-permutations 50
Citing the toolbox
To cite the toolbox, you can use: doi and refer to the paper paper_doi
[doi]
For further discussions or reports on bugs, please contact ashish@ireddy.ru
Metadata
Release files for TFNBS 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tfnbs-1.1.0.tar.gz | 48.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tfnbs-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 103.6 kB
Release files / tfnbs-1.1.0.tar.gz
| Download URL | tfnbs-1.1.0.tar.gz |
|---|---|
| Size | 48.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3ee15011db351883aaa07c6f91e1a443bbd6c4dd80993a2ea2cf7befc7c199ff
|
|
BLAKE2b-256 checksum How to use checksums |
f1207118dc3fd90ceb5c0130367bcd9fda928a2161a8eeedc7e8a5b3090f59d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Release files / tfnbs-1.1.0-py3-none-any.whl
| Download URL | tfnbs-1.1.0-py3-none-any.whl |
|---|---|
| Size | 55.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d8bcd54da663ac1f422849476578fbaf71f57835ee96e1348a0dda232d166c1f
|
|
BLAKE2b-256 checksum How to use checksums |
fb6bee7bdc283327073309a25b56b7503cc6c59b48e56171618e6933fd95ea55
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|