htfa 0.1.0__tar.gz → 0.2.0__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 (64) hide show
  1. {htfa-0.1.0 → htfa-0.2.0}/PKG-INFO +37 -1
  2. {htfa-0.1.0 → htfa-0.2.0}/README.md +36 -0
  3. {htfa-0.1.0 → htfa-0.2.0}/htfa/__init__.py +3 -2
  4. {htfa-0.1.0 → htfa-0.2.0}/htfa/brainnet.py +1415 -148
  5. {htfa-0.1.0 → htfa-0.2.0}/htfa/results.py +11 -5
  6. {htfa-0.1.0 → htfa-0.2.0}/htfa.egg-info/PKG-INFO +37 -1
  7. {htfa-0.1.0 → htfa-0.2.0}/pyproject.toml +1 -1
  8. htfa-0.2.0/tests/test_brainnet.py +4459 -0
  9. htfa-0.2.0/tests/test_package.py +10 -0
  10. {htfa-0.1.0 → htfa-0.2.0}/tests/test_stats.py +35 -4
  11. htfa-0.1.0/tests/test_brainnet.py +0 -1669
  12. htfa-0.1.0/tests/test_package.py +0 -10
  13. {htfa-0.1.0 → htfa-0.2.0}/LICENSE +0 -0
  14. {htfa-0.1.0 → htfa-0.2.0}/htfa/_download.py +0 -0
  15. {htfa-0.1.0 → htfa-0.2.0}/htfa/_engines.py +0 -0
  16. {htfa-0.1.0 → htfa-0.2.0}/htfa/_kernels.py +0 -0
  17. {htfa-0.1.0 → htfa-0.2.0}/htfa/_lazy.py +0 -0
  18. {htfa-0.1.0 → htfa-0.2.0}/htfa/_matching.py +0 -0
  19. {htfa-0.1.0 → htfa-0.2.0}/htfa/_spatial.py +0 -0
  20. {htfa-0.1.0 → htfa-0.2.0}/htfa/_validation.py +0 -0
  21. {htfa-0.1.0 → htfa-0.2.0}/htfa/connectivity.py +0 -0
  22. {htfa-0.1.0 → htfa-0.2.0}/htfa/datasets.py +0 -0
  23. {htfa-0.1.0 → htfa-0.2.0}/htfa/fit.py +0 -0
  24. {htfa-0.1.0 → htfa-0.2.0}/htfa/groups.py +0 -0
  25. {htfa-0.1.0 → htfa-0.2.0}/htfa/htfa.py +0 -0
  26. {htfa-0.1.0 → htfa-0.2.0}/htfa/io.py +0 -0
  27. {htfa-0.1.0 → htfa-0.2.0}/htfa/stats.py +0 -0
  28. {htfa-0.1.0 → htfa-0.2.0}/htfa/synthetic.py +0 -0
  29. {htfa-0.1.0 → htfa-0.2.0}/htfa/tfa.py +0 -0
  30. {htfa-0.1.0 → htfa-0.2.0}/htfa/timecourse.py +0 -0
  31. {htfa-0.1.0 → htfa-0.2.0}/htfa.egg-info/SOURCES.txt +0 -0
  32. {htfa-0.1.0 → htfa-0.2.0}/htfa.egg-info/dependency_links.txt +0 -0
  33. {htfa-0.1.0 → htfa-0.2.0}/htfa.egg-info/requires.txt +0 -0
  34. {htfa-0.1.0 → htfa-0.2.0}/htfa.egg-info/top_level.txt +0 -0
  35. {htfa-0.1.0 → htfa-0.2.0}/setup.cfg +0 -0
  36. {htfa-0.1.0 → htfa-0.2.0}/tests/test_brainiak_crosscheck.py +0 -0
  37. {htfa-0.1.0 → htfa-0.2.0}/tests/test_component_plots.py +0 -0
  38. {htfa-0.1.0 → htfa-0.2.0}/tests/test_connectivity.py +0 -0
  39. {htfa-0.1.0 → htfa-0.2.0}/tests/test_datasets.py +0 -0
  40. {htfa-0.1.0 → htfa-0.2.0}/tests/test_docs.py +0 -0
  41. {htfa-0.1.0 → htfa-0.2.0}/tests/test_engines.py +0 -0
  42. {htfa-0.1.0 → htfa-0.2.0}/tests/test_equivalence.py +0 -0
  43. {htfa-0.1.0 → htfa-0.2.0}/tests/test_fast_mode.py +0 -0
  44. {htfa-0.1.0 → htfa-0.2.0}/tests/test_fit.py +0 -0
  45. {htfa-0.1.0 → htfa-0.2.0}/tests/test_fit_equivalence.py +0 -0
  46. {htfa-0.1.0 → htfa-0.2.0}/tests/test_folder_hierarchy.py +0 -0
  47. {htfa-0.1.0 → htfa-0.2.0}/tests/test_gpu_accuracy.py +0 -0
  48. {htfa-0.1.0 → htfa-0.2.0}/tests/test_groups.py +0 -0
  49. {htfa-0.1.0 → htfa-0.2.0}/tests/test_headless.py +0 -0
  50. {htfa-0.1.0 → htfa-0.2.0}/tests/test_htfa.py +0 -0
  51. {htfa-0.1.0 → htfa-0.2.0}/tests/test_io.py +0 -0
  52. {htfa-0.1.0 → htfa-0.2.0}/tests/test_kernel_shapes.py +0 -0
  53. {htfa-0.1.0 → htfa-0.2.0}/tests/test_kernels.py +0 -0
  54. {htfa-0.1.0 → htfa-0.2.0}/tests/test_lazy.py +0 -0
  55. {htfa-0.1.0 → htfa-0.2.0}/tests/test_lm_scaling.py +0 -0
  56. {htfa-0.1.0 → htfa-0.2.0}/tests/test_multi_gpu.py +0 -0
  57. {htfa-0.1.0 → htfa-0.2.0}/tests/test_release_plot_ticks.py +0 -0
  58. {htfa-0.1.0 → htfa-0.2.0}/tests/test_release_redteam.py +0 -0
  59. {htfa-0.1.0 → htfa-0.2.0}/tests/test_results.py +0 -0
  60. {htfa-0.1.0 → htfa-0.2.0}/tests/test_shape_equivalence.py +0 -0
  61. {htfa-0.1.0 → htfa-0.2.0}/tests/test_shape_fits.py +0 -0
  62. {htfa-0.1.0 → htfa-0.2.0}/tests/test_synthetic.py +0 -0
  63. {htfa-0.1.0 → htfa-0.2.0}/tests/test_tfa.py +0 -0
  64. {htfa-0.1.0 → htfa-0.2.0}/tests/test_timecourse.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: htfa
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: Hierarchical Topographic Factor Analysis
5
5
  Author-email: Contextual Dynamics Lab <contextualdynamics@gmail.com>
6
6
  License-Expression: MIT
@@ -86,6 +86,7 @@ Dynamic: license-file
86
86
  <sub>Illustrative movie-viewing analysis: an HTFA template (K = 50) fitted to 12 adults watching Pixar's <i>Partly Cloudy</i>, from Nilearn's <code>development_fmri</code> dataset, viewed from the left, above and right. Inter-subject functional correlation (ISFC) measures correlations between participants' factor time courses at matching moments of the film. Edges show the strongest 5% of factor pairs (|ISFC| &ge; 0.137; red positive, blue negative). Node size represents factor width; node colour identifies communities in the positive-ISFC graph. See the <a href="https://htfa.readthedocs.io/en/latest/tutorials/10_dynamic_isfc_animation.html">ISFC tutorial</a> for the analysis workflow.</sub>
87
87
 
88
88
  [![PyPI version](https://img.shields.io/pypi/v/htfa.svg)](https://pypi.org/project/htfa/)
89
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.23772196.svg)](https://doi.org/10.5281/zenodo.23772196)
89
90
  [![tests](https://github.com/ContextLab/htfa/actions/workflows/tests.yml/badge.svg)](https://github.com/ContextLab/htfa/actions/workflows/tests.yml)
90
91
  [![Documentation Status](https://readthedocs.org/projects/htfa/badge/?version=latest)](https://htfa.readthedocs.io/en/latest/?badge=latest)
91
92
  [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/ContextLab/htfa/blob/main/LICENSE)
@@ -151,6 +152,41 @@ Use `groups=False` to ignore folder-derived grouping, or pass explicit `groups`
151
152
  to define the experimental hierarchy yourself. Each file remains one subject;
152
153
  repeated runs from one person are not independent subjects.
153
154
 
155
+ With the `brain3d` extra, `htfa.plot_network` and `htfa.animate_network` draw nodes in MNI coordinates (mm) and edges above a threshold. This example draws four nodes with one color each, two views, a legend and an exact frame size, then an mp4 with per-frame node sizes drawn by two worker processes:
156
+
157
+ ```python
158
+ import numpy as np
159
+ import htfa
160
+
161
+ rng = np.random.default_rng(0)
162
+ centers = np.array([[-40, -20, 10], [40, -20, 10], [0, 40, 20], [0, -60, 30]], float)
163
+ E = rng.uniform(-1, 1, (6, 4, 4)) # six windows of 4 x 4 connectivity
164
+ E = (E + E.transpose(0, 2, 1)) / 2
165
+ legend = [("red", "positive", "line"), ("blue", "negative", "line")]
166
+
167
+ img = htfa.plot_network(
168
+ centers,
169
+ E[0],
170
+ node_color=["red", "green", "blue", "gray"],
171
+ views=["left", "right"],
172
+ legend=legend,
173
+ frame_size=(640, 400),
174
+ size=(320, 200),
175
+ )
176
+ htfa.animate_network(
177
+ centers,
178
+ E,
179
+ "network.mp4",
180
+ sizes=rng.uniform(1, 5, (6, 4)),
181
+ views=["left", "right"],
182
+ legend=legend,
183
+ frame_size=(640, 400),
184
+ size=(320, 200),
185
+ n_jobs=2,
186
+ crf=18,
187
+ )
188
+ ```
189
+
154
190
  The inputs `htfa.fit` accepts, its parameters and the results object are described in the [documentation](https://htfa.readthedocs.io/en/latest/) and in [docs/API.md](https://github.com/ContextLab/htfa/blob/main/docs/API.md).
155
191
 
156
192
  ## Installation
@@ -8,6 +8,7 @@
8
8
  <sub>Illustrative movie-viewing analysis: an HTFA template (K = 50) fitted to 12 adults watching Pixar's <i>Partly Cloudy</i>, from Nilearn's <code>development_fmri</code> dataset, viewed from the left, above and right. Inter-subject functional correlation (ISFC) measures correlations between participants' factor time courses at matching moments of the film. Edges show the strongest 5% of factor pairs (|ISFC| &ge; 0.137; red positive, blue negative). Node size represents factor width; node colour identifies communities in the positive-ISFC graph. See the <a href="https://htfa.readthedocs.io/en/latest/tutorials/10_dynamic_isfc_animation.html">ISFC tutorial</a> for the analysis workflow.</sub>
9
9
 
10
10
  [![PyPI version](https://img.shields.io/pypi/v/htfa.svg)](https://pypi.org/project/htfa/)
11
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.23772196.svg)](https://doi.org/10.5281/zenodo.23772196)
11
12
  [![tests](https://github.com/ContextLab/htfa/actions/workflows/tests.yml/badge.svg)](https://github.com/ContextLab/htfa/actions/workflows/tests.yml)
12
13
  [![Documentation Status](https://readthedocs.org/projects/htfa/badge/?version=latest)](https://htfa.readthedocs.io/en/latest/?badge=latest)
13
14
  [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/ContextLab/htfa/blob/main/LICENSE)
@@ -73,6 +74,41 @@ Use `groups=False` to ignore folder-derived grouping, or pass explicit `groups`
73
74
  to define the experimental hierarchy yourself. Each file remains one subject;
74
75
  repeated runs from one person are not independent subjects.
75
76
 
77
+ With the `brain3d` extra, `htfa.plot_network` and `htfa.animate_network` draw nodes in MNI coordinates (mm) and edges above a threshold. This example draws four nodes with one color each, two views, a legend and an exact frame size, then an mp4 with per-frame node sizes drawn by two worker processes:
78
+
79
+ ```python
80
+ import numpy as np
81
+ import htfa
82
+
83
+ rng = np.random.default_rng(0)
84
+ centers = np.array([[-40, -20, 10], [40, -20, 10], [0, 40, 20], [0, -60, 30]], float)
85
+ E = rng.uniform(-1, 1, (6, 4, 4)) # six windows of 4 x 4 connectivity
86
+ E = (E + E.transpose(0, 2, 1)) / 2
87
+ legend = [("red", "positive", "line"), ("blue", "negative", "line")]
88
+
89
+ img = htfa.plot_network(
90
+ centers,
91
+ E[0],
92
+ node_color=["red", "green", "blue", "gray"],
93
+ views=["left", "right"],
94
+ legend=legend,
95
+ frame_size=(640, 400),
96
+ size=(320, 200),
97
+ )
98
+ htfa.animate_network(
99
+ centers,
100
+ E,
101
+ "network.mp4",
102
+ sizes=rng.uniform(1, 5, (6, 4)),
103
+ views=["left", "right"],
104
+ legend=legend,
105
+ frame_size=(640, 400),
106
+ size=(320, 200),
107
+ n_jobs=2,
108
+ crf=18,
109
+ )
110
+ ```
111
+
76
112
  The inputs `htfa.fit` accepts, its parameters and the results object are described in the [documentation](https://htfa.readthedocs.io/en/latest/) and in [docs/API.md](https://github.com/ContextLab/htfa/blob/main/docs/API.md).
77
113
 
78
114
  ## Installation
@@ -3,7 +3,7 @@
3
3
  from . import datasets as datasets
4
4
  from . import stats as stats
5
5
  from ._lazy import require, set_autoinstall
6
- from .brainnet import animate_network, plot_network
6
+ from .brainnet import animate_network, content_box, plot_network
7
7
  from .connectivity import dynamic_connectivity, isfc, static_connectivity
8
8
  from .fit import fit
9
9
  from .groups import group_permutation_test
@@ -14,7 +14,7 @@ from .synthetic import make_group_data, make_htfa_data, make_tfa_data
14
14
  from .tfa import TFA
15
15
  from .timecourse import plot_timecourse
16
16
 
17
- __version__ = "0.1.0"
17
+ __version__ = "0.2.0"
18
18
 
19
19
  __all__ = [
20
20
  "HTFA",
@@ -22,6 +22,7 @@ __all__ = [
22
22
  "Subject",
23
23
  "TFA",
24
24
  "animate_network",
25
+ "content_box",
25
26
  "dynamic_connectivity",
26
27
  "fit",
27
28
  "group_permutation_test",