vbi 0.1.3__cp310-cp310-manylinux2014_x86_64.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.
- vbi/__init__.py +37 -0
- vbi/_version.py +17 -0
- vbi/dataset/__init__.py +0 -0
- vbi/dataset/connectivity_84/centers.txt +84 -0
- vbi/dataset/connectivity_84/centres.txt +84 -0
- vbi/dataset/connectivity_84/cortical.txt +84 -0
- vbi/dataset/connectivity_84/tract_lengths.txt +84 -0
- vbi/dataset/connectivity_84/weights.txt +84 -0
- vbi/dataset/connectivity_88/Aud_88.txt +88 -0
- vbi/dataset/connectivity_88/Bold.npz +0 -0
- vbi/dataset/connectivity_88/Labels.txt +17 -0
- vbi/dataset/connectivity_88/Region_labels.txt +88 -0
- vbi/dataset/connectivity_88/tract_lengths.txt +88 -0
- vbi/dataset/connectivity_88/weights.txt +88 -0
- vbi/feature_extraction/__init__.py +1 -0
- vbi/feature_extraction/calc_features.py +293 -0
- vbi/feature_extraction/features.json +535 -0
- vbi/feature_extraction/features.py +2124 -0
- vbi/feature_extraction/features_settings.py +374 -0
- vbi/feature_extraction/features_utils.py +1357 -0
- vbi/feature_extraction/infodynamics.jar +0 -0
- vbi/feature_extraction/utility.py +507 -0
- vbi/inference.py +98 -0
- vbi/models/__init__.py +0 -0
- vbi/models/cpp/__init__.py +0 -0
- vbi/models/cpp/_src/__init__.py +0 -0
- vbi/models/cpp/_src/__pycache__/mpr_sde.cpython-310.pyc +0 -0
- vbi/models/cpp/_src/_do.cpython-310-x86_64-linux-gnu.so +0 -0
- vbi/models/cpp/_src/_jr_sdde.cpython-310-x86_64-linux-gnu.so +0 -0
- vbi/models/cpp/_src/_jr_sde.cpython-310-x86_64-linux-gnu.so +0 -0
- vbi/models/cpp/_src/_km_sde.cpython-310-x86_64-linux-gnu.so +0 -0
- vbi/models/cpp/_src/_mpr_sde.cpython-310-x86_64-linux-gnu.so +0 -0
- vbi/models/cpp/_src/_vep.cpython-310-x86_64-linux-gnu.so +0 -0
- vbi/models/cpp/_src/_wc_ode.cpython-310-x86_64-linux-gnu.so +0 -0
- vbi/models/cpp/_src/bold.hpp +303 -0
- vbi/models/cpp/_src/do.hpp +167 -0
- vbi/models/cpp/_src/do.i +17 -0
- vbi/models/cpp/_src/do.py +467 -0
- vbi/models/cpp/_src/do_wrap.cxx +12811 -0
- vbi/models/cpp/_src/jr_sdde.hpp +352 -0
- vbi/models/cpp/_src/jr_sdde.i +19 -0
- vbi/models/cpp/_src/jr_sdde.py +688 -0
- vbi/models/cpp/_src/jr_sdde_wrap.cxx +18718 -0
- vbi/models/cpp/_src/jr_sde.hpp +264 -0
- vbi/models/cpp/_src/jr_sde.i +17 -0
- vbi/models/cpp/_src/jr_sde.py +470 -0
- vbi/models/cpp/_src/jr_sde_wrap.cxx +13406 -0
- vbi/models/cpp/_src/km_sde.hpp +158 -0
- vbi/models/cpp/_src/km_sde.i +19 -0
- vbi/models/cpp/_src/km_sde.py +671 -0
- vbi/models/cpp/_src/km_sde_wrap.cxx +17367 -0
- vbi/models/cpp/_src/makefile +52 -0
- vbi/models/cpp/_src/mpr_sde.hpp +327 -0
- vbi/models/cpp/_src/mpr_sde.i +19 -0
- vbi/models/cpp/_src/mpr_sde.py +711 -0
- vbi/models/cpp/_src/mpr_sde_wrap.cxx +18618 -0
- vbi/models/cpp/_src/utility.hpp +307 -0
- vbi/models/cpp/_src/vep.hpp +171 -0
- vbi/models/cpp/_src/vep.i +16 -0
- vbi/models/cpp/_src/vep.py +464 -0
- vbi/models/cpp/_src/vep_wrap.cxx +12968 -0
- vbi/models/cpp/_src/wc_ode.hpp +294 -0
- vbi/models/cpp/_src/wc_ode.i +19 -0
- vbi/models/cpp/_src/wc_ode.py +686 -0
- vbi/models/cpp/_src/wc_ode_wrap.cxx +24263 -0
- vbi/models/cpp/damp_oscillator.py +143 -0
- vbi/models/cpp/jansen_rit.py +543 -0
- vbi/models/cpp/km.py +187 -0
- vbi/models/cpp/mpr.py +289 -0
- vbi/models/cpp/vep.py +150 -0
- vbi/models/cpp/wc.py +216 -0
- vbi/models/cupy/__init__.py +0 -0
- vbi/models/cupy/bold.py +111 -0
- vbi/models/cupy/ghb.py +284 -0
- vbi/models/cupy/jansen_rit.py +473 -0
- vbi/models/cupy/km.py +224 -0
- vbi/models/cupy/mpr.py +475 -0
- vbi/models/cupy/mpr_modified_bold.py +12 -0
- vbi/models/cupy/utils.py +184 -0
- vbi/models/numba/__init__.py +0 -0
- vbi/models/numba/_ww_EI.py +444 -0
- vbi/models/numba/damp_oscillator.py +162 -0
- vbi/models/numba/ghb.py +208 -0
- vbi/models/numba/mpr.py +383 -0
- vbi/models/pytorch/__init__.py +0 -0
- vbi/models/pytorch/data/default_parameters.npz +0 -0
- vbi/models/pytorch/data/input/ROI_sim.mat +0 -0
- vbi/models/pytorch/data/input/fc_test.csv +68 -0
- vbi/models/pytorch/data/input/fc_train.csv +68 -0
- vbi/models/pytorch/data/input/fc_vali.csv +68 -0
- vbi/models/pytorch/data/input/fcd_test.mat +0 -0
- vbi/models/pytorch/data/input/fcd_test_high_window.mat +0 -0
- vbi/models/pytorch/data/input/fcd_test_low_window.mat +0 -0
- vbi/models/pytorch/data/input/fcd_train.mat +0 -0
- vbi/models/pytorch/data/input/fcd_vali.mat +0 -0
- vbi/models/pytorch/data/input/myelin.csv +68 -0
- vbi/models/pytorch/data/input/rsfc_gradient.csv +68 -0
- vbi/models/pytorch/data/input/run_label_testset.mat +0 -0
- vbi/models/pytorch/data/input/sc_test.csv +68 -0
- vbi/models/pytorch/data/input/sc_train.csv +68 -0
- vbi/models/pytorch/data/input/sc_vali.csv +68 -0
- vbi/models/pytorch/data/obs_kong0.npz +0 -0
- vbi/models/pytorch/ww_sde_kong.py +570 -0
- vbi/models/tvbk/__init__.py +9 -0
- vbi/models/tvbk/tvbk_wrapper.py +166 -0
- vbi/models/tvbk/utils.py +72 -0
- vbi/papers/__init__.py +0 -0
- vbi/papers/pavlides_pcb_2015/pavlides.py +211 -0
- vbi/tests/__init__.py +0 -0
- vbi/tests/_test_mpr_nb.py +36 -0
- vbi/tests/test_features.py +355 -0
- vbi/tests/test_ghb_cupy.py +90 -0
- vbi/tests/test_mpr_cupy.py +49 -0
- vbi/tests/test_mpr_numba.py +84 -0
- vbi/tests/test_suite.py +19 -0
- vbi/utils.py +402 -0
- vbi-0.1.3.dist-info/METADATA +166 -0
- vbi-0.1.3.dist-info/RECORD +121 -0
- vbi-0.1.3.dist-info/WHEEL +5 -0
- vbi-0.1.3.dist-info/licenses/LICENSE +201 -0
- vbi-0.1.3.dist-info/top_level.txt +1 -0
@@ -0,0 +1,158 @@
|
|
1
|
+
#ifndef KM_SDE_HPP
|
2
|
+
#define KM_SDE_HPP
|
3
|
+
|
4
|
+
#include <cmath>
|
5
|
+
#include <vector>
|
6
|
+
#include <string>
|
7
|
+
#include <random>
|
8
|
+
#include <fstream>
|
9
|
+
#include <assert.h>
|
10
|
+
#include <iostream>
|
11
|
+
#include <omp.h>
|
12
|
+
#include "utility.hpp"
|
13
|
+
|
14
|
+
using std::string;
|
15
|
+
using std::vector;
|
16
|
+
|
17
|
+
typedef std::vector<double> dim1;
|
18
|
+
typedef std::vector<dim1> dim2;
|
19
|
+
typedef std::vector<float> dim1f;
|
20
|
+
typedef std::vector<dim1f> dim2f;
|
21
|
+
typedef std::vector<size_t> dim1i;
|
22
|
+
typedef std::vector<dim1i> dim2i;
|
23
|
+
typedef std::vector<std::vector<unsigned>> dim2I;
|
24
|
+
|
25
|
+
class KM_sde
|
26
|
+
{
|
27
|
+
/*
|
28
|
+
Kuramoto model with stochastic noise
|
29
|
+
solve the SDE using heun's stochastic integration scheme.
|
30
|
+
*/
|
31
|
+
|
32
|
+
private:
|
33
|
+
double dt;
|
34
|
+
double t_initial;
|
35
|
+
double t_transition;
|
36
|
+
double t_end;
|
37
|
+
double G;
|
38
|
+
double noise_amp;
|
39
|
+
dim1 theta;
|
40
|
+
dim1 omega;
|
41
|
+
dim2 alpha;
|
42
|
+
dim2 weights;
|
43
|
+
int num_nodes;
|
44
|
+
dim2 Theta;
|
45
|
+
dim1 times;
|
46
|
+
dim2I adjlist;
|
47
|
+
size_t num_steps;
|
48
|
+
size_t num_steps_transition;
|
49
|
+
size_t fix_seed;
|
50
|
+
size_t buffer_size;
|
51
|
+
|
52
|
+
public:
|
53
|
+
KM_sde(double dt,
|
54
|
+
double t_initial,
|
55
|
+
double t_transition,
|
56
|
+
double t_end,
|
57
|
+
double G,
|
58
|
+
double noise_amp,
|
59
|
+
dim1 theta,
|
60
|
+
dim1 omega,
|
61
|
+
dim2 alpha,
|
62
|
+
dim2 weights,
|
63
|
+
size_t fix_seed = 0,
|
64
|
+
size_t num_threads = 1
|
65
|
+
)
|
66
|
+
{
|
67
|
+
num_nodes = theta.size();
|
68
|
+
this->dt = dt;
|
69
|
+
this->t_initial = t_initial;
|
70
|
+
this->t_transition = t_transition;
|
71
|
+
this->t_end = t_end;
|
72
|
+
this->G = G;
|
73
|
+
this->theta = theta;
|
74
|
+
this->omega = omega;
|
75
|
+
this->alpha = alpha;
|
76
|
+
this->weights = weights;
|
77
|
+
this->noise_amp = noise_amp;
|
78
|
+
this->fix_seed = fix_seed;
|
79
|
+
|
80
|
+
omp_set_num_threads(num_threads);
|
81
|
+
|
82
|
+
adjlist = adjmat_to_adjlist(weights);
|
83
|
+
num_steps = int((t_end - t_initial) / dt);
|
84
|
+
num_steps_transition = int((t_transition - t_initial) / dt);
|
85
|
+
buffer_size = num_steps - num_steps_transition;
|
86
|
+
Theta.resize(buffer_size);
|
87
|
+
for (size_t i = 0; i < buffer_size; i++)
|
88
|
+
{
|
89
|
+
Theta[i].resize(num_nodes);
|
90
|
+
}
|
91
|
+
times.resize(buffer_size);
|
92
|
+
}
|
93
|
+
|
94
|
+
void rhs_f(dim1 &theta, dim1 &dtheta, const double /*t*/)
|
95
|
+
{
|
96
|
+
double sumj = 0.0;
|
97
|
+
#pragma omp parallel for reduction(+ : sumj)
|
98
|
+
for (int i = 0; i < num_nodes; i++)
|
99
|
+
{
|
100
|
+
sumj = 0.0;
|
101
|
+
for (int j = 0; j < adjlist[i].size(); j++)
|
102
|
+
{
|
103
|
+
int k = adjlist[i][j];
|
104
|
+
sumj += weights[i][k] * sin(theta[k] - theta[i] - alpha[i][k]);
|
105
|
+
}
|
106
|
+
dtheta[i] = omega[i] + G * sumj;
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
110
|
+
void heun(dim1 &y, const double t)
|
111
|
+
{
|
112
|
+
std::normal_distribution<> normal(0, 1);
|
113
|
+
|
114
|
+
size_t nn = num_nodes;
|
115
|
+
dim1 tmp(nn);
|
116
|
+
dim1 k1(nn);
|
117
|
+
dim1 k2(nn);
|
118
|
+
|
119
|
+
rhs_f(y, k1, t);
|
120
|
+
|
121
|
+
for (size_t i = 0; i < nn; ++i)
|
122
|
+
tmp[i] = y[i] + dt * k1[i] + noise_amp * normal(rng(fix_seed));
|
123
|
+
|
124
|
+
rhs_f(tmp, k2, t + dt);
|
125
|
+
for (size_t i = 0; i < nn; ++i)
|
126
|
+
y[i] += 0.5 * dt * (k1[i] + k2[i]) + noise_amp * normal(rng(fix_seed));
|
127
|
+
|
128
|
+
}
|
129
|
+
|
130
|
+
void IntegrateHeun()
|
131
|
+
{
|
132
|
+
for (size_t i = 0; i < num_steps_transition; i++)
|
133
|
+
{
|
134
|
+
heun(theta, t_initial);
|
135
|
+
t_initial += dt;
|
136
|
+
}
|
137
|
+
|
138
|
+
for (size_t i = 0; i < buffer_size; i++)
|
139
|
+
{
|
140
|
+
heun(theta, t_initial);
|
141
|
+
Theta[i] = theta;
|
142
|
+
times[i] = t_initial;
|
143
|
+
t_initial += dt;
|
144
|
+
}
|
145
|
+
}
|
146
|
+
|
147
|
+
dim1 get_times()
|
148
|
+
{
|
149
|
+
return times;
|
150
|
+
}
|
151
|
+
|
152
|
+
dim2 get_theta()
|
153
|
+
{
|
154
|
+
return Theta;
|
155
|
+
}
|
156
|
+
};
|
157
|
+
|
158
|
+
#endif
|
@@ -0,0 +1,19 @@
|
|
1
|
+
|
2
|
+
%module km_sde
|
3
|
+
|
4
|
+
%{
|
5
|
+
#include "km_sde.hpp"
|
6
|
+
%}
|
7
|
+
|
8
|
+
%include stl.i
|
9
|
+
%include <std_vector.i>
|
10
|
+
%include "std_string.i"
|
11
|
+
namespace std {
|
12
|
+
%template(IntVector) std::vector<int>;
|
13
|
+
%template(DoubleVector) std::vector<double>;
|
14
|
+
%template(DoubleVector2) std::vector<vector<double> >;
|
15
|
+
%template(SingleVector) std::vector<float>;
|
16
|
+
%template(SingleVector2) std::vector<vector<float> >;
|
17
|
+
}
|
18
|
+
|
19
|
+
%include "km_sde.hpp"
|