nltools 0.5.0__tar.gz → 0.6.0.dev0__tar.gz

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.
Files changed (196) hide show
  1. nltools-0.6.0.dev0/.gitignore +93 -0
  2. {nltools-0.5.0 → nltools-0.6.0.dev0}/LICENSE +1 -1
  3. nltools-0.6.0.dev0/PKG-INFO +95 -0
  4. nltools-0.6.0.dev0/README.md +51 -0
  5. nltools-0.6.0.dev0/nltools/__init__.py +55 -0
  6. nltools-0.6.0.dev0/nltools/algorithms/__init__.py +90 -0
  7. nltools-0.6.0.dev0/nltools/algorithms/alignment/__init__.py +21 -0
  8. nltools-0.6.0.dev0/nltools/algorithms/alignment/procrustes.py +565 -0
  9. nltools-0.6.0.dev0/nltools/algorithms/alignment/srm.py +758 -0
  10. nltools-0.6.0.dev0/nltools/algorithms/backends.py +1059 -0
  11. nltools-0.6.0.dev0/nltools/algorithms/corrections.py +177 -0
  12. nltools-0.6.0.dev0/nltools/algorithms/decoding.py +327 -0
  13. nltools-0.6.0.dev0/nltools/algorithms/inference/__init__.py +50 -0
  14. nltools-0.6.0.dev0/nltools/algorithms/inference/bootstrap.py +1386 -0
  15. nltools-0.6.0.dev0/nltools/algorithms/inference/correlation.py +373 -0
  16. nltools-0.6.0.dev0/nltools/algorithms/inference/intersubject.py +422 -0
  17. nltools-0.6.0.dev0/nltools/algorithms/inference/isc.py +1554 -0
  18. nltools-0.6.0.dev0/nltools/algorithms/inference/matrix.py +602 -0
  19. nltools-0.6.0.dev0/nltools/algorithms/inference/one_sample.py +288 -0
  20. nltools-0.6.0.dev0/nltools/algorithms/inference/random.py +122 -0
  21. nltools-0.6.0.dev0/nltools/algorithms/inference/timeseries.py +347 -0
  22. nltools-0.6.0.dev0/nltools/algorithms/inference/two_sample.py +212 -0
  23. nltools-0.6.0.dev0/nltools/algorithms/inference/utils.py +58 -0
  24. nltools-0.6.0.dev0/nltools/algorithms/inference/validation.py +282 -0
  25. nltools-0.6.0.dev0/nltools/algorithms/neighborhoods.py +207 -0
  26. nltools-0.6.0.dev0/nltools/algorithms/outliers.py +308 -0
  27. nltools-0.6.0.dev0/nltools/algorithms/regression.py +83 -0
  28. nltools-0.6.0.dev0/nltools/algorithms/signal.py +303 -0
  29. nltools-0.6.0.dev0/nltools/algorithms/similarity.py +234 -0
  30. nltools-0.6.0.dev0/nltools/algorithms/validation.py +151 -0
  31. nltools-0.6.0.dev0/nltools/cross_validation.py +72 -0
  32. nltools-0.6.0.dev0/nltools/data/__init__.py +30 -0
  33. nltools-0.6.0.dev0/nltools/data/adjacency/__init__.py +875 -0
  34. nltools-0.6.0.dev0/nltools/data/adjacency/io.py +111 -0
  35. nltools-0.6.0.dev0/nltools/data/adjacency/modeling.py +569 -0
  36. nltools-0.6.0.dev0/nltools/data/adjacency/plotting.py +174 -0
  37. nltools-0.6.0.dev0/nltools/data/adjacency/state.py +349 -0
  38. nltools-0.6.0.dev0/nltools/data/adjacency/stats.py +596 -0
  39. nltools-0.6.0.dev0/nltools/data/adjacency/utils.py +79 -0
  40. nltools-0.6.0.dev0/nltools/data/atlases/__init__.py +23 -0
  41. nltools-0.6.0.dev0/nltools/data/atlases/labeling.py +158 -0
  42. nltools-0.6.0.dev0/nltools/data/atlases/loading.py +76 -0
  43. nltools-0.6.0.dev0/nltools/data/atlases/registry.py +96 -0
  44. nltools-0.6.0.dev0/nltools/data/atlases/reporting.py +456 -0
  45. nltools-0.6.0.dev0/nltools/data/braindata/__init__.py +2170 -0
  46. nltools-0.6.0.dev0/nltools/data/braindata/analysis.py +1381 -0
  47. nltools-0.6.0.dev0/nltools/data/braindata/bootstrap.py +398 -0
  48. nltools-0.6.0.dev0/nltools/data/braindata/io.py +896 -0
  49. nltools-0.6.0.dev0/nltools/data/braindata/modeling.py +594 -0
  50. nltools-0.6.0.dev0/nltools/data/braindata/plotting.py +501 -0
  51. nltools-0.6.0.dev0/nltools/data/braindata/prediction.py +1250 -0
  52. nltools-0.6.0.dev0/nltools/data/braindata/utils.py +348 -0
  53. nltools-0.6.0.dev0/nltools/data/braindata/validation.py +197 -0
  54. nltools-0.6.0.dev0/nltools/data/braindata/viewer.js +266 -0
  55. nltools-0.6.0.dev0/nltools/data/braindata/viewer.py +770 -0
  56. nltools-0.6.0.dev0/nltools/data/combine.py +27 -0
  57. nltools-0.6.0.dev0/nltools/data/designmatrix/__init__.py +1032 -0
  58. nltools-0.6.0.dev0/nltools/data/designmatrix/append.py +518 -0
  59. nltools-0.6.0.dev0/nltools/data/designmatrix/diagnostics.py +248 -0
  60. nltools-0.6.0.dev0/nltools/data/designmatrix/io.py +356 -0
  61. nltools-0.6.0.dev0/nltools/data/designmatrix/plotting.py +291 -0
  62. nltools-0.6.0.dev0/nltools/data/designmatrix/regressors.py +463 -0
  63. nltools-0.6.0.dev0/nltools/data/designmatrix/transforms.py +200 -0
  64. nltools-0.6.0.dev0/nltools/data/designmatrix/utils.py +350 -0
  65. nltools-0.6.0.dev0/nltools/data/ownership.py +129 -0
  66. nltools-0.6.0.dev0/nltools/data/results.py +291 -0
  67. nltools-0.6.0.dev0/nltools/data/roc/__init__.py +398 -0
  68. nltools-0.5.0/nltools/simulator.py → nltools-0.6.0.dev0/nltools/data/simulator/__init__.py +346 -200
  69. nltools-0.6.0.dev0/nltools/data/simulator/haxby.py +124 -0
  70. nltools-0.6.0.dev0/nltools/data/validation.py +83 -0
  71. nltools-0.6.0.dev0/nltools/datasets.py +218 -0
  72. nltools-0.6.0.dev0/nltools/io/__init__.py +10 -0
  73. nltools-0.6.0.dev0/nltools/io/events.py +67 -0
  74. nltools-0.6.0.dev0/nltools/io/h5.py +246 -0
  75. nltools-0.6.0.dev0/nltools/mask.py +403 -0
  76. nltools-0.6.0.dev0/nltools/models/__init__.py +11 -0
  77. nltools-0.6.0.dev0/nltools/models/glm.py +543 -0
  78. nltools-0.6.0.dev0/nltools/models/results.py +49 -0
  79. nltools-0.6.0.dev0/nltools/models/ridge.py +1303 -0
  80. nltools-0.6.0.dev0/nltools/models/validation.py +26 -0
  81. nltools-0.6.0.dev0/nltools/plotting/__init__.py +32 -0
  82. nltools-0.6.0.dev0/nltools/plotting/adjacency.py +421 -0
  83. nltools-0.6.0.dev0/nltools/plotting/brain.py +669 -0
  84. nltools-0.6.0.dev0/nltools/plotting/decomposition.py +111 -0
  85. nltools-0.6.0.dev0/nltools/plotting/prediction.py +110 -0
  86. nltools-0.6.0.dev0/nltools/resources/onsets_example.csv +40 -0
  87. nltools-0.6.0.dev0/nltools/templates/__init__.py +51 -0
  88. nltools-0.6.0.dev0/nltools/templates/config.py +144 -0
  89. nltools-0.6.0.dev0/nltools/templates/fetch.py +260 -0
  90. nltools-0.6.0.dev0/nltools/templates/matching.py +183 -0
  91. nltools-0.6.0.dev0/nltools/templates/paths.py +106 -0
  92. nltools-0.6.0.dev0/nltools/templates/registry.py +25 -0
  93. nltools-0.6.0.dev0/nltools/tests/conftest.py +172 -0
  94. nltools-0.6.0.dev0/nltools/tests/core/__init__.py +0 -0
  95. nltools-0.6.0.dev0/nltools/tests/core/test_algorithms/__init__.py +6 -0
  96. nltools-0.6.0.dev0/nltools/tests/core/test_algorithms/conftest.py +86 -0
  97. nltools-0.6.0.dev0/nltools/tests/core/test_algorithms/test_corrections.py +68 -0
  98. nltools-0.6.0.dev0/nltools/tests/core/test_algorithms/test_decoding.py +219 -0
  99. nltools-0.6.0.dev0/nltools/tests/core/test_algorithms/test_intersubject.py +143 -0
  100. nltools-0.6.0.dev0/nltools/tests/core/test_algorithms/test_neighborhoods.py +137 -0
  101. nltools-0.6.0.dev0/nltools/tests/core/test_algorithms/test_outliers.py +279 -0
  102. nltools-0.6.0.dev0/nltools/tests/core/test_algorithms/test_procrustes.py +517 -0
  103. nltools-0.6.0.dev0/nltools/tests/core/test_algorithms/test_regression.py +117 -0
  104. nltools-0.6.0.dev0/nltools/tests/core/test_algorithms/test_signal.py +72 -0
  105. nltools-0.6.0.dev0/nltools/tests/core/test_algorithms/test_similarity.py +150 -0
  106. nltools-0.6.0.dev0/nltools/tests/core/test_backends.py +396 -0
  107. nltools-0.6.0.dev0/nltools/tests/core/test_bootstrap.py +700 -0
  108. nltools-0.6.0.dev0/nltools/tests/core/test_cross_validation.py +130 -0
  109. nltools-0.6.0.dev0/nltools/tests/core/test_gpu_policy.py +42 -0
  110. nltools-0.6.0.dev0/nltools/tests/core/test_hyperalignment.py +120 -0
  111. nltools-0.6.0.dev0/nltools/tests/core/test_inference/__init__.py +5 -0
  112. nltools-0.6.0.dev0/nltools/tests/core/test_inference/test_api_conventions.py +123 -0
  113. nltools-0.6.0.dev0/nltools/tests/core/test_inference/test_correlation.py +161 -0
  114. nltools-0.6.0.dev0/nltools/tests/core/test_inference/test_cpu_parallelization.py +84 -0
  115. nltools-0.6.0.dev0/nltools/tests/core/test_inference/test_isc_group.py +320 -0
  116. nltools-0.6.0.dev0/nltools/tests/core/test_inference/test_isc_vocabulary.py +97 -0
  117. nltools-0.6.0.dev0/nltools/tests/core/test_inference/test_matrix.py +299 -0
  118. nltools-0.6.0.dev0/nltools/tests/core/test_inference/test_one_sample.py +173 -0
  119. nltools-0.6.0.dev0/nltools/tests/core/test_inference/test_progress_bar.py +70 -0
  120. nltools-0.6.0.dev0/nltools/tests/core/test_inference/test_tail_vocabulary.py +138 -0
  121. nltools-0.6.0.dev0/nltools/tests/core/test_inference/test_timeseries.py +138 -0
  122. nltools-0.6.0.dev0/nltools/tests/core/test_inference/test_two_sample.py +113 -0
  123. nltools-0.6.0.dev0/nltools/tests/core/test_inference/test_utils.py +126 -0
  124. nltools-0.6.0.dev0/nltools/tests/core/test_isc.py +502 -0
  125. nltools-0.6.0.dev0/nltools/tests/core/test_mask.py +207 -0
  126. nltools-0.6.0.dev0/nltools/tests/core/test_srm.py +262 -0
  127. nltools-0.6.0.dev0/nltools/tests/core/test_utils.py +23 -0
  128. nltools-0.6.0.dev0/nltools/tests/datasets/__init__.py +0 -0
  129. nltools-0.6.0.dev0/nltools/tests/datasets/test_datasets.py +176 -0
  130. nltools-0.6.0.dev0/nltools/tests/io_tests/__init__.py +0 -0
  131. nltools-0.6.0.dev0/nltools/tests/io_tests/test_file_reader.py +170 -0
  132. nltools-0.6.0.dev0/nltools/tests/io_tests/test_h5.py +104 -0
  133. nltools-0.6.0.dev0/nltools/tests/models/__init__.py +0 -0
  134. nltools-0.6.0.dev0/nltools/tests/models/conftest.py +47 -0
  135. nltools-0.6.0.dev0/nltools/tests/models/test_glm.py +259 -0
  136. nltools-0.6.0.dev0/nltools/tests/models/test_glm_warnings.py +49 -0
  137. nltools-0.6.0.dev0/nltools/tests/models/test_results.py +82 -0
  138. nltools-0.6.0.dev0/nltools/tests/models/test_ridge.py +501 -0
  139. nltools-0.6.0.dev0/nltools/tests/plotting/__init__.py +0 -0
  140. nltools-0.6.0.dev0/nltools/tests/plotting/test_adjacency.py +184 -0
  141. nltools-0.6.0.dev0/nltools/tests/plotting/test_f123_prediction.py +56 -0
  142. nltools-0.6.0.dev0/nltools/tests/plotting/test_surface.py +158 -0
  143. nltools-0.6.0.dev0/nltools/tests/pyodide/.gitignore +4 -0
  144. nltools-0.6.0.dev0/nltools/tests/pyodide/test_runner.mjs +284 -0
  145. nltools-0.6.0.dev0/nltools/tests/support/__init__.py +0 -0
  146. nltools-0.6.0.dev0/nltools/tests/support/test_designation.py +71 -0
  147. nltools-0.6.0.dev0/nltools/tests/templates/__init__.py +0 -0
  148. nltools-0.6.0.dev0/nltools/tests/templates/test_brainspace.py +247 -0
  149. nltools-0.6.0.dev0/nltools/tests/templates/test_fetch_pyodide.py +168 -0
  150. nltools-0.6.0.dev0/nltools/tests/utils/__init__.py +0 -0
  151. nltools-0.6.0.dev0/nltools/tests/utils/test_utils.py +53 -0
  152. nltools-0.6.0.dev0/nltools/utils.py +230 -0
  153. nltools-0.6.0.dev0/nltools/version.py +13 -0
  154. nltools-0.6.0.dev0/pyproject.toml +377 -0
  155. nltools-0.5.0/MANIFEST.in +0 -2
  156. nltools-0.5.0/PKG-INFO +0 -33
  157. nltools-0.5.0/README.md +0 -40
  158. nltools-0.5.0/nltools/__init__.py +0 -24
  159. nltools-0.5.0/nltools/analysis.py +0 -326
  160. nltools-0.5.0/nltools/cross_validation.py +0 -141
  161. nltools-0.5.0/nltools/data/__init__.py +0 -15
  162. nltools-0.5.0/nltools/data/adjacency.py +0 -1889
  163. nltools-0.5.0/nltools/data/brain_data.py +0 -2325
  164. nltools-0.5.0/nltools/data/design_matrix.py +0 -818
  165. nltools-0.5.0/nltools/datasets.py +0 -155
  166. nltools-0.5.0/nltools/external/__init__.py +0 -12
  167. nltools-0.5.0/nltools/external/hrf.py +0 -210
  168. nltools-0.5.0/nltools/external/srm.py +0 -823
  169. nltools-0.5.0/nltools/file_reader.py +0 -167
  170. nltools-0.5.0/nltools/mask.py +0 -243
  171. nltools-0.5.0/nltools/plotting.py +0 -840
  172. nltools-0.5.0/nltools/prefs.py +0 -148
  173. nltools-0.5.0/nltools/resources/MNI152_T1_2mm.nii.gz +0 -0
  174. nltools-0.5.0/nltools/resources/MNI152_T1_2mm_brain.nii.gz +0 -0
  175. nltools-0.5.0/nltools/resources/MNI152_T1_2mm_brain_mask.nii.gz +0 -0
  176. nltools-0.5.0/nltools/resources/MNI152_T1_2mm_brain_mask_no_ventricles.nii.gz +0 -0
  177. nltools-0.5.0/nltools/resources/MNI152_T1_3mm.nii.gz +0 -0
  178. nltools-0.5.0/nltools/resources/MNI152_T1_3mm_brain.nii.gz +0 -0
  179. nltools-0.5.0/nltools/resources/MNI152_T1_3mm_brain_mask.nii.gz +0 -0
  180. nltools-0.5.0/nltools/resources/MNI152_T1_3mm_brain_mask_no_ventricles.nii.gz +0 -0
  181. nltools-0.5.0/nltools/resources/gm_mask_2mm.nii.gz +0 -0
  182. nltools-0.5.0/nltools/resources/gm_mask_3mm.nii.gz +0 -0
  183. nltools-0.5.0/nltools/resources/onsets_example.txt +0 -40
  184. nltools-0.5.0/nltools/resources/onsets_example_with_dur.txt +0 -109
  185. nltools-0.5.0/nltools/stats.py +0 -2571
  186. nltools-0.5.0/nltools/utils.py +0 -396
  187. nltools-0.5.0/nltools/version.py +0 -4
  188. nltools-0.5.0/nltools.egg-info/PKG-INFO +0 -33
  189. nltools-0.5.0/nltools.egg-info/SOURCES.txt +0 -43
  190. nltools-0.5.0/nltools.egg-info/dependency_links.txt +0 -1
  191. nltools-0.5.0/nltools.egg-info/requires.txt +0 -14
  192. nltools-0.5.0/nltools.egg-info/top_level.txt +0 -1
  193. nltools-0.5.0/requirements.txt +0 -11
  194. nltools-0.5.0/setup.cfg +0 -14
  195. nltools-0.5.0/setup.py +0 -41
  196. {nltools-0.5.0 → nltools-0.6.0.dev0}/nltools/resources/covariates_example.csv +0 -0
@@ -0,0 +1,93 @@
1
+ # Python Related #
2
+ ###################
3
+ *.pyc
4
+ *.log
5
+ *.egg*
6
+ build/
7
+ dist/
8
+ .cache/
9
+ htmlcov
10
+ .pytest_cache/*
11
+ dev/
12
+ # Logs and databases #
13
+ ######################
14
+ *.log
15
+ *.sql
16
+ *.sqlite
17
+ *.json
18
+
19
+ # iPython Notebook Caches #
20
+ ###########################
21
+ .ipynb_checkpoints
22
+
23
+ # OS generated files #
24
+ ######################
25
+ .DS_Store
26
+ .DS_Store?
27
+ ._*
28
+ .Spotlight-V100
29
+ .Trashes
30
+ thumbs.db
31
+ Thumbs.db
32
+
33
+ # Tests & Coverage
34
+ ##################
35
+ .coverage
36
+ htmlcov/
37
+ .pytest_cache
38
+
39
+ # PyCharm
40
+ #########
41
+ .idea
42
+
43
+ # TOX
44
+ #####
45
+ .tox
46
+ .tox/*
47
+
48
+ # Docs
49
+ ######
50
+ examples/**/*.nii.gz
51
+ data.nii.gz
52
+ environment.yml
53
+ rep_id.csv
54
+ y.csv
55
+ env
56
+ .vscode/settings.json
57
+ .vscode/bookmarks.json
58
+ dev.py
59
+ dev.ipynb
60
+ .venv
61
+ docs/**/*.nii.gz
62
+ .ruff_cache/
63
+ audit/
64
+ claude-research/
65
+
66
+ # Nifti templates + parcellations — fetched lazily from
67
+ # https://huggingface.co/datasets/nltools/niftis on first use
68
+ nltools/resources/niftis/
69
+
70
+ *.db
71
+ scripts/sub-*
72
+ *.nii.gz
73
+ scratch/
74
+ .playwright-cli/
75
+ **/__pycache__/
76
+ .kata.local.toml
77
+
78
+ # Zensical site output
79
+ /site/
80
+
81
+ # Tutorial pages: build artifacts generated from the marimo notebooks beside
82
+ # them by scripts/marimo_to_zensical.py (`uv run poe docs-generate`). The
83
+ # patterns match the notebooks (scripts/marimo_to_zensical.py TUTORIAL_GLOBS),
84
+ # so a hand-written page in either directory is still tracked.
85
+ docs/tutorials/basics/[0-9]*_*.md
86
+ docs/tutorials/data-operations/[0-9]*_*.md
87
+ docs/tutorials/analysis/[0-9]*_*.md
88
+ docs/tutorials/workflows/[0-9]*_*.md
89
+
90
+ # The tutorials' joblib fit cache, `Memory(".tutorial-cache")`, and the recorded
91
+ # page outputs docs_show replays (pages/). Deliberately not under .cache/, which
92
+ # is zensical's and which `zensical build -c` wipes whole.
93
+ /.tutorial-cache/
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015-2018 Cosan Lab
3
+ Copyright (c) 2015-2026 Cosan Lab & SciMinds Research Studio
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,95 @@
1
+ Metadata-Version: 2.5
2
+ Name: nltools
3
+ Version: 0.6.0.dev0
4
+ Summary: A Python package to analyze neuroimaging data
5
+ Project-URL: Homepage, https://nltools.org
6
+ Author-email: "Luke J. Chang" <luke.j.chang@dartmouth.edu>, Eshin Jolly <eshin.jolly@gmail.com>
7
+ License: MIT
8
+ License-File: LICENSE
9
+ Keywords: analysis,machine-learning,neuroimaging,preprocessing
10
+ Classifier: Intended Audience :: Science/Research
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Requires-Python: >=3.11
17
+ Requires-Dist: anywidget>=0.9
18
+ Requires-Dist: h5py>=3.13
19
+ Requires-Dist: himalaya<0.5,>=0.4.11
20
+ Requires-Dist: huggingface-hub>=0.30
21
+ Requires-Dist: joblib>=1.5.3
22
+ Requires-Dist: matplotlib>=3.8.0
23
+ Requires-Dist: nibabel>=5.2.0
24
+ Requires-Dist: nilearn>=0.14.1
25
+ Requires-Dist: numpy>=2.0.2
26
+ Requires-Dist: pandas>=2.3.0
27
+ Requires-Dist: polars>=1.33.1
28
+ Requires-Dist: pynv>=0.3
29
+ Requires-Dist: scikit-learn>=1.8
30
+ Requires-Dist: scipy>=1.11.1
31
+ Requires-Dist: seaborn>=0.13.2
32
+ Requires-Dist: tqdm>=4.67.1
33
+ Provides-Extra: all
34
+ Requires-Dist: h5py>=3.13; extra == 'all'
35
+ Requires-Dist: ipywidgets>=8.1.7; extra == 'all'
36
+ Requires-Dist: networkx>=3.5; extra == 'all'
37
+ Provides-Extra: graph
38
+ Requires-Dist: networkx>=3.5; extra == 'graph'
39
+ Provides-Extra: h5
40
+ Requires-Dist: h5py>=3.13; extra == 'h5'
41
+ Provides-Extra: interactive-plots
42
+ Requires-Dist: ipywidgets>=8.1.7; extra == 'interactive-plots'
43
+ Description-Content-Type: text/markdown
44
+
45
+ [![Package versioning](https://img.shields.io/pypi/v/nltools.svg)](https://pypi.org/project/nltools/)
46
+ [![CI](https://github.com/cosanlab/nltools/actions/workflows/ci.yml/badge.svg)](https://github.com/cosanlab/nltools/actions/workflows/ci.yml)
47
+ [![codecov](https://codecov.io/gh/cosanlab/nltools/branch/master/graph/badge.svg)](https://codecov.io/gh/cosanlab/nltools)
48
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.2229813.svg)](https://doi.org/10.5281/zenodo.2229813)
49
+ ![Python Versions](https://img.shields.io/badge/python-3.11%20%7C%203.12%20%7C%203.13-blue)
50
+ ![Platforms](https://img.shields.io/badge/platform-linux%20%7C%20osx%20%7C%20win-blue)
51
+
52
+ # NLTools
53
+
54
+ Python toolbox for analyzing neuroimaging data, with a focus on multivariate analyses. It grew out of Tor Wager's object-oriented Matlab [CANlab core tools](http://wagerlab.colorado.edu/tools) and builds on [nilearn](https://nilearn.github.io) and [scikit-learn](https://scikit-learn.org). Requires Python 3.11+.
55
+
56
+ ## Documentation
57
+
58
+ Documentation and tutorials are available at https://nltools.org
59
+
60
+ ## Installation
61
+
62
+ With [uv](https://docs.astral.sh/uv/) (recommended, for use in a project):
63
+
64
+ ```
65
+ uv add nltools
66
+ ```
67
+
68
+ Or with pip:
69
+
70
+ ```
71
+ pip install nltools
72
+ ```
73
+
74
+ ## Development
75
+
76
+ `uv` manages the whole workflow — it creates the virtual environment, installs core and development dependencies, and installs `nltools` into it in editable mode.
77
+
78
+ ```
79
+ git clone https://github.com/cosanlab/nltools
80
+ cd nltools
81
+ uv sync
82
+ ```
83
+
84
+ Common tasks (run via [poe](https://poethepoet.natn.io/), all prefixed with `uv run`):
85
+
86
+ | Command | What it does |
87
+ |---|---|
88
+ | `uv run poe lint` | Fix, format, and type-check (ruff + ty) |
89
+ | `uv run poe test` | Run the fast test suite in parallel |
90
+ | `uv run pytest -k test_name` | Run a specific test |
91
+ | `uv run poe docs-serve` | Live-preview the docs site at localhost:8000 (executes tutorials via the cache) |
92
+ | `uv run poe docs-build` | Full docs build (API reference + executed tutorials) |
93
+ | `uv run poe tutorials` | Run every tutorial notebook end-to-end |
94
+ | `uv build` | Build the package locally |
95
+ | `uv add/remove [--dev] pkg` | Add or remove a (dev) dependency |
@@ -0,0 +1,51 @@
1
+ [![Package versioning](https://img.shields.io/pypi/v/nltools.svg)](https://pypi.org/project/nltools/)
2
+ [![CI](https://github.com/cosanlab/nltools/actions/workflows/ci.yml/badge.svg)](https://github.com/cosanlab/nltools/actions/workflows/ci.yml)
3
+ [![codecov](https://codecov.io/gh/cosanlab/nltools/branch/master/graph/badge.svg)](https://codecov.io/gh/cosanlab/nltools)
4
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.2229813.svg)](https://doi.org/10.5281/zenodo.2229813)
5
+ ![Python Versions](https://img.shields.io/badge/python-3.11%20%7C%203.12%20%7C%203.13-blue)
6
+ ![Platforms](https://img.shields.io/badge/platform-linux%20%7C%20osx%20%7C%20win-blue)
7
+
8
+ # NLTools
9
+
10
+ Python toolbox for analyzing neuroimaging data, with a focus on multivariate analyses. It grew out of Tor Wager's object-oriented Matlab [CANlab core tools](http://wagerlab.colorado.edu/tools) and builds on [nilearn](https://nilearn.github.io) and [scikit-learn](https://scikit-learn.org). Requires Python 3.11+.
11
+
12
+ ## Documentation
13
+
14
+ Documentation and tutorials are available at https://nltools.org
15
+
16
+ ## Installation
17
+
18
+ With [uv](https://docs.astral.sh/uv/) (recommended, for use in a project):
19
+
20
+ ```
21
+ uv add nltools
22
+ ```
23
+
24
+ Or with pip:
25
+
26
+ ```
27
+ pip install nltools
28
+ ```
29
+
30
+ ## Development
31
+
32
+ `uv` manages the whole workflow — it creates the virtual environment, installs core and development dependencies, and installs `nltools` into it in editable mode.
33
+
34
+ ```
35
+ git clone https://github.com/cosanlab/nltools
36
+ cd nltools
37
+ uv sync
38
+ ```
39
+
40
+ Common tasks (run via [poe](https://poethepoet.natn.io/), all prefixed with `uv run`):
41
+
42
+ | Command | What it does |
43
+ |---|---|
44
+ | `uv run poe lint` | Fix, format, and type-check (ruff + ty) |
45
+ | `uv run poe test` | Run the fast test suite in parallel |
46
+ | `uv run pytest -k test_name` | Run a specific test |
47
+ | `uv run poe docs-serve` | Live-preview the docs site at localhost:8000 (executes tutorials via the cache) |
48
+ | `uv run poe docs-build` | Full docs build (API reference + executed tutorials) |
49
+ | `uv run poe tutorials` | Run every tutorial notebook end-to-end |
50
+ | `uv build` | Build the package locally |
51
+ | `uv add/remove [--dev] pkg` | Add or remove a (dev) dependency |
@@ -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
+ )