Realistic coupling enables flexible macroscopic traveling waves in the mouse cortex.
One block of code here has a permanent identifier (oscr:b:…), listed with the matches below: citable for good, with a page of its own. Select a match and press Cite to copy it. What a block identifier is.
The 1 match
- [1] § Materials and methods › Simulation ↔ code_simulation.zip/coupling_speed_test/ephys.cu, lines 27 to 123 · score 0.57 · gate variables, 0.02–0.05, simulation, voltage, uniform · block
oscr:b:42NPASJHDGX7H-V· Report a mismatch
Paper
Loaded from Europe PMC by your browser; OSCR does not store it: 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
- #include "ephys.cuh"
- # define M_PI 3.14159265358979323846 /* pi */
- Ephys::~Ephys()
- {
- for (Float*& dev_ptr : sim_vars_cpu)
- cudaFree(dev_ptr);
- }
- HHEphys::HHEphys(int const N_)
- : Ephys(N_, HH::leapfrog_dt)
- {
- using namespace HH;
- // Set up simulation variables. Stored in a struct of arrays.
- sim_vars_cpu.resize(Params::PARAM_COUNT);
- thrust::host_vector<Float> cpu_arr(N, 0);
- // Zero arrays.
- for (Float*& arr : sim_vars_cpu)
- {
- cudaMalloc(&arr, N * sizeof(Float));
- cudaMemcpy(arr, cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- }
- sim_vars = sim_vars_cpu;
- SetVariablesRandomly();
- }
- void HHEphys::SetVariablesRandomly()
- {
- using namespace HH;
- thrust::host_vector<Float> cpu_arr(N, 0.05);
- thrust::fill_n(cpu_arr.begin(), N, g_ampa_white);
- cudaMemcpy(sim_vars_cpu[Params::G_AMPA_WHITE], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- thrust::fill_n(cpu_arr.begin(), N, g_ampa_grey);
- cudaMemcpy(sim_vars_cpu[Params::G_AMPA_GREY], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- thrust::fill_n(cpu_arr.begin(), N, g_gaba);
- cudaMemcpy(sim_vars_cpu[Params::G_GABA], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- // Set voltages randomly
- auto& gen{ Utility::GetRandomEngine() };
- std::normal_distribution<> voltage_dist(-65,-5);
- for (auto& val : cpu_arr)
- val = voltage_dist(gen);
- cudaMemcpy(sim_vars_cpu[Params::V], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- // Set gating variables
- std::uniform_real_distribution<Float> gating_var_dist(0.02, 0.05);
- for (auto& val : cpu_arr)
- val = gating_var_dist(gen);
- cudaMemcpy(sim_vars_cpu[Params::M], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- for (auto& val : cpu_arr)
- val = gating_var_dist(gen);
- cudaMemcpy(sim_vars_cpu[Params::H], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- for (auto& val : cpu_arr)
- val = gating_var_dist(gen);
- cudaMemcpy(sim_vars_cpu[Params::N], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- for (auto& val : cpu_arr)
- val = gating_var_dist(gen);
- cudaMemcpy(sim_vars_cpu[Params::P], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- for (auto& val : cpu_arr)
- val = gating_var_dist(gen);
- cudaMemcpy(sim_vars_cpu[Params::Q], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- for (auto& val : cpu_arr)
- val = gating_var_dist(gen);
- cudaMemcpy(sim_vars_cpu[Params::R], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- for (auto& val : cpu_arr)
- val = gating_var_dist(gen);
- cudaMemcpy(sim_vars_cpu[Params::S], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- for (auto& val : cpu_arr)
- val = gating_var_dist(gen);
- cudaMemcpy(sim_vars_cpu[Params::U], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- thrust::host_vector<Float> ei_info(N, 0.0);
- cudaMemcpy(sim_vars_cpu[Params::EI_INFO], ei_info.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- thrust::host_vector<Float> type_info(N, 0.0);
- cudaMemcpy(sim_vars_cpu[Params::TYPE_INFO], type_info.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- thrust::fill_n(cpu_arr.begin(), N, 0.05);
- //cudaMemcpy(sim_vars_cpu[Params::LOCAL_IY], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- //cudaMemcpy(sim_vars_cpu[Params::LOCAL_EY], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- cudaMemcpy(sim_vars_cpu[Params::IY], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- cudaMemcpy(sim_vars_cpu[Params::EY], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- // No neurotransmitter input/output or connections
- thrust::fill_n(cpu_arr.begin(), N, 0.001);
- cudaMemcpy(sim_vars_cpu[Params::LOCAL_IOUTPUT], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- cudaMemcpy(sim_vars_cpu[Params::LOCAL_IIN], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- cudaMemcpy(sim_vars_cpu[Params::LOCAL_ICOUNT], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- cudaMemcpy(sim_vars_cpu[Params::LOCAL_EOUTPUT], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- cudaMemcpy(sim_vars_cpu[Params::LOCAL_EIN], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- cudaMemcpy(sim_vars_cpu[Params::LOCAL_ECOUNT], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- cudaMemcpy(sim_vars_cpu[Params::IOUTPUT], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- cudaMemcpy(sim_vars_cpu[Params::IIN], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- cudaMemcpy(sim_vars_cpu[Params::ICOUNT], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- cudaMemcpy(sim_vars_cpu[Params::EOUTPUT], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- cudaMemcpy(sim_vars_cpu[Params::EIN], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- cudaMemcpy(sim_vars_cpu[Params::ECOUNT], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- // Set applied current
- //thrust::fill_n(cpu_arr.begin(), N, appcur);
- std::normal_distribution<Float> appcur_dist(appcur, 0.0);
- for (auto& val : cpu_arr) {
- val = appcur_dist(gen);
- }
- cudaMemcpy(sim_vars_cpu[Params::APPCUR], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- gpuErrchk(cudaDeviceSynchronize());
- // Copy pointers from CPU to GPU
- sim_vars = sim_vars_cpu;
- }
- void HHEphys::RandomizeInitialConditionsKeepEI()
- {
- using namespace HH;
- thrust::host_vector<Float> cpu_arr(N, 0.05);
- thrust::fill_n(cpu_arr.begin(), N, g_ampa_white);
- cudaMemcpy(sim_vars_cpu[Params::G_AMPA_WHITE], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- thrust::fill_n(cpu_arr.begin(), N, g_ampa_grey);
- cudaMemcpy(sim_vars_cpu[Params::G_AMPA_GREY], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- thrust::fill_n(cpu_arr.begin(), N, g_gaba);
- cudaMemcpy(sim_vars_cpu[Params::G_GABA], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- auto& gen{ Utility::GetRandomEngine() };
- std::normal_distribution<> voltage_dist(-65, -5);
- for (auto& val : cpu_arr)
- val = voltage_dist(gen);
- cudaMemcpy(sim_vars_cpu[Params::V], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- std::uniform_real_distribution<Float> gating_var_dist(0.02, 0.05);
- for (auto& val : cpu_arr)
- val = gating_var_dist(gen);
- cudaMemcpy(sim_vars_cpu[Params::M], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- for (auto& val : cpu_arr)
- val = gating_var_dist(gen);
- cudaMemcpy(sim_vars_cpu[Params::H], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- for (auto& val : cpu_arr)
- val = gating_var_dist(gen);
- cudaMemcpy(sim_vars_cpu[Params::N], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- for (auto& val : cpu_arr)
- val = gating_var_dist(gen);
- cudaMemcpy(sim_vars_cpu[Params::P], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- for (auto& val : cpu_arr)
- val = gating_var_dist(gen);
- cudaMemcpy(sim_vars_cpu[Params::Q], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- for (auto& val : cpu_arr)
- val = gating_var_dist(gen);
- cudaMemcpy(sim_vars_cpu[Params::R], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- for (auto& val : cpu_arr)
- val = gating_var_dist(gen);
- cudaMemcpy(sim_vars_cpu[Params::S], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- for (auto& val : cpu_arr)
- val = gating_var_dist(gen);
- cudaMemcpy(sim_vars_cpu[Params::U], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- thrust::fill_n(cpu_arr.begin(), N, 0.05);
- cudaMemcpy(sim_vars_cpu[Params::IY], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- cudaMemcpy(sim_vars_cpu[Params::EY], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- thrust::fill_n(cpu_arr.begin(), N, 0.001);
- cudaMemcpy(sim_vars_cpu[Params::LOCAL_IOUTPUT], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- cudaMemcpy(sim_vars_cpu[Params::LOCAL_IIN], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- cudaMemcpy(sim_vars_cpu[Params::LOCAL_ICOUNT], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- cudaMemcpy(sim_vars_cpu[Params::LOCAL_EOUTPUT], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- cudaMemcpy(sim_vars_cpu[Params::LOCAL_EIN], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- cudaMemcpy(sim_vars_cpu[Params::LOCAL_ECOUNT], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- cudaMemcpy(sim_vars_cpu[Params::IOUTPUT], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- cudaMemcpy(sim_vars_cpu[Params::IIN], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- cudaMemcpy(sim_vars_cpu[Params::ICOUNT], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- cudaMemcpy(sim_vars_cpu[Params::EOUTPUT], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- cudaMemcpy(sim_vars_cpu[Params::EIN], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- cudaMemcpy(sim_vars_cpu[Params::ECOUNT], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- thrust::fill_n(cpu_arr.begin(), N, 0.0f);
- cudaMemcpy(sim_vars_cpu[Params::APPCUR], cpu_arr.data(), N * sizeof(Float), cudaMemcpyHostToDevice);
- gpuErrchk(cudaDeviceSynchronize());
- sim_vars = sim_vars_cpu;
- }
- __global__ void init_random(unsigned int seed, int const N, curandState_t* states)
- {
- for (int idx = blockIdx.x * blockDim.x + threadIdx.x; idx < N; idx += gridDim.x * blockDim.x)
- {
- curand_init(seed, idx, 0, &states[idx]);
- }
- }
- __global__ void get_random_test(curandState_t* states, int const N, int* numbers)
- {
- for (int idx = blockIdx.x * blockDim.x + threadIdx.x; idx < N; idx += gridDim.x * blockDim.x)
- {
- numbers[idx] = curand(&states[idx]) % 100;
- }
- }
- Ephys::Ephys(int const N_, Float const dt_) : N{ N_ }, dt{ dt_ }, random_states(N_)
- {
- #if USE_FIXED_RANDOM_SEED
- unsigned int seed = 0;
- #else
- unsigned int seed = time(NULL);
- #endif
- // Setup random seeds.
- init_random<<<NBLOCKS, NTHREADS>>>(seed, N, thrust::raw_pointer_cast(random_states.data()));
- gpuErrchk( cudaPeekAtLastError() );
- gpuErrchk( cudaDeviceSynchronize() );
- }
- __global__ void Leapfrog_HH(Float** sim_vars, const int N, const Float timestep, curandState_t* random_states)
- {
- using namespace HH;
- Float Vt_d[2] = { -61.5, -61.5};
- Float gna_d[2] = { 50, 46};
- Float gkd_d[2] = { 4.8, 5.1};
- Float gM_d[2] = { 0.13, 0.0};
- Float gleak_d[2] = { 0.02, 0.08};
- Float tau_max_d[2] = { 1123, 824.5};
- Float gT_d[2] = { 0, 0};
- Float A_d[2] = { 0.29, 0.22};
- for (int idx = blockIdx.x * blockDim.x + threadIdx.x; idx < N; idx += gridDim.x * blockDim.x)
- {
- Float* V_ptr = sim_vars[Params::V] + idx;
- Float* M_ptr = sim_vars[Params::M] + idx;
- Float* H_ptr = sim_vars[Params::H] + idx;
- Float* N_ptr = sim_vars[Params::N] + idx;
- Float* P_ptr = sim_vars[Params::P] + idx;
- Float* Q_ptr = sim_vars[Params::Q] + idx;
- Float* R_ptr = sim_vars[Params::R] + idx;
- Float* S_ptr = sim_vars[Params::S] + idx;
- Float* U_ptr = sim_vars[Params::U] + idx;
- Float* EY_ptr = sim_vars[Params::EY] + idx;
- Float* IY_ptr = sim_vars[Params::IY] + idx;
- const Float local_Iin = sim_vars[Params::LOCAL_IIN][idx];
- const Float local_Inum_in = sim_vars[Params::LOCAL_ICOUNT][idx];
- const Float local_Ein = sim_vars[Params::LOCAL_EIN][idx];
- const Float local_Enum_in = sim_vars[Params::LOCAL_ECOUNT][idx];
- const Float Iin = sim_vars[Params::IIN][idx];
- const Float Inum_in = sim_vars[Params::ICOUNT][idx];
- const Float Ein = sim_vars[Params::EIN][idx];
- const Float Enum_in = sim_vars[Params::ECOUNT][idx];
- const Float appcur = sim_vars[Params::APPCUR][idx];
- const Float GAMPA_WHITE = sim_vars[Params::G_AMPA_WHITE][idx];
- const Float GAMPA_GREY = sim_vars[Params::G_AMPA_GREY][idx];
- const Float GGABA = sim_vars[Params::G_GABA][idx];
- const Float ei_info = sim_vars[Params::EI_INFO][idx];
- const Float type_info = sim_vars[Params::TYPE_INFO][idx];
- const Float V = *V_ptr;
- const Float M = *M_ptr;
- const Float H = *H_ptr;
- const Float N = *N_ptr;
- const Float P = *P_ptr;
- const Float Q = *Q_ptr;
- const Float R = *R_ptr;
- const Float S = *S_ptr;
- const Float U = *U_ptr;
- const Float IY = *IY_ptr;
- const Float EY = *EY_ptr;
- int neuron_type;
- if (type_info < 0.5) {
- neuron_type = 0;
- }
- else {
- neuron_type = 1;
- }
- // Update gating variables first.
- Float Vt = Vt_d[neuron_type];
- Float aM = -0.32 * (V - Vt - 13) / (exp(-(V - Vt - 13) / 4) - 1);
- if ((V - Vt) == 13)
- aM = 0.32 * 4;
- Float bM = 0.28 * (V - Vt - 40) / (exp((V - Vt - 40) / 5) - 1);
- if ((V - Vt) == 40)
- bM = 0.28 * 5;
- const float new_M = (aM * timestep + (1 - timestep / 2 * (aM + bM)) * M) / (timestep / 2 * (aM + bM) + 1);
- Float aH = 0.128 * exp(-(V - Vt - 17) / 18);
- Float bH = 4.0 / (1 + exp(-(V - Vt - 40) / 5));
- const float new_H = (aH * timestep + (1 - timestep / 2 * (aH + bH)) * H) / (timestep / 2 * (aH + bH) + 1);
- Float aN = -0.032 * (V - Vt - 15) / (exp(-(V - Vt - 15) / 5) - 1);
- if ((V - Vt) == 15)
- aN = 0.032 * 5;
- Float bN = 0.5 * exp(-(V - Vt - 10) / 40);
- const float new_N = (aN * timestep + (1 - timestep / 2 * (aN + bN)) * N) / (timestep / 2 * (aN + bN) + 1);
- Float P_inf = 1 / (1 + exp(-(V + 35) / 10));
- Float tau_P = tau_max_d[neuron_type] / (3.3 * exp((V + 35) / 20) + exp(-(V + 35) / 20));
- const float new_P = 2 * timestep / (2 * tau_P + timestep) * P_inf + (2 * tau_P - timestep) / (2 * tau_P + timestep) * P;
- Float aQ = 0.055 * (-27 - V) / (exp((-27 - V) / 3.8) - 1);
- if (V == -27)
- aQ = 0.055 * 3.8;
- Float bQ = 0.94 * exp((-75 - V) / 17);
- const float new_Q = (aQ * timestep + (1 - timestep / 2 * (aQ + bQ)) * Q) / (timestep / 2 * (aQ + bQ) + 1);
- Float aR = 0.000457 * exp((-13 - V) / 50);
- Float bR = 0.0065 / (exp((-15 - V) / 28) + 1);
- const float new_R = (aR * timestep + (1 - timestep / 2 * (aR + bR)) * R) / (timestep / 2 * (aR + bR) + 1);
- Float S_inf; Float U_inf; Float tau_U; Float tau_S;
- if (neuron_type == 2) {
- S_inf = 1 / (1 + exp(-(V + 59) / 6.2));
- U_inf = 1 / (1 + exp((V + 83) / 4));
- tau_S = 0.13 + 0.22 / (exp(-(V + 132) / 16.7) + exp((V + 16.8) / 18.2));
- tau_U = 8.2 + (56.6 + 0.27 * exp((V + 115.2) / 5)) / (1 + exp((V + 86) / 3.2));
- }
- else {
- S_inf = 1 / (1 + exp(-(V + 52) / 7.4));
- U_inf = 1 / (1 + exp((V + 80) / 5));
- tau_S = 1 + 0.33 / (exp(-(V + 102) / 15) + exp((V + 27) / 10));
- tau_U = 22.7 + 0.27 / (exp(-(V + 407) / 50) + exp((V + 48) / 4));
- }
- const float new_U = 2 * timestep / (2 * tau_U + timestep) * U_inf + (2 * tau_U - timestep) / (2 * tau_U + timestep) * U;
- const float new_S = 2 * timestep / (2 * tau_S + timestep) * S_inf + (2 * tau_S - timestep) / (2 * tau_S + timestep) * S;
- const Float Iin_avg = Iin + local_Iin; //(Inum_in + local_Inum_in) > 0 ? (Iin + local_Iin) / (Inum_in + local_Inum_in) : 0;//
- const Float new_IY = (gabaR * Iin_avg * timestep + (1 - timestep / 2 * (gabaR * Iin_avg + gabaD)) * IY) / (timestep / 2 * (gabaR * Iin_avg + gabaD) + 1);
- const Float Ein_avg = Ein + local_Ein; //(Enum_in + local_Enum_in) > 0 ? (Ein + local_Ein) / (Enum_in + local_Enum_in) : 0; //
- const Float new_EY = (ampaR * Ein_avg * timestep + (1 - timestep / 2 * (ampaR * Ein_avg + ampaD)) * EY) / (timestep / 2 * (ampaR * Ein_avg + ampaD) + 1);
- // Use updated gating variables to update voltage.
- const Float leak_term = gleak_d[neuron_type];
- Float g_na = gna_d[neuron_type];
- const Float Na_term = g_na * new_M * new_M * new_M * new_H;
- Float g_kd = gkd_d[neuron_type];
- const Float Kd_term = g_kd * powf(new_N, 4);
- Float g_M = gM_d[neuron_type];
- const Float IM_term = g_M* new_P;
- const Float IL_term = 0;// gca* new_Q* new_Q* new_R;
- const Float IT_term = gT_d[neuron_type] * new_S* new_S* new_U;
- Float g_GABA = GGABA;
- if (type_info < 1.5)
- g_GABA = 0.1;
- const Float global_gaba_term = g_GABA * new_IY;
- const Float global_ampa_term = GAMPA_WHITE * new_EY;
- 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 +
- 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
- // Add random white noise to V.
- Float white_noise = white_noise_intensity * curand_normal(random_states + idx) + white_noise_mean;
- // Copy back to sim_vars
- *V_ptr = ((white_noise + appcur) * timestep + E * timestep + (1 - timestep / 2 * G)*V) / ( C * (1 + timestep / 2 * G));
- *M_ptr = new_M;
- *H_ptr = new_H;
- *N_ptr = new_N;
- *P_ptr = new_P;
- *Q_ptr = new_Q;
- *R_ptr = new_R;
- *S_ptr = new_S;
- *U_ptr = new_U;
- *IY_ptr = new_IY;
- *EY_ptr = new_EY;
- // Calculate amount of neurotransmitter outputted AFTER update
- if (ei_info < 0.5) {
- sim_vars[Params::EOUTPUT][idx] = sim_vars[Params::LOCAL_EOUTPUT][idx] = 1.0 / (1.0 + exp(-(*V_ptr - Vtc) / Kp));
- sim_vars[Params::IOUTPUT][idx] = sim_vars[Params::LOCAL_IOUTPUT][idx] = 0;
- }
- else {
- sim_vars[Params::IOUTPUT][idx] = sim_vars[Params::LOCAL_IOUTPUT][idx] = 1.0 / (1.0 + exp(-(*V_ptr - Vtc) / Kp));
- sim_vars[Params::EOUTPUT][idx] = sim_vars[Params::LOCAL_EOUTPUT][idx] = 0;
- }
- }
- }
- void HHEphys::SimulateEphys()
- {
- Leapfrog_HH<<<NBLOCKS, NTHREADS>>>(thrust::raw_pointer_cast(sim_vars.data()), N, dt, thrust::raw_pointer_cast(random_states.data()));
- gpuErrchk( cudaPeekAtLastError() );
- gpuErrchk( cudaDeviceSynchronize() );
- }
ephys.cu, under CC-BY-4.0 · at the source
Overview
- Department of Mathematics, University of Michigan Ann Arbor United States
- Gilbert S. Omenn Department of Computational Medicine and Bioinformatics, University of Michigan Ann Arbor United States
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
Availability: 1 check, the latest on 26 September 2026: the link answers (HTTP 200)
- 26 September 2026: the link answers (HTTP 200)
16 files
- code_connectivity.zip/
clean_data.py , Python, 160 lines - code_connectivity.zip/
main.py , Python, 446 lines - code_simulation.zip/
coupling_speed_test/ , CUDA, 148 linescoupling.cu - code_simulation.zip/
coupling_speed_test/ , CUDA, 66 linesdefines.cu - code_simulation.zip/
coupling_speed_test/ , CUDA, 126 lineselectrode_net.cu - code_simulation.zip/
coupling_speed_test/ , CUDA, 403 lines, 1 matchephys.cu - code_simulation.zip/
coupling_speed_test/ , CUDA, 626 linesmain.cu - code_simulation.zip/
coupling_speed_test/ , C++, 476 linesmorphology.cpp - code_simulation.zip/
coupling_speed_test/ , C/C++, 264 linesmorphology.h - code_simulation.zip/
coupling_speed_test/ , CUDA, 117 linesmouse_cortex.cu - code_simulation.zip/
coupling_speed_test/ , CUDA, 265 linesnetwork_factory.cu - code_simulation.zip/
coupling_speed_test/ , C++, 62 linesregions_tree.cpp - code_simulation.zip/
coupling_speed_test/ , C/C++, 26 linesregions_tree.h - code_simulation.zip/
linux_build/ , Shell, 11 linesrun_script.sh - code_connectivity.zip/
README.md , Text, 98 lines - code_simulation.zip/
README.md , Text, 135 lines
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://
The following dataset was generated:
SunG 2026Realistic coupling enables flexible macroscopic traveling waves in the mouse cortexfigshare10.6084/
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://
BibTeX
@article{sun2026realisti
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/
url = {https://
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/
VL - 14
SP - RP108208
SN - 2050-084X
PB - eLife Sciences Publications, Ltd
DO - 10.7554/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.7554/
"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":
"volume": "14",
"page": "RP108208",
"DOI": "10.7554/
"PMID": "42696350",
"PMCID": "PMC13544912",
"ISSN": "2050-084X",
"publisher": "eLife Sciences Publications, Ltd",
"URL": "https://
"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 communicationsIn common: pandas, NumPy, 17 references
- [2] doi:10.1038/s41467-026-68893-4 [code]
- Nested spatiotemporal theta-gamma waves organize hierarchical processing across the mouse visual cortex.Journal: Nature communicationsIn common: AllenSDK, h5py, pandas, 1 other tool, mouse, 15 references
- [3] doi:10.1038/s41467-021-26175-1 [code]
- Spontaneous traveling waves naturally emerge from horizontal fiber time delays and travel through locally asynchronous-irregular states.Journal: Nature communicationsIn common: pandas, NumPy, computational, 12 references
- [4] doi:10.3389/fncom.2026.1844662
- Quantifying cortex-wide traveling brain waves of complex patterns with a graph-based algorithm.Journal: Frontiers in computational neuroscienceIn common: computational, 13 references
- [5] doi:10.1126/sciadv.adr4038 [code]
- Touch-evoked traveling waves establish a translaminar spacetime code.Journal: Science advancesIn common: mouse, 13 references
- [6] doi:10.1038/s41467-024-47860-x [code]
- Human connectome topology directs cortical traveling waves and shapes frequency gradients.Journal: Nature communicationsIn common: pandas, NumPy, computational, 12 references
- [7] doi:10.7554/elife.92254 [code]
- Sequentially activated discrete modules appear as traveling waves in neuronal measurements with limited spatiotemporal sampling.Journal: eLifeIn common: 14 references
- [8] doi:10.1016/j.crmeth.2023.100681 [code]
- A modular and adaptable analysis pipeline to compare slow cerebral rhythms across heterogeneous datasets.Journal: Cell reports methodsIn common: pandas, NumPy, 12 references
- [9] doi:10.1038/s41467-023-41125-9 [code]
- Beta traveling waves in monkey frontal and parietal areas encode recent reward history.Journal: Nature communicationsIn common: 13 references
- [10] doi:10.1016/j.xpro.2025.103659 [code]
- Protocol for detecting and analyzing non-oscillatory traveling waves from high-spatiotemporal-reso
lution human electrophysiological recordings. Journal: STAR protocolsIn common: 12 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.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 1 repository of the authors' code, each at its verified commit and with its license, 14 scripts, and 1 match between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:3ab27b520d26ef6b…
Add the badge to the code's README
If you are an author or a maintainer of this paper's code, you can add this badge. It says what OSCR knows of the paper (its code, its validated tracing map) and links the code to this page. Paste one of these snippets under the README's title. Keep the two marks around it, so that the badge can be replaced in place and is never added twice. OSCR changes nothing in your repository.
Markdown
<!-- oscr-badge:start -->
[](https://openscicode.org/badge/doi/10.7554/elife.108208)
<!-- oscr-badge:end -->reStructuredText
.. oscr-badge:start
.. image:: https://openscicode.org/badge/doi/10.7554/elife.108208.svg
:target: https://openscicode.org/badge/doi/10.7554/elife.108208
:alt: OSCR
.. oscr-badge:endHTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.7554/elife.108208"><img src="https://openscicode.org/badge/doi/10.7554/elife.108208.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->If you choose to, you can have the badge kept up to date for you, with oscr badge --write from the command line or with the GitHub Action in your repository's workflows. Every other form and option (a card, AsciiDoc, LaTeX, shields.io) is on the badge 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: code errors and mismatches between the code and the paper about this paper and its code, from readers and its authors, beside the paper and its tracing map.
Report a mismatch between the code and the paper · Report a code error (signed in)
Reproductions: reports from readers who ran the authors' code and did not get the paper's result, what they ran, with which environment, commit and data.
Report a reproduction failure (signed in)
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
