TheVirtualBrain:

TheDocumentationwebsite.

Table Of Contents

Previous topic

cosimulation Package

Next topic

simple Package

This Page

parallel Package

ReducedWongWang

This model is an example of used the cosimulation with a nonstate variable. It’s used by the other test for testing the co-simulation

class tvb.contrib.tests.cosimulation.parallel.ReducedWongWang.ReducedWongWangProxy(**kwargs)[source]

Bases: tvb.simulator.models.wong_wang.ReducedWongWang

modify class in order to take in count proxy firing rate and to monitor the firing rate
state_variable_range : tvb.contrib.tests.cosimulation.parallel.ReducedWongWang.ReducedWongWangProxy.state_variable_range = Final(field_type=<class ‘dict’>, default={‘S’: array([0., 1.]), ‘H’: array([0., 0.])}, required=True)
Population firing rate
variables_of_interest : tvb.contrib.tests.cosimulation.parallel.ReducedWongWang.ReducedWongWangProxy.variables_of_interest = List(of=<class ‘str’>, default=(‘S’, ‘H’), required=True)
default state variables to be monitored
a : tvb.simulator.models.wong_wang.ReducedWongWang.a = NArray(label=’\(a\)‘, dtype=float64, default=array([0.27]), dim_names=(), ndim=None, required=True)
[n/C]. Input gain parameter, chosen to fit numerical solutions.
b : tvb.simulator.models.wong_wang.ReducedWongWang.b = NArray(label=’\(b\)‘, dtype=float64, default=array([0.108]), dim_names=(), ndim=None, required=True)
[kHz]. Input shift parameter chosen to fit numerical solutions.
d : tvb.simulator.models.wong_wang.ReducedWongWang.d = NArray(label=’\(d\)‘, dtype=float64, default=array([154.]), dim_names=(), ndim=None, required=True)
[ms]. Parameter chosen to fit numerical solutions.
gamma : tvb.simulator.models.wong_wang.ReducedWongWang.gamma = NArray(label=’\(\\gamma\)‘, dtype=float64, default=array([0.641]), dim_names=(), ndim=None, required=True)
Kinetic parameter
tau_s : tvb.simulator.models.wong_wang.ReducedWongWang.tau_s = NArray(label=’\(\\tau_S\)‘, dtype=float64, default=array([100.]), dim_names=(), ndim=None, required=True)
Kinetic parameter. NMDA decay time constant.
w : tvb.simulator.models.wong_wang.ReducedWongWang.w = NArray(label=’\(w\)‘, dtype=float64, default=array([0.6]), dim_names=(), ndim=None, required=True)
Excitatory recurrence
J_N : tvb.simulator.models.wong_wang.ReducedWongWang.J_N = NArray(label=’\(J_{N}\)‘, dtype=float64, default=array([0.2609]), dim_names=(), ndim=None, required=True)
Excitatory recurrence
I_o : tvb.simulator.models.wong_wang.ReducedWongWang.I_o = NArray(label=’\(I_{o}\)‘, dtype=float64, default=array([0.33]), dim_names=(), ndim=None, required=True)
[nA] Effective external input
sigma_noise : tvb.simulator.models.wong_wang.ReducedWongWang.sigma_noise = NArray(label=’\(\\sigma_{noise}\)‘, dtype=float64, default=array([1.e-09]), dim_names=(), ndim=None, required=True)
[nA] Noise amplitude. Take this value into account for stochatic integration schemes.
state_variable_boundaries : tvb.simulator.models.wong_wang.ReducedWongWang.state_variable_boundaries = Final(field_type=<class ‘dict’>, default={‘S’: array([0., 1.])}, required=True)
The values for each state-variable should be set to encompass the boundaries of the dynamic range of that state-variable. Set None for one-sided boundaries

gid : tvb.basic.neotraits._core.HasTraits.gid = Attr(field_type=<class ‘uuid.UUID’>, default=None, required=True)

H_save = None
dfun(x, c, local_coupling=0.0)[source]
non_integrated_variables = ['H']
state_variable_range

An attribute that can only be set once. If a default is provided it counts as a set, so it cannot be written to. Note that if the default is a mutable type, the value is shared with all instances of the owning class. We cannot enforce true constancy in python

state_variables = ['S', 'H']
update_state_variables_after_integration(X)[source]
update_state_variables_before_integration(x, c, local_coupling=0.0, stimulus=0.0)[source]
variables_of_interest

The attribute is a list of values. Choices and type are reinterpreted as applying not to the list but to the elements of it

double_proxy_precision_complex_delay_update_test

class tvb.contrib.tests.cosimulation.parallel.double_proxy_precision_complex_delay_update_test.TestDoubleProxyPrecisionComplexDelayUpdate[source]

Bases: tvb.tests.library.base_testcase.BaseTestCase

test the transmission of information between two models with proxy in most complex case and different delay

test_double_precision_complex_delay_update()[source]

double_proxy_precision_complex_test

class tvb.contrib.tests.cosimulation.parallel.double_proxy_precision_complex_test.TestDoubleProxyPrecisionComplex[source]

Bases: tvb.tests.library.base_testcase.BaseTestCase

test the transmission of information between two model with proxy in most complex case

test_double_precision_complex()[source]

double_proxy_precision_simple_test

class tvb.contrib.tests.cosimulation.parallel.double_proxy_precision_simple_test.TestDoubleProxyPrecisionSimple[source]

Bases: tvb.tests.library.base_testcase.BaseTestCase

test the transmission of information between two model with proxy in simple case

test_double_precision_simple()[source]

function_tvb

class tvb.contrib.tests.cosimulation.parallel.function_tvb.TvbSim(weight, delay, id_proxy, resolution_simulation, synchronization_time, initial_condition=None)[source]

Bases: builtins.object

transform_rate_to_s(rate_data)[source]

Transform the rate in percentage of open synapse :param rate_data: rate data :return: the percentage of open synapse

tvb.contrib.tests.cosimulation.parallel.function_tvb.tvb_init(parameters, time_synchronize, initial_condition)[source]
To initialise Nest and to create the connectome model

:param parameters : (model,connectivity,coupling,integrator) : parameter for the simulation without monitor :param time_synchronize : the time of synchronization for the proxy :param initial_condition: the initial condition of the model :return:

sim : the TVB simulator, (weights_in,delay_in): the connectivity of disconnect region input (weights_out,delay_out): the connectivity of disconnect region ouput
tvb.contrib.tests.cosimulation.parallel.function_tvb.tvb_model(dt, weight, delay, id_proxy)[source]

Initialise TVB with Wong-Wang models and default connectivity

WARNING : in this first example most of the parameter for the simulation is define. In the future, this function will be disappear and replace only by the tvb_init. This function is only here in order to constraint the usage

of proxy
Parameters:
  • dt – the resolution of the raw monitor (ms)
  • weight – weight on the connexion
  • delay – delay on the connexion
  • id_proxy – id of the proxy
Returns:

populations: model in TVB white_matter: Connectivity in TVB white_matter_coupling: Coupling in TVB heunint: Integrator in TVB what_to_watch: Monitor in TVB

tvb.contrib.tests.cosimulation.parallel.function_tvb.tvb_simulation(time, sim, data_proxy)[source]

Simulate t->t+dt: :param time: the time of simulation :param sim: the simulator :param data_proxy : the firing rate of the next steps :return:

the time, the firing rate and the state of the network

modify_wongwang_precision_test

class tvb.contrib.tests.cosimulation.parallel.modify_wongwang_precision_test.TestModifyWongWang[source]

Bases: tvb.tests.library.base_testcase.BaseTestCase

test for compare the version in tvb and the modified version in different condition

test_precision_with_proxy()[source]
test_with_no_cosimulation()[source]

monitors_test

class tvb.contrib.tests.cosimulation.parallel.monitors_test.TestMonitors[source]

Bases: tvb.tests.library.base_testcase.BaseTestCase

test for compare the version in tvb and the modified version in different condition

test_monitor()[source]

proxy_precision_bad_test

class tvb.contrib.tests.cosimulation.parallel.proxy_precision_bad_test.TestPrecisionBad[source]

Bases: tvb.tests.library.base_testcase.BaseTestCase

Compare the result between simulation with one proxy and without proxy but whith the wrong value at the beginning

test_precision_bad()[source]

proxy_precision_delay_test

class tvb.contrib.tests.cosimulation.parallel.proxy_precision_delay_test.TestPrecisionDelay[source]

Bases: tvb.tests.library.base_testcase.BaseTestCase

compare the result between simulation with one proxy and without proxy and different delay

test_precision_delay()[source]

proxy_precision_delay_update_test

class tvb.contrib.tests.cosimulation.parallel.proxy_precision_delay_update_test.TestPrecisionDelayUpdate[source]

Bases: tvb.tests.library.base_testcase.BaseTestCase

compare the result between simulation with 1-3 proxy and without proxy and different delay

test_precision_delay_update()[source]

proxy_precision_multiple_delay_update_test

class tvb.contrib.tests.cosimulation.parallel.proxy_precision_multiple_delay_update_test.TestPrecisionMultipleDelayUpdate[source]

Bases: tvb.tests.library.base_testcase.BaseTestCase

Compare the result between simulation with 1-3 proxy and without proxy and different delay

test_precision_multiple_delay_update()[source]

proxy_precision_multiple_test

class tvb.contrib.tests.cosimulation.parallel.proxy_precision_multiple_test.TestPrecisionMultiple[source]

Bases: tvb.tests.library.base_testcase.BaseTestCase

compare the result between simulation with one proxy and without proxy and different delay

test_precision_multiple()[source]

proxy_precision_test

class tvb.contrib.tests.cosimulation.parallel.proxy_precision_test.TestPrecision[source]

Bases: tvb.tests.library.base_testcase.BaseTestCase

Compare the result between simulation with one proxy and without proxy

test_precision()[source]

update_function_test

class tvb.contrib.tests.cosimulation.parallel.update_function_test.TestUpdateModel[source]

Bases: tvb.tests.library.base_testcase.BaseTestCase

test the function of function_tvb

test_update_model()[source]