nltools 0.6.0.dev0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nltools/__init__.py +55 -0
- nltools/algorithms/__init__.py +90 -0
- nltools/algorithms/alignment/__init__.py +21 -0
- nltools/algorithms/alignment/procrustes.py +565 -0
- nltools/algorithms/alignment/srm.py +758 -0
- nltools/algorithms/backends.py +1059 -0
- nltools/algorithms/corrections.py +177 -0
- nltools/algorithms/decoding.py +327 -0
- nltools/algorithms/inference/__init__.py +50 -0
- nltools/algorithms/inference/bootstrap.py +1386 -0
- nltools/algorithms/inference/correlation.py +373 -0
- nltools/algorithms/inference/intersubject.py +422 -0
- nltools/algorithms/inference/isc.py +1554 -0
- nltools/algorithms/inference/matrix.py +602 -0
- nltools/algorithms/inference/one_sample.py +288 -0
- nltools/algorithms/inference/random.py +122 -0
- nltools/algorithms/inference/timeseries.py +347 -0
- nltools/algorithms/inference/two_sample.py +212 -0
- nltools/algorithms/inference/utils.py +58 -0
- nltools/algorithms/inference/validation.py +282 -0
- nltools/algorithms/neighborhoods.py +207 -0
- nltools/algorithms/outliers.py +308 -0
- nltools/algorithms/regression.py +83 -0
- nltools/algorithms/signal.py +303 -0
- nltools/algorithms/similarity.py +234 -0
- nltools/algorithms/validation.py +151 -0
- nltools/cross_validation.py +72 -0
- nltools/data/__init__.py +30 -0
- nltools/data/adjacency/__init__.py +875 -0
- nltools/data/adjacency/io.py +111 -0
- nltools/data/adjacency/modeling.py +569 -0
- nltools/data/adjacency/plotting.py +174 -0
- nltools/data/adjacency/state.py +349 -0
- nltools/data/adjacency/stats.py +596 -0
- nltools/data/adjacency/utils.py +79 -0
- nltools/data/atlases/__init__.py +23 -0
- nltools/data/atlases/labeling.py +158 -0
- nltools/data/atlases/loading.py +76 -0
- nltools/data/atlases/registry.py +96 -0
- nltools/data/atlases/reporting.py +456 -0
- nltools/data/braindata/__init__.py +2170 -0
- nltools/data/braindata/analysis.py +1381 -0
- nltools/data/braindata/bootstrap.py +398 -0
- nltools/data/braindata/io.py +896 -0
- nltools/data/braindata/modeling.py +594 -0
- nltools/data/braindata/plotting.py +501 -0
- nltools/data/braindata/prediction.py +1250 -0
- nltools/data/braindata/utils.py +348 -0
- nltools/data/braindata/validation.py +197 -0
- nltools/data/braindata/viewer.js +266 -0
- nltools/data/braindata/viewer.py +770 -0
- nltools/data/combine.py +27 -0
- nltools/data/designmatrix/__init__.py +1032 -0
- nltools/data/designmatrix/append.py +518 -0
- nltools/data/designmatrix/diagnostics.py +248 -0
- nltools/data/designmatrix/io.py +356 -0
- nltools/data/designmatrix/plotting.py +291 -0
- nltools/data/designmatrix/regressors.py +463 -0
- nltools/data/designmatrix/transforms.py +200 -0
- nltools/data/designmatrix/utils.py +350 -0
- nltools/data/ownership.py +129 -0
- nltools/data/results.py +291 -0
- nltools/data/roc/__init__.py +398 -0
- nltools/data/simulator/__init__.py +927 -0
- nltools/data/simulator/haxby.py +124 -0
- nltools/data/validation.py +83 -0
- nltools/datasets.py +218 -0
- nltools/io/__init__.py +10 -0
- nltools/io/events.py +67 -0
- nltools/io/h5.py +246 -0
- nltools/mask.py +403 -0
- nltools/models/__init__.py +11 -0
- nltools/models/glm.py +543 -0
- nltools/models/results.py +49 -0
- nltools/models/ridge.py +1303 -0
- nltools/models/validation.py +26 -0
- nltools/plotting/__init__.py +32 -0
- nltools/plotting/adjacency.py +421 -0
- nltools/plotting/brain.py +669 -0
- nltools/plotting/decomposition.py +111 -0
- nltools/plotting/prediction.py +110 -0
- nltools/resources/covariates_example.csv +161 -0
- nltools/resources/onsets_example.csv +40 -0
- nltools/templates/__init__.py +51 -0
- nltools/templates/config.py +144 -0
- nltools/templates/fetch.py +260 -0
- nltools/templates/matching.py +183 -0
- nltools/templates/paths.py +106 -0
- nltools/templates/registry.py +25 -0
- nltools/utils.py +230 -0
- nltools/version.py +13 -0
- nltools-0.6.0.dev0.dist-info/METADATA +95 -0
- nltools-0.6.0.dev0.dist-info/RECORD +95 -0
- nltools-0.6.0.dev0.dist-info/WHEEL +4 -0
- nltools-0.6.0.dev0.dist-info/licenses/LICENSE +21 -0
nltools/__init__.py
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"""nltools: a Python toolbox for analyzing neuroimaging data.
|
|
2
|
+
|
|
3
|
+
Focused on multivariate analyses and built on top of nilearn and scikit-learn,
|
|
4
|
+
nltools provides high-level data classes — `BrainData`, `Adjacency`, and
|
|
5
|
+
`DesignMatrix` — that wrap common neuroimaging workflows, alongside a
|
|
6
|
+
functional core of statistics and algorithms (`nltools.algorithms`) that the
|
|
7
|
+
data classes delegate to.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"Adjacency",
|
|
12
|
+
"BrainData",
|
|
13
|
+
"DesignMatrix",
|
|
14
|
+
"Roc",
|
|
15
|
+
"SimulateGrid",
|
|
16
|
+
"Simulator",
|
|
17
|
+
"__version__",
|
|
18
|
+
"concatenate",
|
|
19
|
+
"get_brainspace",
|
|
20
|
+
"reset_brainspace",
|
|
21
|
+
"set_brainspace",
|
|
22
|
+
"with_brainspace",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
from .data import (
|
|
26
|
+
BrainData,
|
|
27
|
+
Adjacency,
|
|
28
|
+
DesignMatrix,
|
|
29
|
+
Simulator,
|
|
30
|
+
SimulateGrid,
|
|
31
|
+
Roc,
|
|
32
|
+
)
|
|
33
|
+
from .data.combine import concatenate
|
|
34
|
+
from .templates import (
|
|
35
|
+
get_brainspace,
|
|
36
|
+
set_brainspace,
|
|
37
|
+
reset_brainspace,
|
|
38
|
+
with_brainspace,
|
|
39
|
+
)
|
|
40
|
+
from .version import __version__
|
|
41
|
+
|
|
42
|
+
# Bind the submodules users reach through attribute access (e.g.
|
|
43
|
+
# nltools.datasets, nltools.cross_validation) so no prior explicit
|
|
44
|
+
# `import nltools.datasets` is needed. They are not part of the advertised
|
|
45
|
+
# surface; the names in __all__ above are.
|
|
46
|
+
from . import ( # noqa: F401
|
|
47
|
+
algorithms,
|
|
48
|
+
cross_validation,
|
|
49
|
+
data,
|
|
50
|
+
datasets,
|
|
51
|
+
io,
|
|
52
|
+
mask,
|
|
53
|
+
plotting,
|
|
54
|
+
utils,
|
|
55
|
+
)
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"""nltools.algorithms — the functional core of nltools.
|
|
2
|
+
|
|
3
|
+
Every user-facing statistical function and algorithm is importable flat from
|
|
4
|
+
here (`from nltools.algorithms import fdr, zscore, isc`), organized into
|
|
5
|
+
focused submodules underneath:
|
|
6
|
+
|
|
7
|
+
- **corrections**: multiple-comparison corrections (FDR, Holm-Bonferroni, thresholding)
|
|
8
|
+
- **outliers**: outlier detection, winsorizing, z-scoring
|
|
9
|
+
- **signal**: temporal signal processing (resampling, filtering, basis functions)
|
|
10
|
+
- **similarity**: similarity metrics and Fisher transforms
|
|
11
|
+
- **regression**: standalone OLS regression on numpy arrays
|
|
12
|
+
- **alignment**: the `align`/`procrustes` entry points and the shared-response
|
|
13
|
+
estimators behind them
|
|
14
|
+
- **inference**: permutation tests, bootstrap resampling, and intersubject
|
|
15
|
+
statistics (ISC/ISFC/ISPS), parallelized across joblib workers
|
|
16
|
+
- **backends**: device selection and memory budgeting for the ridge paths;
|
|
17
|
+
`check_gpu_available` is how you ask before requesting `device='gpu'`
|
|
18
|
+
|
|
19
|
+
Ridge regression lives in `nltools.models.Ridge`, which delegates its numerics
|
|
20
|
+
to the Himalaya library and is reached through `BrainData.fit(model='ridge')`.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
__all__ = [
|
|
24
|
+
"align",
|
|
25
|
+
"align_states",
|
|
26
|
+
"calc_bpm",
|
|
27
|
+
"check_gpu_available",
|
|
28
|
+
"circle_shift",
|
|
29
|
+
"compute_searchlight_neighborhoods",
|
|
30
|
+
"compute_similarity",
|
|
31
|
+
"correlation_permutation_test",
|
|
32
|
+
"distance_correlation",
|
|
33
|
+
"downsample",
|
|
34
|
+
"fdr",
|
|
35
|
+
"find_spikes",
|
|
36
|
+
"fisher_r_to_z",
|
|
37
|
+
"fisher_z_to_r",
|
|
38
|
+
"holm_bonf",
|
|
39
|
+
"isc",
|
|
40
|
+
"isc_group",
|
|
41
|
+
"isfc",
|
|
42
|
+
"isps",
|
|
43
|
+
"make_cosine_basis",
|
|
44
|
+
"matrix_permutation_test",
|
|
45
|
+
"multi_threshold",
|
|
46
|
+
"one_sample_permutation_test",
|
|
47
|
+
"phase_randomize",
|
|
48
|
+
"procrustes",
|
|
49
|
+
"procrustes_distance",
|
|
50
|
+
"regress",
|
|
51
|
+
"threshold",
|
|
52
|
+
"transform_pairwise",
|
|
53
|
+
"trim",
|
|
54
|
+
"two_sample_permutation_test",
|
|
55
|
+
"upsample",
|
|
56
|
+
"winsorize",
|
|
57
|
+
"zscore",
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
from .alignment import (
|
|
61
|
+
align,
|
|
62
|
+
align_states,
|
|
63
|
+
procrustes,
|
|
64
|
+
procrustes_distance,
|
|
65
|
+
)
|
|
66
|
+
from .backends import check_gpu_available
|
|
67
|
+
from .corrections import fdr, holm_bonf, multi_threshold, threshold
|
|
68
|
+
from .neighborhoods import compute_searchlight_neighborhoods
|
|
69
|
+
from .inference import (
|
|
70
|
+
circle_shift,
|
|
71
|
+
correlation_permutation_test,
|
|
72
|
+
distance_correlation,
|
|
73
|
+
matrix_permutation_test,
|
|
74
|
+
one_sample_permutation_test,
|
|
75
|
+
phase_randomize,
|
|
76
|
+
two_sample_permutation_test,
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
# Imported from the submodule, not the `inference` package namespace: exporting
|
|
80
|
+
# the `isc` *function* there would shadow the `inference.isc` engine *module*.
|
|
81
|
+
from .inference.intersubject import isc, isc_group, isfc, isps
|
|
82
|
+
from .outliers import find_spikes, trim, winsorize, zscore
|
|
83
|
+
from .regression import regress
|
|
84
|
+
from .signal import calc_bpm, downsample, make_cosine_basis, upsample
|
|
85
|
+
from .similarity import (
|
|
86
|
+
compute_similarity,
|
|
87
|
+
fisher_r_to_z,
|
|
88
|
+
fisher_z_to_r,
|
|
89
|
+
transform_pairwise,
|
|
90
|
+
)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""Multi-subject functional alignment algorithms.
|
|
2
|
+
|
|
3
|
+
Algorithms for aligning functional data across subjects:
|
|
4
|
+
|
|
5
|
+
- **SRM** / **DetSRM**: Shared Response Model (Chen et al. 2015)
|
|
6
|
+
- **align**: whole-brain alignment of a group of subjects, by SRM or by
|
|
7
|
+
Procrustes-based hyperalignment (Haxby et al. 2011)
|
|
8
|
+
- **procrustes** / **procrustes_distance**: pairwise Procrustes superposition
|
|
9
|
+
and its permutation test
|
|
10
|
+
- **align_states**: match two sets of state weight maps
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
# Internal package: these imports are re-exports for the rest of nltools, not
|
|
14
|
+
# an advertised surface, so there is no `__all__` to mark them as used.
|
|
15
|
+
from .srm import _SRM, _DetSRM # noqa: F401
|
|
16
|
+
from .procrustes import ( # noqa: F401
|
|
17
|
+
align,
|
|
18
|
+
align_states,
|
|
19
|
+
procrustes,
|
|
20
|
+
procrustes_distance,
|
|
21
|
+
)
|