tvboptim 0.2.3__tar.gz → 0.2.4__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 (85) hide show
  1. {tvboptim-0.2.3/src/tvboptim.egg-info → tvboptim-0.2.4}/PKG-INFO +5 -21
  2. {tvboptim-0.2.3 → tvboptim-0.2.4}/README.md +4 -20
  3. {tvboptim-0.2.3 → tvboptim-0.2.4}/pyproject.toml +10 -1
  4. tvboptim-0.2.4/src/tvboptim/__init__.py +13 -0
  5. tvboptim-0.2.4/src/tvboptim/data/connectivity/dTOR/data.npz +0 -0
  6. tvboptim-0.2.4/src/tvboptim/data/connectivity/dk_average/data.npz +0 -0
  7. tvboptim-0.2.4/src/tvboptim/data/functional/dk_average/data.npz +0 -0
  8. tvboptim-0.2.4/src/tvboptim/data/plotting/dk_average/aparc+aseg-mni_09c.nii.gz +0 -0
  9. tvboptim-0.2.4/src/tvboptim/data/plotting/dk_average/fs_default.txt +104 -0
  10. tvboptim-0.2.4/src/tvboptim/data/plotting/dk_average/fs_default_freesurfer_idx.csv +88 -0
  11. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/__init__.py +1 -1
  12. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/__init__.py +1 -1
  13. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/core/network.py +9 -91
  14. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/coupling/__init__.py +4 -1
  15. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/coupling/subspace.py +235 -179
  16. tvboptim-0.2.4/src/tvboptim/experimental/network_dynamics/utils/history.py +137 -0
  17. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/observations/observation.py +3 -1
  18. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/types/__init__.py +1 -1
  19. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/types/parameter.py +1 -1
  20. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/types/spaces.py +1 -1
  21. {tvboptim-0.2.3 → tvboptim-0.2.4/src/tvboptim.egg-info}/PKG-INFO +5 -21
  22. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim.egg-info/SOURCES.txt +7 -0
  23. tvboptim-0.2.3/src/tvboptim/__init__.py +0 -9
  24. {tvboptim-0.2.3 → tvboptim-0.2.4}/LICENSE +0 -0
  25. {tvboptim-0.2.3 → tvboptim-0.2.4}/setup.cfg +0 -0
  26. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/data/__init__.py +0 -0
  27. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/data/loaders.py +0 -0
  28. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/execution.py +0 -0
  29. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/core/__init__.py +0 -0
  30. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/core/bunch.py +0 -0
  31. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/coupling/base.py +0 -0
  32. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/coupling/linear.py +0 -0
  33. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/coupling/tvb.py +0 -0
  34. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/dynamics/__init__.py +0 -0
  35. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/dynamics/base.py +0 -0
  36. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/dynamics/lorenz.py +0 -0
  37. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/dynamics/tvb/__init__.py +0 -0
  38. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/dynamics/tvb/coombes_byrne.py +0 -0
  39. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/dynamics/tvb/epileptor.py +0 -0
  40. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/dynamics/tvb/generic_2d_oscillator.py +0 -0
  41. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/dynamics/tvb/jansen_rit.py +0 -0
  42. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/dynamics/tvb/kuramoto.py +0 -0
  43. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/dynamics/tvb/larter_breakspear.py +0 -0
  44. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/dynamics/tvb/linear.py +0 -0
  45. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/dynamics/tvb/montbrio_pazo_roxin.py +0 -0
  46. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/dynamics/tvb/sup_hopf.py +0 -0
  47. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/dynamics/tvb/wilson_cowan.py +0 -0
  48. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/dynamics/tvb/wong_wang.py +0 -0
  49. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/dynamics/tvb/wong_wang_exc_inh.py +0 -0
  50. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/external_input/__init__.py +0 -0
  51. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/external_input/base.py +0 -0
  52. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/external_input/data.py +0 -0
  53. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/external_input/parametric.py +0 -0
  54. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/graph/__init__.py +0 -0
  55. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/graph/base.py +0 -0
  56. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/graph/sparse.py +0 -0
  57. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/graph/utils.py +0 -0
  58. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/noise/__init__.py +0 -0
  59. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/noise/base.py +0 -0
  60. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/noise/gaussian.py +0 -0
  61. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/result.py +0 -0
  62. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/solve.py +0 -0
  63. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/solvers/__init__.py +0 -0
  64. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/solvers/base.py +0 -0
  65. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/solvers/diffrax.py +0 -0
  66. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/solvers/native.py +0 -0
  67. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/utils/__init__.py +0 -0
  68. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/experimental/network_dynamics/utils/printer.py +0 -0
  69. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/observations/__init__.py +0 -0
  70. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/observations/tvb_monitors/__init__.py +0 -0
  71. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/observations/tvb_monitors/bold.py +0 -0
  72. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/observations/tvb_monitors/downsampling.py +0 -0
  73. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/optim/__init__.py +0 -0
  74. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/optim/callbacks.py +0 -0
  75. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/optim/optax.py +0 -0
  76. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/tvbo/__init__.py +0 -0
  77. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/tvbo/prepare_experiment.py +0 -0
  78. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/types/stateutils.py +0 -0
  79. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/utils/__init__.py +0 -0
  80. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/utils/caching.py +0 -0
  81. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim/utils/utils.py +0 -0
  82. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim.egg-info/dependency_links.txt +0 -0
  83. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim.egg-info/requires.txt +0 -0
  84. {tvboptim-0.2.3 → tvboptim-0.2.4}/src/tvboptim.egg-info/top_level.txt +0 -0
  85. {tvboptim-0.2.3 → tvboptim-0.2.4}/tests/test_execution.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tvboptim
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Summary: Optimization tools for The Virtual Brain
5
5
  Author-email: Marius Pille <marius.pille@bih-charite.de>
6
6
  License-Expression: EUPL-1.2
@@ -55,13 +55,12 @@ Dynamic: license-file
55
55
  [![Ruff](https://github.com/virtual-twin/tvboptim/actions/workflows/ruff.yml/badge.svg)](https://github.com/virtual-twin/tvboptim/actions/workflows/ruff.yml)
56
56
  [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
57
57
  [![PyPI version](https://img.shields.io/pypi/v/tvboptim.svg)](https://pypi.org/project/tvboptim/)
58
+ [![Documentation](https://img.shields.io/badge/docs-online-brightgreen.svg)](https://virtual-twin.github.io/tvboptim)
58
59
  <!-- [![Downloads](https://img.shields.io/pypi/dm/tvboptim.svg)](https://pypi.org/project/tvboptim/) -->
59
60
  <!-- [![codecov](https://codecov.io/gh/virtual-twin/tvboptim/branch/main/graph/badge.svg)](https://codecov.io/gh/virtual-twin/tvboptim) -->
60
61
 
61
62
  [JAX](https://jax.readthedocs.io/en/latest/)-based framework for brain network simulation and gradient-based optimization.
62
63
 
63
- **[Documentation](https://virtual-twin.github.io/tvboptim)** | **[Get Started](https://virtual-twin.github.io/tvboptim/get_started.html)** | **[Network Dynamics](https://virtual-twin.github.io/tvboptim/network_dynamics/network_dynamics.html)**
64
-
65
64
  ## Key Features
66
65
 
67
66
  - **Gradient-based optimization:** Fit thousands of parameters using automatic differentiation through the entire simulation pipeline
@@ -116,23 +115,14 @@ opt = OptaxOptimizer(loss, optax.adam(learning_rate=0.03))
116
115
  final_params, history = opt.run(params, max_steps=50)
117
116
  ```
118
117
 
119
- See the [full example with visualization](https://virtual-twin.github.io/tvboptim/) in the documentation.
118
+ See the [full example with visualization](https://virtual-twin.github.io/tvboptim/) in the documentation or [run it directly in Google Colab](https://colab.research.google.com/github/virtual-twin/tvboptim/blob/main/docs/workflows/RWW.ipynb):
120
119
 
121
- ## Documentation
120
+ ## [Documentation](https://virtual-twin.github.io/tvboptim)
122
121
 
123
- - **[Get Started](https://virtual-twin.github.io/tvboptim/get_started.html)** - Introduction and basic workflows
124
- - **[Network Dynamics](https://virtual-twin.github.io/tvboptim/network_dynamics/network_dynamics.html)** - Build differentiable brain network models
122
+ - **[Network Dynamics](https://virtual-twin.github.io/tvboptim/network_dynamics/network_dynamics.html)** - Build differentiable brain network models in TVB-Optim
125
123
  - **[Parameters & Optimization](https://virtual-twin.github.io/tvboptim/parameters_and_optimization.html)** - Gradient-based parameter inference
126
124
  - **[API Reference](https://virtual-twin.github.io/tvboptim/reference/index.html)** - Complete API documentation
127
125
 
128
- ## How It Works
129
-
130
- **Functional Composition:** Models are composable functions that can be inspected, modified, and extended. Build complexity incrementally by wrapping functions.
131
-
132
- **End-to-End Differentiability:** Compute gradients through the full pipeline: neural dynamics → hemodynamic models → empirical observables.
133
-
134
- **Interoperability:** Convert existing TVB simulations to JAX-compatible functions via the TVB-O framework.
135
-
136
126
  ## Contributing
137
127
 
138
128
  We welcome contributions and questions from the community!
@@ -141,12 +131,6 @@ We welcome contributions and questions from the community!
141
131
  - **Ask Questions**: [Start a discussion](https://github.com/virtual-twin/tvboptim/discussions)
142
132
  - **Contribute Code**: [Open a pull request](https://github.com/virtual-twin/tvboptim/pulls)
143
133
 
144
- ## Contact
145
-
146
- Questions or want to collaborate? Reach out:
147
-
148
- * marius.pille[at]bih-charite.de
149
-
150
134
  ## Citation
151
135
 
152
136
  If you use TVB-Optim in your research, please cite:
@@ -8,13 +8,12 @@
8
8
  [![Ruff](https://github.com/virtual-twin/tvboptim/actions/workflows/ruff.yml/badge.svg)](https://github.com/virtual-twin/tvboptim/actions/workflows/ruff.yml)
9
9
  [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
10
10
  [![PyPI version](https://img.shields.io/pypi/v/tvboptim.svg)](https://pypi.org/project/tvboptim/)
11
+ [![Documentation](https://img.shields.io/badge/docs-online-brightgreen.svg)](https://virtual-twin.github.io/tvboptim)
11
12
  <!-- [![Downloads](https://img.shields.io/pypi/dm/tvboptim.svg)](https://pypi.org/project/tvboptim/) -->
12
13
  <!-- [![codecov](https://codecov.io/gh/virtual-twin/tvboptim/branch/main/graph/badge.svg)](https://codecov.io/gh/virtual-twin/tvboptim) -->
13
14
 
14
15
  [JAX](https://jax.readthedocs.io/en/latest/)-based framework for brain network simulation and gradient-based optimization.
15
16
 
16
- **[Documentation](https://virtual-twin.github.io/tvboptim)** | **[Get Started](https://virtual-twin.github.io/tvboptim/get_started.html)** | **[Network Dynamics](https://virtual-twin.github.io/tvboptim/network_dynamics/network_dynamics.html)**
17
-
18
17
  ## Key Features
19
18
 
20
19
  - **Gradient-based optimization:** Fit thousands of parameters using automatic differentiation through the entire simulation pipeline
@@ -69,23 +68,14 @@ opt = OptaxOptimizer(loss, optax.adam(learning_rate=0.03))
69
68
  final_params, history = opt.run(params, max_steps=50)
70
69
  ```
71
70
 
72
- See the [full example with visualization](https://virtual-twin.github.io/tvboptim/) in the documentation.
71
+ See the [full example with visualization](https://virtual-twin.github.io/tvboptim/) in the documentation or [run it directly in Google Colab](https://colab.research.google.com/github/virtual-twin/tvboptim/blob/main/docs/workflows/RWW.ipynb):
73
72
 
74
- ## Documentation
73
+ ## [Documentation](https://virtual-twin.github.io/tvboptim)
75
74
 
76
- - **[Get Started](https://virtual-twin.github.io/tvboptim/get_started.html)** - Introduction and basic workflows
77
- - **[Network Dynamics](https://virtual-twin.github.io/tvboptim/network_dynamics/network_dynamics.html)** - Build differentiable brain network models
75
+ - **[Network Dynamics](https://virtual-twin.github.io/tvboptim/network_dynamics/network_dynamics.html)** - Build differentiable brain network models in TVB-Optim
78
76
  - **[Parameters & Optimization](https://virtual-twin.github.io/tvboptim/parameters_and_optimization.html)** - Gradient-based parameter inference
79
77
  - **[API Reference](https://virtual-twin.github.io/tvboptim/reference/index.html)** - Complete API documentation
80
78
 
81
- ## How It Works
82
-
83
- **Functional Composition:** Models are composable functions that can be inspected, modified, and extended. Build complexity incrementally by wrapping functions.
84
-
85
- **End-to-End Differentiability:** Compute gradients through the full pipeline: neural dynamics → hemodynamic models → empirical observables.
86
-
87
- **Interoperability:** Convert existing TVB simulations to JAX-compatible functions via the TVB-O framework.
88
-
89
79
  ## Contributing
90
80
 
91
81
  We welcome contributions and questions from the community!
@@ -94,12 +84,6 @@ We welcome contributions and questions from the community!
94
84
  - **Ask Questions**: [Start a discussion](https://github.com/virtual-twin/tvboptim/discussions)
95
85
  - **Contribute Code**: [Open a pull request](https://github.com/virtual-twin/tvboptim/pulls)
96
86
 
97
- ## Contact
98
-
99
- Questions or want to collaborate? Reach out:
100
-
101
- * marius.pille[at]bih-charite.de
102
-
103
87
  ## Citation
104
88
 
105
89
  If you use TVB-Optim in your research, please cite:
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "tvboptim"
7
- version = "0.2.3"
7
+ version = "0.2.4"
8
8
  description = "Optimization tools for The Virtual Brain"
9
9
  readme = "README.md"
10
10
  authors = [
@@ -46,6 +46,15 @@ dependencies = [
46
46
  [tool.setuptools]
47
47
  package-dir = {"" = "src"}
48
48
 
49
+ [tool.setuptools.package-data]
50
+ tvboptim = [
51
+ "data/connectivity/*/data.npz",
52
+ "data/functional/*/data.npz",
53
+ "data/plotting/*/*.nii.gz",
54
+ "data/plotting/*/*.csv",
55
+ "data/plotting/*/*.txt",
56
+ ]
57
+
49
58
  [tool.pytest.ini_options]
50
59
  testpaths = ["tests"]
51
60
  python_files = "test_*.py"
@@ -0,0 +1,13 @@
1
+ """TVB-Optim - Optimization tools for The Virtual Brain."""
2
+
3
+ try:
4
+ from importlib.metadata import version
5
+ __version__ = version("tvboptim")
6
+ except Exception:
7
+ __version__ = "unknown"
8
+
9
+ from . import data
10
+ from .tvbo.prepare_experiment import HAS_TVBO, prepare
11
+ from .types import parameter, spaces
12
+
13
+ __all__ = ["spaces", "prepare", "HAS_TVBO", "parameter", "data"]
@@ -0,0 +1,104 @@
1
+ # Copyright (c) 2008-2024 the MRtrix3 contributors.
2
+ #
3
+ # This Source Code Form is subject to the terms of the Mozilla Public
4
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
5
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
+ #
7
+ # Covered Software is provided under this License on an "as is"
8
+ # basis, without warranty of any kind, either expressed, implied, or
9
+ # statutory, including, without limitation, warranties that the
10
+ # Covered Software is free of defects, merchantable, fit for a
11
+ # particular purpose or non-infringing.
12
+ # See the Mozilla Public License v. 2.0 for more details.
13
+ #
14
+ # For more details, see http://www.mrtrix.org/.
15
+
16
+ # Lookup table for extracting the relevant grey matter parcellations from the default FreeSurfer segmentation (desikan_killiany)
17
+
18
+ 0 ??? Unknown 0 0 0 0
19
+ 1 L.BSTS ctx-lh-bankssts 25 100 40 255
20
+ 2 L.CACG ctx-lh-caudalanteriorcingulate 125 100 160 255
21
+ 3 L.CMFG ctx-lh-caudalmiddlefrontal 100 25 0 255
22
+ 4 L.CU ctx-lh-cuneus 220 20 100 255
23
+ 5 L.EC ctx-lh-entorhinal 220 20 10 255
24
+ 6 L.FG ctx-lh-fusiform 180 220 140 255
25
+ 7 L.IPG ctx-lh-inferiorparietal 220 60 220 255
26
+ 8 L.ITG ctx-lh-inferiortemporal 180 40 120 255
27
+ 9 L.ICG ctx-lh-isthmuscingulate 140 20 140 255
28
+ 10 L.LOG ctx-lh-lateraloccipital 20 30 140 255
29
+ 11 L.LOFG ctx-lh-lateralorbitofrontal 35 75 50 255
30
+ 12 L.LG ctx-lh-lingual 225 140 140 255
31
+ 13 L.MOFG ctx-lh-medialorbitofrontal 200 35 75 255
32
+ 14 L.MTG ctx-lh-middletemporal 160 100 50 255
33
+ 15 L.PHIG ctx-lh-parahippocampal 20 220 60 255
34
+ 16 L.PaCG ctx-lh-paracentral 60 220 60 255
35
+ 17 L.POP ctx-lh-parsopercularis 220 180 140 255
36
+ 18 L.POR ctx-lh-parsorbitalis 20 100 50 255
37
+ 19 L.PTR ctx-lh-parstriangularis 220 60 20 255
38
+ 20 L.PCAL ctx-lh-pericalcarine 120 100 60 255
39
+ 21 L.PoCG ctx-lh-postcentral 220 20 20 255
40
+ 22 L.PCG ctx-lh-posteriorcingulate 220 180 220 255
41
+ 23 L.PrCG ctx-lh-precentral 60 20 220 255
42
+ 24 L.PCU ctx-lh-precuneus 160 140 180 255
43
+ 25 L.RACG ctx-lh-rostralanteriorcingulate 80 20 140 255
44
+ 26 L.RMFG ctx-lh-rostralmiddlefrontal 75 50 125 255
45
+ 27 L.SFG ctx-lh-superiorfrontal 20 220 160 255
46
+ 28 L.SPG ctx-lh-superiorparietal 20 180 140 255
47
+ 29 L.STG ctx-lh-superiortemporal 140 220 220 255
48
+ 30 L.SMG ctx-lh-supramarginal 80 160 20 255
49
+ 31 L.FP ctx-lh-frontalpole 100 0 100 255
50
+ 32 L.TP ctx-lh-temporalpole 70 70 70 255
51
+ 33 L.TTG ctx-lh-transversetemporal 150 150 200 255
52
+ 34 L.IN ctx-lh-insula 255 192 32 255
53
+ 35 L.CER Left-Cerebellum-Cortex 230 148 34 255
54
+ 36 L.TH Left-Thalamus 0 118 14 255
55
+ 36 L.TH Left-Thalamus-Proper 0 118 14 255
56
+ 37 L.CA Left-Caudate 122 186 220 255
57
+ 38 L.PU Left-Putamen 236 13 176 255
58
+ 39 L.PA Left-Pallidum 12 48 255 255
59
+ 40 L.HI Left-Hippocampus 220 216 20 255
60
+ 41 L.AM Left-Amygdala 103 255 255 255
61
+ 42 L.AC Left-Accumbens-area 255 165 0 255
62
+ 43 R.TH Right-Thalamus 0 118 14 255
63
+ 43 R.TH Right-Thalamus-Proper 0 118 14 255
64
+ 44 R.CA Right-Caudate 122 186 220 255
65
+ 45 R.PU Right-Putamen 236 13 176 255
66
+ 46 R.PA Right-Pallidum 13 48 255 255
67
+ 47 R.HI Right-Hippocampus 220 216 20 255
68
+ 48 R.AM Right-Amygdala 103 255 255 255
69
+ 49 R.AC Right-Accumbens-area 255 165 0 255
70
+ 50 R.BSTS ctx-rh-bankssts 25 100 40 255
71
+ 51 R.CACG ctx-rh-caudalanteriorcingulate 125 100 160 255
72
+ 52 R.CMFG ctx-rh-caudalmiddlefrontal 100 25 0 255
73
+ 53 R.CU ctx-rh-cuneus 220 20 100 255
74
+ 54 R.EC ctx-rh-entorhinal 220 20 10 255
75
+ 55 R.FG ctx-rh-fusiform 180 220 140 255
76
+ 56 R.IPG ctx-rh-inferiorparietal 220 60 220 255
77
+ 57 R.ITG ctx-rh-inferiortemporal 180 40 120 255
78
+ 58 R.ICG ctx-rh-isthmuscingulate 140 20 140 255
79
+ 59 R.LOG ctx-rh-lateraloccipital 20 30 140 255
80
+ 60 R.LOFG ctx-rh-lateralorbitofrontal 35 75 50 255
81
+ 61 R.LG ctx-rh-lingual 225 140 140 255
82
+ 62 R.MOFG ctx-rh-medialorbitofrontal 200 35 75 255
83
+ 63 R.MTG ctx-rh-middletemporal 160 100 50 255
84
+ 64 R.PHIG ctx-rh-parahippocampal 20 220 60 255
85
+ 65 R.PaCG ctx-rh-paracentral 60 220 60 255
86
+ 66 R.POP ctx-rh-parsopercularis 220 180 140 255
87
+ 67 R.POR ctx-rh-parsorbitalis 20 100 50 255
88
+ 68 R.PTR ctx-rh-parstriangularis 220 60 20 255
89
+ 69 R.PCAL ctx-rh-pericalcarine 120 100 60 255
90
+ 70 R.PoCG ctx-rh-postcentral 220 20 20 255
91
+ 71 R.PCG ctx-rh-posteriorcingulate 220 180 220 255
92
+ 72 R.PrCG ctx-rh-precentral 60 20 220 255
93
+ 73 R.PCU ctx-rh-precuneus 160 140 180 255
94
+ 74 R.RACG ctx-rh-rostralanteriorcingulate 80 20 140 255
95
+ 75 R.RMFG ctx-rh-rostralmiddlefrontal 75 50 125 255
96
+ 76 R.SFG ctx-rh-superiorfrontal 20 220 160 255
97
+ 77 R.SPG ctx-rh-superiorparietal 20 180 140 255
98
+ 78 R.STG ctx-rh-superiortemporal 140 220 220 255
99
+ 79 R.SMG ctx-rh-supramarginal 80 160 20 255
100
+ 80 R.FP ctx-rh-frontalpole 100 0 100 255
101
+ 81 R.TP ctx-rh-temporalpole 70 70 70 255
102
+ 82 R.TTG ctx-rh-transversetemporal 150 150 200 255
103
+ 83 R.IN ctx-rh-insula 255 192 32 255
104
+ 84 R.CER Right-Cerebellum-Cortex 230 148 34 255
@@ -0,0 +1,88 @@
1
+ acronym,label,r,g,b,a,freesurfer_idx
2
+ ???,Unknown,0,0,0,0,0
3
+ L.BSTS,ctx-lh-bankssts,25,100,40,255,1001
4
+ L.CACG,ctx-lh-caudalanteriorcingulate,125,100,160,255,1002
5
+ L.CMFG,ctx-lh-caudalmiddlefrontal,100,25,0,255,1003
6
+ L.CU,ctx-lh-cuneus,220,20,100,255,1005
7
+ L.EC,ctx-lh-entorhinal,220,20,10,255,1006
8
+ L.FG,ctx-lh-fusiform,180,220,140,255,1007
9
+ L.IPG,ctx-lh-inferiorparietal,220,60,220,255,1008
10
+ L.ITG,ctx-lh-inferiortemporal,180,40,120,255,1009
11
+ L.ICG,ctx-lh-isthmuscingulate,140,20,140,255,1010
12
+ L.LOG,ctx-lh-lateraloccipital,20,30,140,255,1011
13
+ L.LOFG,ctx-lh-lateralorbitofrontal,35,75,50,255,1012
14
+ L.LG,ctx-lh-lingual,225,140,140,255,1013
15
+ L.MOFG,ctx-lh-medialorbitofrontal,200,35,75,255,1014
16
+ L.MTG,ctx-lh-middletemporal,160,100,50,255,1015
17
+ L.PHIG,ctx-lh-parahippocampal,20,220,60,255,1016
18
+ L.PaCG,ctx-lh-paracentral,60,220,60,255,1017
19
+ L.POP,ctx-lh-parsopercularis,220,180,140,255,1018
20
+ L.POR,ctx-lh-parsorbitalis,20,100,50,255,1019
21
+ L.PTR,ctx-lh-parstriangularis,220,60,20,255,1020
22
+ L.PCAL,ctx-lh-pericalcarine,120,100,60,255,1021
23
+ L.PoCG,ctx-lh-postcentral,220,20,20,255,1022
24
+ L.PCG,ctx-lh-posteriorcingulate,220,180,220,255,1023
25
+ L.PrCG,ctx-lh-precentral,60,20,220,255,1024
26
+ L.PCU,ctx-lh-precuneus,160,140,180,255,1025
27
+ L.RACG,ctx-lh-rostralanteriorcingulate,80,20,140,255,1026
28
+ L.RMFG,ctx-lh-rostralmiddlefrontal,75,50,125,255,1027
29
+ L.SFG,ctx-lh-superiorfrontal,20,220,160,255,1028
30
+ L.SPG,ctx-lh-superiorparietal,20,180,140,255,1029
31
+ L.STG,ctx-lh-superiortemporal,140,220,220,255,1030
32
+ L.SMG,ctx-lh-supramarginal,80,160,20,255,1031
33
+ L.FP,ctx-lh-frontalpole,100,0,100,255,1032
34
+ L.TP,ctx-lh-temporalpole,70,70,70,255,1033
35
+ L.TTG,ctx-lh-transversetemporal,150,150,200,255,1034
36
+ L.IN,ctx-lh-insula,255,192,32,255,1035
37
+ L.CER,Left-Cerebellum-Cortex,230,148,34,255,8
38
+ L.TH,Left-Thalamus,0,118,14,255,10
39
+ L.TH,Left-Thalamus-Proper,0,118,14,255,10
40
+ L.CA,Left-Caudate,122,186,220,255,11
41
+ L.PU,Left-Putamen,236,13,176,255,12
42
+ L.PA,Left-Pallidum,12,48,255,255,13
43
+ L.HI,Left-Hippocampus,220,216,20,255,17
44
+ L.AM,Left-Amygdala,103,255,255,255,18
45
+ L.AC,Left-Accumbens-area,255,165,0,255,26
46
+ R.TH,Right-Thalamus,0,118,14,255,49
47
+ R.TH,Right-Thalamus-Proper,0,118,14,255,49
48
+ R.CA,Right-Caudate,122,186,220,255,50
49
+ R.PU,Right-Putamen,236,13,176,255,51
50
+ R.PA,Right-Pallidum,13,48,255,255,52
51
+ R.HI,Right-Hippocampus,220,216,20,255,53
52
+ R.AM,Right-Amygdala,103,255,255,255,54
53
+ R.AC,Right-Accumbens-area,255,165,0,255,58
54
+ R.BSTS,ctx-rh-bankssts,25,100,40,255,2001
55
+ R.CACG,ctx-rh-caudalanteriorcingulate,125,100,160,255,2002
56
+ R.CMFG,ctx-rh-caudalmiddlefrontal,100,25,0,255,2003
57
+ R.CU,ctx-rh-cuneus,220,20,100,255,2005
58
+ R.EC,ctx-rh-entorhinal,220,20,10,255,2006
59
+ R.FG,ctx-rh-fusiform,180,220,140,255,2007
60
+ R.IPG,ctx-rh-inferiorparietal,220,60,220,255,2008
61
+ R.ITG,ctx-rh-inferiortemporal,180,40,120,255,2009
62
+ R.ICG,ctx-rh-isthmuscingulate,140,20,140,255,2010
63
+ R.LOG,ctx-rh-lateraloccipital,20,30,140,255,2011
64
+ R.LOFG,ctx-rh-lateralorbitofrontal,35,75,50,255,2012
65
+ R.LG,ctx-rh-lingual,225,140,140,255,2013
66
+ R.MOFG,ctx-rh-medialorbitofrontal,200,35,75,255,2014
67
+ R.MTG,ctx-rh-middletemporal,160,100,50,255,2015
68
+ R.PHIG,ctx-rh-parahippocampal,20,220,60,255,2016
69
+ R.PaCG,ctx-rh-paracentral,60,220,60,255,2017
70
+ R.POP,ctx-rh-parsopercularis,220,180,140,255,2018
71
+ R.POR,ctx-rh-parsorbitalis,20,100,50,255,2019
72
+ R.PTR,ctx-rh-parstriangularis,220,60,20,255,2020
73
+ R.PCAL,ctx-rh-pericalcarine,120,100,60,255,2021
74
+ R.PoCG,ctx-rh-postcentral,220,20,20,255,2022
75
+ R.PCG,ctx-rh-posteriorcingulate,220,180,220,255,2023
76
+ R.PrCG,ctx-rh-precentral,60,20,220,255,2024
77
+ R.PCU,ctx-rh-precuneus,160,140,180,255,2025
78
+ R.RACG,ctx-rh-rostralanteriorcingulate,80,20,140,255,2026
79
+ R.RMFG,ctx-rh-rostralmiddlefrontal,75,50,125,255,2027
80
+ R.SFG,ctx-rh-superiorfrontal,20,220,160,255,2028
81
+ R.SPG,ctx-rh-superiorparietal,20,180,140,255,2029
82
+ R.STG,ctx-rh-superiortemporal,140,220,220,255,2030
83
+ R.SMG,ctx-rh-supramarginal,80,160,20,255,2031
84
+ R.FP,ctx-rh-frontalpole,100,0,100,255,2032
85
+ R.TP,ctx-rh-temporalpole,70,70,70,255,2033
86
+ R.TTG,ctx-rh-transversetemporal,150,150,200,255,2034
87
+ R.IN,ctx-rh-insula,255,192,32,255,2035
88
+ R.CER,Right-Cerebellum-Cortex,230,148,34,255,47
@@ -1,4 +1,4 @@
1
- """Experimental modules for TVBOptim.
1
+ """Experimental modules for TVB-Optim.
2
2
 
3
3
  This package contains experimental features and integrations that are under
4
4
  active development. APIs may change without notice.
@@ -1,6 +1,6 @@
1
1
  """Network Dynamics: JAX-based brain network modeling interface.
2
2
 
3
- Part of TVBOptim experimental modules.
3
+ Part of TVB-Optim experimental modules.
4
4
  """
5
5
 
6
6
  from .core import Bunch, Network
@@ -552,97 +552,15 @@ class Network:
552
552
  History buffer [n_steps, n_states, n_nodes]
553
553
  where n_steps = ceil(max_delay / dt)
554
554
  """
555
- # Calculate required number of steps
556
- n_steps_needed = int(jnp.rint(self.max_delay / dt)) + 1
557
-
558
- # Get history data
559
- hist_ts = self._history.ts
560
- hist_ys = self._history.ys # [n_time, n_states, n_nodes]
561
-
562
- # Calculate history dt (assume uniform spacing)
563
- hist_dt = hist_ts[1] - hist_ts[0] if len(hist_ts) > 1 else dt
564
-
565
- # Check if we need interpolation (allow small numerical tolerance)
566
- needs_interpolation = jnp.abs(hist_dt - dt) > 1e-9
567
-
568
- # Calculate time coverage and check if we need padding
569
- time_coverage = hist_ts[-1] - hist_ts[0]
570
- needs_padding = time_coverage < self.max_delay
571
-
572
- if needs_padding:
573
- # Pad at the beginning with the first timestep
574
- n_steps_available = len(hist_ts)
575
- n_steps_to_pad = n_steps_needed - n_steps_available
576
-
577
- if n_steps_to_pad > 0:
578
- # Repeat first timestep
579
- first_state = hist_ys[0:1, :, :] # [1, n_states, n_nodes]
580
- padding = jnp.tile(first_state, (n_steps_to_pad, 1, 1))
581
-
582
- if needs_interpolation:
583
- # Interpolate available data, then pad
584
- interpolated = self._interpolate_history(
585
- hist_ts, hist_ys, n_steps_needed - n_steps_to_pad
586
- )
587
- return jnp.concatenate([padding, interpolated], axis=0)
588
- else:
589
- # Just pad and concatenate
590
- return jnp.concatenate([padding, hist_ys], axis=0)
591
- else:
592
- # We have enough data but warned in update_history
593
- # Extract what we need
594
- if needs_interpolation:
595
- return self._interpolate_history(hist_ts, hist_ys, n_steps_needed)
596
- else:
597
- return hist_ys[-n_steps_needed:]
598
- else:
599
- # Sufficient time coverage - extract last max_delay seconds
600
- if needs_interpolation:
601
- # Find the time window we need
602
- t_start = hist_ts[-1] - self.max_delay
603
- start_idx = jnp.searchsorted(hist_ts, t_start)
604
-
605
- # Extract and interpolate
606
- window_ts = hist_ts[start_idx:]
607
- window_ys = hist_ys[start_idx:]
608
-
609
- return self._interpolate_history(window_ts, window_ys, n_steps_needed)
610
- else:
611
- # No interpolation needed, just extract
612
- return hist_ys[-n_steps_needed:]
613
-
614
- def _interpolate_history(
615
- self, old_ts: jnp.ndarray, old_ys: jnp.ndarray, n_steps: int
616
- ) -> jnp.ndarray:
617
- """Interpolate history to match target dt.
618
-
619
- Args:
620
- old_ts: Original time points [n_time_old]
621
- old_ys: Original trajectory [n_time_old, n_states, n_nodes]
622
- n_steps: Number of steps needed in output
623
-
624
- Returns:
625
- Interpolated history [n_steps, n_states, n_nodes]
626
- """
627
- # Create new time grid
628
- new_ts = jnp.linspace(old_ts[0], old_ts[-1], n_steps)
629
-
630
- # Reshape for vectorized interpolation: [n_time, n_states * n_nodes]
631
- n_time_old, n_states, n_nodes = old_ys.shape
632
- old_ys_flat = old_ys.reshape(n_time_old, -1) # [n_time_old, n_states*n_nodes]
633
-
634
- # Interpolate each (state, node) combination
635
- # jnp.interp works on 1D, so we vmap over the second dimension
636
- def interp_1d(y_values):
637
- return jnp.interp(new_ts, old_ts, y_values)
638
-
639
- # Vectorize over all state-node combinations
640
- from jax import vmap
641
-
642
- new_ys_flat = vmap(interp_1d, in_axes=1, out_axes=1)(old_ys_flat)
643
-
644
- # Reshape back to [n_steps, n_states, n_nodes]
645
- return new_ys_flat.reshape(n_steps, n_states, n_nodes)
555
+ from ..utils.history import extract_history_window
556
+
557
+ return extract_history_window(
558
+ hist_ts=self._history.ts,
559
+ hist_ys=self._history.ys,
560
+ max_delay=self.max_delay,
561
+ dt=dt,
562
+ transform_fn=None, # No transformation for direct node history
563
+ )
646
564
 
647
565
  def get_history(self, dt: float) -> Optional[jnp.ndarray]:
648
566
  """Get history buffer for delayed coupling networks.
@@ -1,6 +1,6 @@
1
1
  """Coupling functions for network interactions."""
2
2
 
3
- from .base import AbstractCoupling, BufferStrategy, DelayedCoupling
3
+ from .base import AbstractCoupling, BufferStrategy, DelayedCoupling, InstantaneousCoupling
4
4
  from .linear import (
5
5
  DelayedDifferenceCoupling,
6
6
  DelayedLinearCoupling,
@@ -9,9 +9,11 @@ from .linear import (
9
9
  LinearCoupling,
10
10
  )
11
11
  from .tvb import DelayedSigmoidalJansenRit, SigmoidalJansenRit
12
+ from .subspace import SubspaceCoupling
12
13
 
13
14
  __all__ = [
14
15
  "AbstractCoupling",
16
+ "InstantaneousCoupling",
15
17
  "BufferStrategy",
16
18
  "DelayedCoupling",
17
19
  "LinearCoupling",
@@ -21,4 +23,5 @@ __all__ = [
21
23
  "DelayedLinearCoupling",
22
24
  "DelayedDifferenceCoupling",
23
25
  "FastLinearCoupling",
26
+ "SubspaceCoupling",
24
27
  ]