|
| 1 | +import numpy as np |
| 2 | + |
| 3 | +from ...utils.collections import dotdict |
| 4 | + |
| 5 | + |
| 6 | +def loadDefaultParams(Cmat=None, Dmat=None, seed=None): |
| 7 | + """Load default parameters for the Wong-Wang model |
| 8 | +
|
| 9 | + :param Cmat: Structural connectivity matrix (adjacency matrix) of coupling strengths, will be normalized to 1. If not given, then a single node simulation will be assumed, defaults to None |
| 10 | + :type Cmat: numpy.ndarray, optional |
| 11 | + :param Dmat: Fiber length matrix, will be used for computing the delay matrix together with the signal transmission speed parameter `signalV`, defaults to None |
| 12 | + :type Dmat: numpy.ndarray, optional |
| 13 | + :param seed: Seed for the random number generator, defaults to None |
| 14 | + :type seed: int, optional |
| 15 | +
|
| 16 | + :return: A dictionary with the default parameters of the model |
| 17 | + :rtype: dict |
| 18 | + """ |
| 19 | + |
| 20 | + params = dotdict({}) |
| 21 | + |
| 22 | + ### runtime parameters |
| 23 | + params.dt = 0.1 # ms 0.1ms is reasonable |
| 24 | + params.duration = 2000 # Simulation duration (ms) |
| 25 | + np.random.seed(seed) # seed for RNG of noise and ICs |
| 26 | + params.seed = seed |
| 27 | + |
| 28 | + # ------------------------------------------------------------------------ |
| 29 | + # global whole-brain network parameters |
| 30 | + # ------------------------------------------------------------------------ |
| 31 | + |
| 32 | + # signal transmission speec between areas |
| 33 | + params.signalV = 20.0 |
| 34 | + params.K_gl = 0.6 # global coupling strength |
| 35 | + |
| 36 | + if Cmat is None: |
| 37 | + params.N = 1 |
| 38 | + params.Cmat = np.zeros((1, 1)) |
| 39 | + params.lengthMat = np.zeros((1, 1)) |
| 40 | + |
| 41 | + else: |
| 42 | + params.Cmat = Cmat.copy() # coupling matrix |
| 43 | + np.fill_diagonal(params.Cmat, 0) # no self connections |
| 44 | + params.N = len(params.Cmat) # number of nodes |
| 45 | + params.lengthMat = Dmat |
| 46 | + |
| 47 | + # ------------------------------------------------------------------------ |
| 48 | + # local node parameters |
| 49 | + # ------------------------------------------------------------------------ |
| 50 | + |
| 51 | + # # the coupling parameter determines how nodes are coupled. |
| 52 | + # # "original" for original wong-wang model, "reduced" for reduced wong-wang model |
| 53 | + # params.version = "original" |
| 54 | + |
| 55 | + # external noise parameters: |
| 56 | + params.tau_ou = 5.0 # ms Timescale of the Ornstein-Uhlenbeck noise process |
| 57 | + params.sigma_ou = 0.0 # noise intensity |
| 58 | + params.exc_ou_mean = 0.0 # OU process mean |
| 59 | + params.inh_ou_mean = 0.0 # OU process mean |
| 60 | + |
| 61 | + # neural mass model parameters |
| 62 | + params.a_exc = 0.31 # nC^-1 |
| 63 | + params.b_exc = 0.125 # kHz |
| 64 | + params.d_exc = 160.0 # ms |
| 65 | + params.tau_exc = 100.0 # ms |
| 66 | + params.gamma_exc = 0.641 |
| 67 | + params.w_exc = 1.0 |
| 68 | + params.exc_current = 0.382 # nA |
| 69 | + |
| 70 | + params.a_inh = 0.615 # nC^-1 |
| 71 | + params.b_inh = 0.177 # kHz |
| 72 | + params.d_inh = 87.0 # ms |
| 73 | + params.tau_inh = 10.0 # ms |
| 74 | + params.w_inh = 0.7 |
| 75 | + params.inh_current = 0.382 # nA |
| 76 | + |
| 77 | + params.J_NMDA = 0.15 # nA, excitatory synaptic coupling |
| 78 | + params.J_I = 1.0 # nA, inhibitory synaptic coupling |
| 79 | + params.w_ee = 1.4 # excitatory feedback coupling strength |
| 80 | + |
| 81 | + # ------------------------------------------------------------------------ |
| 82 | + |
| 83 | + params.ses_init = 0.05 * np.random.uniform(0, 1, (params.N, 1)) |
| 84 | + params.sis_init = 0.05 * np.random.uniform(0, 1, (params.N, 1)) |
| 85 | + |
| 86 | + # Ornstein-Uhlenbeck noise state variables |
| 87 | + params.exc_ou = np.zeros((params.N,)) |
| 88 | + params.inh_ou = np.zeros((params.N,)) |
| 89 | + |
| 90 | + return params |
| 91 | + |
| 92 | + |
| 93 | +def computeDelayMatrix(lengthMat, signalV, segmentLength=1): |
| 94 | + """Compute the delay matrix from the fiber length matrix and the signal velocity |
| 95 | +
|
| 96 | + :param lengthMat: A matrix containing the connection length in segment |
| 97 | + :param signalV: Signal velocity in m/s |
| 98 | + :param segmentLength: Length of a single segment in mm |
| 99 | +
|
| 100 | + :returns: A matrix of connexion delay in ms |
| 101 | + """ |
| 102 | + |
| 103 | + normalizedLenMat = lengthMat * segmentLength |
| 104 | + # Interareal connection delays, Dmat(i,j) in ms |
| 105 | + if signalV > 0: |
| 106 | + Dmat = normalizedLenMat / signalV |
| 107 | + else: |
| 108 | + Dmat = lengthMat * 0.0 |
| 109 | + return Dmat |
0 commit comments