OSCR

Realistic coupling enables flexible macroscopic traveling waves in the mouse cortex.

Code ↔ Paper

1 match between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

The 1 match
  1. [1] § Materials and methods › Simulation ↔ code_simulation.zip/coupling_speed_test/ephys.cu, lines 27–123 · score 0.57 · gate variables, 0.02–0.05, simulation, voltage, uniform

Paper

Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

CUDA · 403 lines · 19 KB · CC-BY-4.0 · 1 match

  1. #include "ephys.cuh"
  2. # define M_PI 3.14159265358979323846 /* pi */
  3. Ephys::~Ephys()
  4. {
  5. for (Float*& dev_ptr : sim_vars_cpu)
  6. cudaFree(dev_ptr);
  7. }
  8. HHEphys::HHEphys(int const N_)
  9. : Ephys(N_, HH::leapfrog_dt)
  10. {
  11. using namespace HH;
  12. // Set up simulation variables. Stored in a struct of arrays.
  13. sim_vars_cpu.resize(Params::PARAM_COUNT);
  14. thrust::host_vector<Float> cpu_arr(N, 0);
  15. // Zero arrays.
  16. for (Float*& arr : sim_vars_cpu)
  17. {
  18. cudaMalloc(&arr, N * sizeof(Float));
  19. cudaMemcpy(arr, cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  20. }
  21. sim_vars = sim_vars_cpu;
  22. SetVariablesRandomly();
  23. }
  24. void HHEphys::SetVariablesRandomly()
  25. {
  26. using namespace HH;
  27. thrust::host_vector<Float> cpu_arr(N, 0.05);
  28. thrust::fill_n(cpu_arr.begin(), N, g_ampa_white);
  29. cudaMemcpy(sim_vars_cpu[Params::G_AMPA_WHITE], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  30. thrust::fill_n(cpu_arr.begin(), N, g_ampa_grey);
  31. cudaMemcpy(sim_vars_cpu[Params::G_AMPA_GREY], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  32. thrust::fill_n(cpu_arr.begin(), N, g_gaba);
  33. cudaMemcpy(sim_vars_cpu[Params::G_GABA], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  34. // Set voltages randomly
  35. auto& gen{ Utility::GetRandomEngine() };
  36. std::normal_distribution<> voltage_dist(-65,-5);
  37. for (auto& val : cpu_arr)
  38. val = voltage_dist(gen);
  39. cudaMemcpy(sim_vars_cpu[Params::V], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  40. // Set gating variables
  41. std::uniform_real_distribution<Float> gating_var_dist(0.02, 0.05);
  42. for (auto& val : cpu_arr)
  43. val = gating_var_dist(gen);
  44. cudaMemcpy(sim_vars_cpu[Params::M], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  45. for (auto& val : cpu_arr)
  46. val = gating_var_dist(gen);
  47. cudaMemcpy(sim_vars_cpu[Params::H], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  48. for (auto& val : cpu_arr)
  49. val = gating_var_dist(gen);
  50. cudaMemcpy(sim_vars_cpu[Params::N], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  51. for (auto& val : cpu_arr)
  52. val = gating_var_dist(gen);
  53. cudaMemcpy(sim_vars_cpu[Params::P], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  54. for (auto& val : cpu_arr)
  55. val = gating_var_dist(gen);
  56. cudaMemcpy(sim_vars_cpu[Params::Q], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  57. for (auto& val : cpu_arr)
  58. val = gating_var_dist(gen);
  59. cudaMemcpy(sim_vars_cpu[Params::R], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  60. for (auto& val : cpu_arr)
  61. val = gating_var_dist(gen);
  62. cudaMemcpy(sim_vars_cpu[Params::S], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  63. for (auto& val : cpu_arr)
  64. val = gating_var_dist(gen);
  65. cudaMemcpy(sim_vars_cpu[Params::U], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  66. thrust::host_vector<Float> ei_info(N, 0.0);
  67. cudaMemcpy(sim_vars_cpu[Params::EI_INFO], ei_info.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  68. thrust::host_vector<Float> type_info(N, 0.0);
  69. cudaMemcpy(sim_vars_cpu[Params::TYPE_INFO], type_info.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  70. thrust::fill_n(cpu_arr.begin(), N, 0.05);
  71. //cudaMemcpy(sim_vars_cpu[Params::LOCAL_IY], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  72. //cudaMemcpy(sim_vars_cpu[Params::LOCAL_EY], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  73. cudaMemcpy(sim_vars_cpu[Params::IY], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  74. cudaMemcpy(sim_vars_cpu[Params::EY], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  75. // No neurotransmitter input/output or connections
  76. thrust::fill_n(cpu_arr.begin(), N, 0.001);
  77. cudaMemcpy(sim_vars_cpu[Params::LOCAL_IOUTPUT], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  78. cudaMemcpy(sim_vars_cpu[Params::LOCAL_IIN], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  79. cudaMemcpy(sim_vars_cpu[Params::LOCAL_ICOUNT], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  80. cudaMemcpy(sim_vars_cpu[Params::LOCAL_EOUTPUT], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  81. cudaMemcpy(sim_vars_cpu[Params::LOCAL_EIN], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  82. cudaMemcpy(sim_vars_cpu[Params::LOCAL_ECOUNT], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  83. cudaMemcpy(sim_vars_cpu[Params::IOUTPUT], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  84. cudaMemcpy(sim_vars_cpu[Params::IIN], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  85. cudaMemcpy(sim_vars_cpu[Params::ICOUNT], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  86. cudaMemcpy(sim_vars_cpu[Params::EOUTPUT], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  87. cudaMemcpy(sim_vars_cpu[Params::EIN], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  88. cudaMemcpy(sim_vars_cpu[Params::ECOUNT], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  89. // Set applied current
  90. //thrust::fill_n(cpu_arr.begin(), N, appcur);
  91. std::normal_distribution<Float> appcur_dist(appcur, 0.0);
  92. for (auto& val : cpu_arr) {
  93. val = appcur_dist(gen);
  94. }
  95. cudaMemcpy(sim_vars_cpu[Params::APPCUR], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  96. gpuErrchk(cudaDeviceSynchronize());
  97. // Copy pointers from CPU to GPU
  98. sim_vars = sim_vars_cpu;
  99. }
  100. void HHEphys::RandomizeInitialConditionsKeepEI()
  101. {
  102. using namespace HH;
  103. thrust::host_vector<Float> cpu_arr(N, 0.05);
  104. thrust::fill_n(cpu_arr.begin(), N, g_ampa_white);
  105. cudaMemcpy(sim_vars_cpu[Params::G_AMPA_WHITE], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  106. thrust::fill_n(cpu_arr.begin(), N, g_ampa_grey);
  107. cudaMemcpy(sim_vars_cpu[Params::G_AMPA_GREY], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  108. thrust::fill_n(cpu_arr.begin(), N, g_gaba);
  109. cudaMemcpy(sim_vars_cpu[Params::G_GABA], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  110. auto& gen{ Utility::GetRandomEngine() };
  111. std::normal_distribution<> voltage_dist(-65, -5);
  112. for (auto& val : cpu_arr)
  113. val = voltage_dist(gen);
  114. cudaMemcpy(sim_vars_cpu[Params::V], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  115. std::uniform_real_distribution<Float> gating_var_dist(0.02, 0.05);
  116. for (auto& val : cpu_arr)
  117. val = gating_var_dist(gen);
  118. cudaMemcpy(sim_vars_cpu[Params::M], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  119. for (auto& val : cpu_arr)
  120. val = gating_var_dist(gen);
  121. cudaMemcpy(sim_vars_cpu[Params::H], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  122. for (auto& val : cpu_arr)
  123. val = gating_var_dist(gen);
  124. cudaMemcpy(sim_vars_cpu[Params::N], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  125. for (auto& val : cpu_arr)
  126. val = gating_var_dist(gen);
  127. cudaMemcpy(sim_vars_cpu[Params::P], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  128. for (auto& val : cpu_arr)
  129. val = gating_var_dist(gen);
  130. cudaMemcpy(sim_vars_cpu[Params::Q], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  131. for (auto& val : cpu_arr)
  132. val = gating_var_dist(gen);
  133. cudaMemcpy(sim_vars_cpu[Params::R], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  134. for (auto& val : cpu_arr)
  135. val = gating_var_dist(gen);
  136. cudaMemcpy(sim_vars_cpu[Params::S], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  137. for (auto& val : cpu_arr)
  138. val = gating_var_dist(gen);
  139. cudaMemcpy(sim_vars_cpu[Params::U], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  140. thrust::fill_n(cpu_arr.begin(), N, 0.05);
  141. cudaMemcpy(sim_vars_cpu[Params::IY], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  142. cudaMemcpy(sim_vars_cpu[Params::EY], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  143. thrust::fill_n(cpu_arr.begin(), N, 0.001);
  144. cudaMemcpy(sim_vars_cpu[Params::LOCAL_IOUTPUT], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  145. cudaMemcpy(sim_vars_cpu[Params::LOCAL_IIN], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  146. cudaMemcpy(sim_vars_cpu[Params::LOCAL_ICOUNT], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  147. cudaMemcpy(sim_vars_cpu[Params::LOCAL_EOUTPUT], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  148. cudaMemcpy(sim_vars_cpu[Params::LOCAL_EIN], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  149. cudaMemcpy(sim_vars_cpu[Params::LOCAL_ECOUNT], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  150. cudaMemcpy(sim_vars_cpu[Params::IOUTPUT], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  151. cudaMemcpy(sim_vars_cpu[Params::IIN], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  152. cudaMemcpy(sim_vars_cpu[Params::ICOUNT], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  153. cudaMemcpy(sim_vars_cpu[Params::EOUTPUT], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  154. cudaMemcpy(sim_vars_cpu[Params::EIN], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  155. cudaMemcpy(sim_vars_cpu[Params::ECOUNT], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  156. thrust::fill_n(cpu_arr.begin(), N, 0.0f);
  157. cudaMemcpy(sim_vars_cpu[Params::APPCUR], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
  158. gpuErrchk(cudaDeviceSynchronize());
  159. sim_vars = sim_vars_cpu;
  160. }
  161. __global__ void init_random(unsigned int seed, int const N, curandState_t* states)
  162. {
  163. for (int idx = blockIdx.x * blockDim.x + threadIdx.x; idx < N; idx += gridDim.x * blockDim.x)
  164. {
  165. curand_init(seed, idx, 0, &states[idx]);
  166. }
  167. }
  168. __global__ void get_random_test(curandState_t* states, int const N, int* numbers)
  169. {
  170. for (int idx = blockIdx.x * blockDim.x + threadIdx.x; idx < N; idx += gridDim.x * blockDim.x)
  171. {
  172. numbers[idx] = curand(&states[idx]) % 100;
  173. }
  174. }
  175. Ephys::Ephys(int const N_, Float const dt_) : N{ N_ }, dt{ dt_ }, random_states(N_)
  176. {
  177. #if USE_FIXED_RANDOM_SEED
  178. unsigned int seed = 0;
  179. #else
  180. unsigned int seed = time(NULL);
  181. #endif
  182. // Setup random seeds.
  183. init_random<<<NBLOCKS, NTHREADS>>>(seed, N, thrust::raw_pointer_cast(random_states.data()));
  184. gpuErrchk( cudaPeekAtLastError() );
  185. gpuErrchk( cudaDeviceSynchronize() );
  186. }
  187. __global__ void Leapfrog_HH(Float** sim_vars, const int N, const Float timestep, curandState_t* random_states)
  188. {
  189. using namespace HH;
  190. Float Vt_d[2] = { -61.5, -61.5};
  191. Float gna_d[2] = { 50, 46};
  192. Float gkd_d[2] = { 4.8, 5.1};
  193. Float gM_d[2] = { 0.13, 0.0};
  194. Float gleak_d[2] = { 0.02, 0.08};
  195. Float tau_max_d[2] = { 1123, 824.5};
  196. Float gT_d[2] = { 0, 0};
  197. Float A_d[2] = { 0.29, 0.22};
  198. for (int idx = blockIdx.x * blockDim.x + threadIdx.x; idx < N; idx += gridDim.x * blockDim.x)
  199. {
  200. Float* V_ptr = sim_vars[Params::V] + idx;
  201. Float* M_ptr = sim_vars[Params::M] + idx;
  202. Float* H_ptr = sim_vars[Params::H] + idx;
  203. Float* N_ptr = sim_vars[Params::N] + idx;
  204. Float* P_ptr = sim_vars[Params::P] + idx;
  205. Float* Q_ptr = sim_vars[Params::Q] + idx;
  206. Float* R_ptr = sim_vars[Params::R] + idx;
  207. Float* S_ptr = sim_vars[Params::S] + idx;
  208. Float* U_ptr = sim_vars[Params::U] + idx;
  209. Float* EY_ptr = sim_vars[Params::EY] + idx;
  210. Float* IY_ptr = sim_vars[Params::IY] + idx;
  211. const Float local_Iin = sim_vars[Params::LOCAL_IIN][idx];
  212. const Float local_Inum_in = sim_vars[Params::LOCAL_ICOUNT][idx];
  213. const Float local_Ein = sim_vars[Params::LOCAL_EIN][idx];
  214. const Float local_Enum_in = sim_vars[Params::LOCAL_ECOUNT][idx];
  215. const Float Iin = sim_vars[Params::IIN][idx];
  216. const Float Inum_in = sim_vars[Params::ICOUNT][idx];
  217. const Float Ein = sim_vars[Params::EIN][idx];
  218. const Float Enum_in = sim_vars[Params::ECOUNT][idx];
  219. const Float appcur = sim_vars[Params::APPCUR][idx];
  220. const Float GAMPA_WHITE = sim_vars[Params::G_AMPA_WHITE][idx];
  221. const Float GAMPA_GREY = sim_vars[Params::G_AMPA_GREY][idx];
  222. const Float GGABA = sim_vars[Params::G_GABA][idx];
  223. const Float ei_info = sim_vars[Params::EI_INFO][idx];
  224. const Float type_info = sim_vars[Params::TYPE_INFO][idx];
  225. const Float V = *V_ptr;
  226. const Float M = *M_ptr;
  227. const Float H = *H_ptr;
  228. const Float N = *N_ptr;
  229. const Float P = *P_ptr;
  230. const Float Q = *Q_ptr;
  231. const Float R = *R_ptr;
  232. const Float S = *S_ptr;
  233. const Float U = *U_ptr;
  234. const Float IY = *IY_ptr;
  235. const Float EY = *EY_ptr;
  236. int neuron_type;
  237. if (type_info < 0.5) {
  238. neuron_type = 0;
  239. }
  240. else {
  241. neuron_type = 1;
  242. }
  243. // Update gating variables first.
  244. Float Vt = Vt_d[neuron_type];
  245. Float aM = -0.32 * (V - Vt - 13) / (exp(-(V - Vt - 13) / 4) - 1);
  246. if ((V - Vt) == 13)
  247. aM = 0.32 * 4;
  248. Float bM = 0.28 * (V - Vt - 40) / (exp((V - Vt - 40) / 5) - 1);
  249. if ((V - Vt) == 40)
  250. bM = 0.28 * 5;
  251. const float new_M = (aM * timestep + (1 - timestep / 2 * (aM + bM)) * M) / (timestep / 2 * (aM + bM) + 1);
  252. Float aH = 0.128 * exp(-(V - Vt - 17) / 18);
  253. Float bH = 4.0 / (1 + exp(-(V - Vt - 40) / 5));
  254. const float new_H = (aH * timestep + (1 - timestep / 2 * (aH + bH)) * H) / (timestep / 2 * (aH + bH) + 1);
  255. Float aN = -0.032 * (V - Vt - 15) / (exp(-(V - Vt - 15) / 5) - 1);
  256. if ((V - Vt) == 15)
  257. aN = 0.032 * 5;
  258. Float bN = 0.5 * exp(-(V - Vt - 10) / 40);
  259. const float new_N = (aN * timestep + (1 - timestep / 2 * (aN + bN)) * N) / (timestep / 2 * (aN + bN) + 1);
  260. Float P_inf = 1 / (1 + exp(-(V + 35) / 10));
  261. Float tau_P = tau_max_d[neuron_type] / (3.3 * exp((V + 35) / 20) + exp(-(V + 35) / 20));
  262. const float new_P = 2 * timestep / (2 * tau_P + timestep) * P_inf + (2 * tau_P - timestep) / (2 * tau_P + timestep) * P;
  263. Float aQ = 0.055 * (-27 - V) / (exp((-27 - V) / 3.8) - 1);
  264. if (V == -27)
  265. aQ = 0.055 * 3.8;
  266. Float bQ = 0.94 * exp((-75 - V) / 17);
  267. const float new_Q = (aQ * timestep + (1 - timestep / 2 * (aQ + bQ)) * Q) / (timestep / 2 * (aQ + bQ) + 1);
  268. Float aR = 0.000457 * exp((-13 - V) / 50);
  269. Float bR = 0.0065 / (exp((-15 - V) / 28) + 1);
  270. const float new_R = (aR * timestep + (1 - timestep / 2 * (aR + bR)) * R) / (timestep / 2 * (aR + bR) + 1);
  271. Float S_inf; Float U_inf; Float tau_U; Float tau_S;
  272. if (neuron_type == 2) {
  273. S_inf = 1 / (1 + exp(-(V + 59) / 6.2));
  274. U_inf = 1 / (1 + exp((V + 83) / 4));
  275. tau_S = 0.13 + 0.22 / (exp(-(V + 132) / 16.7) + exp((V + 16.8) / 18.2));
  276. tau_U = 8.2 + (56.6 + 0.27 * exp((V + 115.2) / 5)) / (1 + exp((V + 86) / 3.2));
  277. }
  278. else {
  279. S_inf = 1 / (1 + exp(-(V + 52) / 7.4));
  280. U_inf = 1 / (1 + exp((V + 80) / 5));
  281. tau_S = 1 + 0.33 / (exp(-(V + 102) / 15) + exp((V + 27) / 10));
  282. tau_U = 22.7 + 0.27 / (exp(-(V + 407) / 50) + exp((V + 48) / 4));
  283. }
  284. const float new_U = 2 * timestep / (2 * tau_U + timestep) * U_inf + (2 * tau_U - timestep) / (2 * tau_U + timestep) * U;
  285. const float new_S = 2 * timestep / (2 * tau_S + timestep) * S_inf + (2 * tau_S - timestep) / (2 * tau_S + timestep) * S;
  286. const Float Iin_avg = Iin + local_Iin; //(Inum_in + local_Inum_in) > 0 ? (Iin + local_Iin) / (Inum_in + local_Inum_in) : 0;//
  287. const Float new_IY = (gabaR * Iin_avg * timestep + (1 - timestep / 2 * (gabaR * Iin_avg + gabaD)) * IY) / (timestep / 2 * (gabaR * Iin_avg + gabaD) + 1);
  288. const Float Ein_avg = Ein + local_Ein; //(Enum_in + local_Enum_in) > 0 ? (Ein + local_Ein) / (Enum_in + local_Enum_in) : 0; //
  289. const Float new_EY = (ampaR * Ein_avg * timestep + (1 - timestep / 2 * (ampaR * Ein_avg + ampaD)) * EY) / (timestep / 2 * (ampaR * Ein_avg + ampaD) + 1);
  290. // Use updated gating variables to update voltage.
  291. const Float leak_term = gleak_d[neuron_type];
  292. Float g_na = gna_d[neuron_type];
  293. const Float Na_term = g_na * new_M * new_M * new_M * new_H;
  294. Float g_kd = gkd_d[neuron_type];
  295. const Float Kd_term = g_kd * powf(new_N, 4);
  296. Float g_M = gM_d[neuron_type];
  297. const Float IM_term = g_M* new_P;
  298. const Float IL_term = 0;// gca* new_Q* new_Q* new_R;
  299. const Float IT_term = gT_d[neuron_type] * new_S* new_S* new_U;
  300. Float g_GABA = GGABA;
  301. if (type_info < 1.5)
  302. g_GABA = 0.1;
  303. const Float global_gaba_term = g_GABA * new_IY;
  304. const Float global_ampa_term = GAMPA_WHITE * new_EY;
  305. const Float G = leak_term + Na_term + Kd_term + IM_term + IL_term + IT_term + global_gaba_term + global_ampa_term; //local_gaba_term + local_ampa_term +
  306. const Float E = leak_term * el + Na_term * ena + Kd_term * ek + IM_term * ek + (IL_term +IT_term) * eca + + global_gaba_term * e_gaba + global_ampa_term * e_ampa; //+ local_gaba_term * e_gaba + local_ampa_term * e_ampa
  307. // Add random white noise to V.
  308. Float white_noise = white_noise_intensity * curand_normal(random_states + idx) + white_noise_mean;
  309. // Copy back to sim_vars
  310. *V_ptr = ((white_noise + appcur) * timestep + E * timestep + (1 - timestep / 2 * G)*V) / ( C * (1 + timestep / 2 * G));
  311. *M_ptr = new_M;
  312. *H_ptr = new_H;
  313. *N_ptr = new_N;
  314. *P_ptr = new_P;
  315. *Q_ptr = new_Q;
  316. *R_ptr = new_R;
  317. *S_ptr = new_S;
  318. *U_ptr = new_U;
  319. *IY_ptr = new_IY;
  320. *EY_ptr = new_EY;
  321. // Calculate amount of neurotransmitter outputted AFTER update
  322. if (ei_info < 0.5) {
  323. sim_vars[Params::EOUTPUT][idx] = sim_vars[Params::LOCAL_EOUTPUT][idx] = 1.0 / (1.0 + exp(-(*V_ptr - Vtc) / Kp));
  324. sim_vars[Params::IOUTPUT][idx] = sim_vars[Params::LOCAL_IOUTPUT][idx] = 0;
  325. }
  326. else {
  327. sim_vars[Params::IOUTPUT][idx] = sim_vars[Params::LOCAL_IOUTPUT][idx] = 1.0 / (1.0 + exp(-(*V_ptr - Vtc) / Kp));
  328. sim_vars[Params::EOUTPUT][idx] = sim_vars[Params::LOCAL_EOUTPUT][idx] = 0;
  329. }
  330. }
  331. }
  332. void HHEphys::SimulateEphys()
  333. {
  334. Leapfrog_HH<<<NBLOCKS, NTHREADS>>>(thrust::raw_pointer_cast(sim_vars.data()), N, dt, thrust::raw_pointer_cast(random_states.data()));
  335. gpuErrchk( cudaPeekAtLastError() );
  336. gpuErrchk( cudaDeviceSynchronize() );
  337. }

ephys.cu, under CC-BY-4.0 · at the source

Overview

  1. Department of Mathematics, University of Michigan Ann Arbor United States
  2. Gilbert S. Omenn Department of Computational Medicine and Bioinformatics, University of Michigan Ann Arbor United States
Institutions: University of Michigan (United States)
Journal: eLife, volume 14, article RP108208
Dates: published online 4 September 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.7554/elife.108208 · PMID 42696350 · PMCID PMC13544912 · OpenAlex W4414145370
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: mouse (organism), computational (subfield)
Methods: Spectral & time-frequency, Machine learning
Keywords: traveling waves, computational modeling, network models, Mouse
MeSH: Brain Waves*, Cerebral Cortex*, Models, Neurological*, Nerve Net*, Neurons*, Animals, Mice (* major topic)
Journal subjects: Neuroscience
Topic: Neural dynamics and brain function (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Funding: Army Research Office (W911NF-22-1-0223); Human Frontier Science Program (10.52044/hfsp.rgp00192018.pc.gr.166630); National Science Foundation (DMS 2052499)
Citations: cited by 1 paper (Europe PMC); 66 references in the paper

Abstract

Traveling waves are ubiquitous in neuronal systems across different spatial scales. While microscopic and mesoscopic waves are relatively well studied, the emergence of macroscopic traveling waves remains less understood. Here, by modeling the mouse cortex using spatial transcriptomic and connectivity data, we show that realistic cortical connectivity can generate a significantly higher level of macroscopic traveling waves than artificial local and uniform connectivity across multiple oscillation frequency bands, with the strongest advantage appearing in the theta, alpha, and beta frequency bands. By probing the model in different dynamic regimes, we find that macroscopic wave activity depends on both network connectivity and excitatory coupling strength, with a non-monotonic dependence on coupling. Together, our work shows how flexible macroscopic traveling waves can emerge in the mouse cortex and offers a computational framework to further study traveling waves in the mouse brain at the single-cell level.

Reproduced under the paper's license (CC BY), from the paper cited above.

Repository

Its files are read in the Code ↔ Paper reader above, with 1 match between paragraphs and lines of code.

figshare 29410397

License: CC-BY-4.0
State: the link answers, verified on 26 September 2026
Evidence: files inventoried
Size: 13 files
Software Heritage: not checked
Found in: “Data availability”
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: AllenSDK (2 files), h5py (2 files), NumPy (2 files), pandas (2 files)
Availability: 1 check, the latest on 26 September 2026: the link answers (HTTP 200)
  • 26 September 2026: the link answers (HTTP 200)
16 files

The paper's code and data availability statement is in the Data section.

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 14 scripts, each with its path and the digest of its content;
  • 1 match between paragraphs of the paper and lines of the code (method lexical-v1);
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

No dataset and no data link were found in the paper.

Data availability

Raw data related to this study, including the neuronal and connectivity data, along with the code and simulation data related to the figures, have been uploaded to the following repository: https://doi.org/10.6084/m9.figshare.29410397.

The following dataset was generated:

SunG 2026Realistic coupling enables flexible macroscopic traveling waves in the mouse cortexfigshare10.6084/m9.figshare.29410397.v2PMC1354491242696350

Reproduced under the paper's license (CC BY), from the paper cited above.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 1, 27 September 2026: the first record

Recorded: type, language, journal, volume, pages, dates, 4 authors, 4 keywords, 7 MeSH terms, 3 funders, 65 references.

Cite

This paper

Sun, G., Hazelden, J., Kim, R., & Forger, D. B. (2026). Realistic coupling enables flexible macroscopic traveling waves in the mouse cortex. eLife, 14, RP108208. https://doi.org/10.7554/elife.108208

BibTeX

@article{sun2026realistic,
author = {Sun, Guanhua and Hazelden, James and Kim, Ruby and Forger, Daniel B},
title = {{Realistic coupling enables flexible macroscopic traveling waves in the mouse cortex}},
journal = {eLife},
year = {2026},
month = sep,
volume = {14},
pages = {RP108208},
publisher = {eLife Sciences Publications, Ltd},
issn = {2050-084X},
doi = {10.7554/elife.108208},
url = {https://doi.org/10.7554/elife.108208},
pmid = {42696350},
pmcid = {PMC13544912}
}

RIS

TY - JOUR
AU - Sun, Guanhua
AU - Hazelden, James
AU - Kim, Ruby
AU - Forger, Daniel B
TI - Realistic coupling enables flexible macroscopic traveling waves in the mouse cortex
T2 - eLife
J2 - eLife
PY - 2026
DA - 2026/09/04
VL - 14
SP - RP108208
SN - 2050-084X
PB - eLife Sciences Publications, Ltd
DO - 10.7554/elife.108208
UR - https://doi.org/10.7554/elife.108208
LA - en
ER -

CSL-JSON

{
"id": "10.7554/elife.108208",
"type": "article-journal",
"title": "Realistic coupling enables flexible macroscopic traveling waves in the mouse cortex",
"container-title": "eLife",
"author": [
{
"family": "Sun",
"given": "Guanhua"
},
{
"family": "Hazelden",
"given": "James"
},
{
"family": "Kim",
"given": "Ruby"
},
{
"family": "Forger",
"given": "Daniel B"
}
],
"container-title-short": "eLife",
"volume": "14",
"page": "RP108208",
"DOI": "10.7554/elife.108208",
"PMID": "42696350",
"PMCID": "PMC13544912",
"ISSN": "2050-084X",
"publisher": "eLife Sciences Publications, Ltd",
"URL": "https://doi.org/10.7554/elife.108208",
"language": "en",
"issued": {
"date-parts": [
[
2026,
9,
4
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.1038/s41467-026-71386-z [code]
Planar, spiral, and concentric traveling waves distinguish behavioral states in human memory.
Journal: Nature communications
In common: pandas, NumPy, 17 references
[2] doi:10.3389/fncom.2026.1844662
Quantifying cortex-wide traveling brain waves of complex patterns with a graph-based algorithm.
Journal: Frontiers in computational neuroscience
In common: computational, 13 references
[3] doi:10.1016/j.isci.2026.116728 [code]
Awake cortex stabilizes traveling waves for global and reliable information routing.
Journal: iScience
In common: NumPy, 9 references
[4] doi:10.7554/elife.106753 [code]
Traveling waves across scales: Different mechanisms but same canonical computation?
Journal: n/a
In common: computational, 8 references
[5] doi:10.1073/pnas.2527296123
Traveling-wave transcranial alternating current stimulation (twtACS) causally links neural timing to cognitive function.
Journal: Proceedings of the National Academy of Sciences of the United States of America
In common: 8 references
[6] doi:10.7554/elife.100674 [code]
The dominance of large-scale phase dynamics in human cortex, from delta to gamma.
Journal: eLife
In common: NumPy, 7 references
[7] doi:10.1162/imag.a.1310 [code]
Experimental quality control induces changes in Allen mouse brain connectomes.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: AllenSDK, pandas, NumPy, mouse, 4 references
[8] doi:10.1038/s41593-026-02253-9 [code]
Genoarchitecture and input-output organization of the mouse basal ganglia and thalamic parafascicular nucleus.
Journal: Nature neuroscience
In common: AllenSDK, h5py, pandas, 1 other tool, mouse, 3 references
[9] doi:10.1371/journal.pcbi.1013007 [code]
Traveling waves in the human visual cortex: An MEG-EEG model-based approach
Journal: n/a
In common: NumPy, 6 references
[10] doi:10.1371/journal.pcbi.1014673 [code]
Modeling the influences of non-local connectomic projections on geometrically constrained cortical dynamics.
Journal: PLoS computational biology
In common: computational, 5 references

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.

Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.