Cerebellar microcircuits enable robust evidence-based decisions through cortico-cerebellar coupling.
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
Python · 542 lines · 23 KB · no license
- # coding=gbk
- import multiprocessing
- import os
- import matplotlib
- matplotlib.use('Agg')
- import matplotlib.pyplot as plt
- import numpy as np
- import matplotlib.gridspec as gridspec
- from brian2 import *
- from collections import OrderedDict
- import cupy as cp
- continuous_model_params = dict(
- V_L = -70*mV, Vth = -50*mV, Vreset = -55*mV,
- gE = 25*nS, tau_m_E = 20*ms, tau_ref_E = 2*ms,
- gI = 20*nS, tau_m_I = 10*ms, tau_ref_I = 1*ms,
- V_E = 0*mV, V_I = -70*mV,
- a = 0.062*mV**-1, b = 3.57,
- tauAMPA = 2*ms, tau_x = 2*ms, tauNMDA = 100*ms, alpha = 0.5*kHz, tauGABA = 5*ms, delay = 0*ms,
- gAMPA_ext_E = 1*nS, gAMPA_ext_E_input = 150*nS, gAMPA_ext_I = 1.62*nS,
- gAMPA_E = 200*nS, gNMDA_E = 400*nS, gGABA_E = 10*nS,
- gAMPA_I = 300*nS, gNMDA_I = 0*nS, gGABA_I = 400*nS,
- nu_ext = 100*Hz,
- g_SFA = 100*nS, tau_w = 80*ms, b_SFA = 0.1, V_K = -80*mV,
- N_E = 1600, N_I = 400,
- fsel = 0.15,
- wp = 35, sigma_w=2.4
- )
- gc_par = dict(
- C = 100 * pF, vr = -60 * mV, vt = -40 * mV, k = 0.7 * pA/(mV**2),
- a = 0.03 / ms , b = -2 * nS , vpeak = 0* mV , c_reset = -50 * mV , d_reset = 100 * pA ,
- V_E=0*mV, gAMPA=50*nS, f = 0.062*mV**-1, g = 3.57, tauAMPA = 2*ms,
- possion_noise=0.5*kHz, gAMPA_noise=1*nS, tau_c=2*second,
- N_gc = 1000, mossy_fiber_input_num=4
- )
- PC_par=dict(
- N=400, c = 268 * pF, gl = 8.47 * nS, el = -51.31 * mV, vt = -53.23 * mV, delta = 0.85 * mV, vreset = -60.35 * mV,
- a = 37.79 * nS, tauw = 20.76 * ms, b = 441.12 * pA,
- Ihold = -140 * pA, VSpike=60*mV, V_E=0*mV, V_I=-80*mV,
- sigma=40*pA, corr=2*ms,
- tauAMPA = 2*ms, tauGABA = 5*ms,
- gAMPA=3*nS, gGABA =17*nS
- )
- pulse_params = dict(
- start_time=1000*ms, end_time=4800*ms, stim_num_sum=19, left_right_diff=1, start_index=800, end_index=900
- )
- sim_params=dict(
- sim_purations=7000*ms
- )
- E_equations = '''
- dV/dt = (-(V - V_L) - Isyn/gE) / tau_m_E : volt (unless refractory)
- Isyn = I_AMPA_ext + I_AMPA + I_NMDA + I_GABA+I_SFA+I_AMPA_input: amp
- I_AMPA_ext = gAMPA_ext_E*sAMPA_ext*(V - V_E) : amp
- I_AMPA_input = gAMPA_ext_E_input*sAMPA_input*(V - V_E) : amp
- I_AMPA = gAMPA_E*S_AMPA*(V - V_E) : amp
- I_NMDA = gNMDA_E*S_NMDA*(V - V_E)/(1 + exp(-a*V)/b) : amp
- I_GABA = gGABA_E*S_GABA*(V - V_I) : amp
- I_SFA = g_SFA * w_SFA * (V - V_K) : amp
- dsAMPA_ext/dt = -sAMPA_ext/tauAMPA : 1
- dsAMPA_input/dt = -sAMPA_input/tauAMPA : 1
- dsAMPA/dt = -sAMPA/tauAMPA : 1
- dx/dt = -x/tau_x : 1
- dw_SFA/dt = -w_SFA / tau_w : 1
- dsNMDA/dt = -sNMDA/tauNMDA + alpha*x*(1 - sNMDA) : 1
- S_AMPA : 1
- S_NMDA : 1
- S_GABA : 1
- '''
- I_equations = '''
- dV/dt = (-(V - V_L) - Isyn/gI) / tau_m_I : volt (unless refractory)
- Isyn = I_AMPA_ext + I_AMPA + I_NMDA + I_GABA : amp
- I_AMPA_ext = gAMPA_ext_I*sAMPA_ext*(V - V_E) : amp
- I_AMPA = gAMPA_I*S_AMPA*(V - V_E) : amp
- I_NMDA = gNMDA_I*S_NMDA*(V - V_E)/(1 + exp(-a*V)/b) : amp
- I_GABA = gGABA_I*S_GABA*(V - V_I) : amp
- dsAMPA_ext/dt = -sAMPA_ext/tauAMPA : 1
- dsGABA/dt = -sGABA/tauGABA : 1
- S_AMPA: 1
- S_NMDA: 1
- S_GABA: 1
- '''
- eqs_gc = '''
- dv/dt = (k*(v-vr)*(v-vt)- u + I_syn)/C : volt
- du/dt = a*(b*(v-vr)-u) : amp
- I_syn=I_AMPA+I_AMPA_noise: amp
- I_AMPA= gAMPA*sAMPA*(V_E-v) : amp
- I_AMPA_noise= gAMPA_noise*sAMPA_noise*(V_E-v) : amp
- dsAMPA/dt= -sAMPA/tauAMPA : 1
- dsAMPA_noise/dt= -sAMPA_noise/tauAMPA : 1
- '''
- eqs_pc='''
- dv/dt = (gl * delta * exp((v - vt) / delta) - gl * (v - el) - w + Ihold+I_ou+I_ext) / c : volt
- dw/dt = (a * (v - el) - w) / tauw : amp
- dtemp/dt = -temp/corr + (sqrt(2/(corr*dt)))*randn() : 1
- I_ou =temp * sigma : amp
- I_ext=I_GABA+I_AMPA:amp
- dsAMPA/dt = -sAMPA/tauAMPA : 1
- dsGABA/dt= -sGABA/tauGABA : 1
- I_AMPA=gAMPA*sAMPA*(V_E-v):amp
- I_GABA=gGABA*S_GABA*(V_I-v) : amp
- S_GABA:1
- '''
- current_script_dir = os.path.dirname(__file__)
- base_data_dir = os.path.join(current_script_dir, '..', 'evidence_accumulation', 'Data','Figure1')
- def calculate_sliding_window_rate(spike_times, num_neurons_in_group, total_duration, window_size, step_size):
- spike_times_ms = spike_times / ms
- total_duration_ms = total_duration / ms
- window_size_ms = window_size / ms
- step_size_ms = step_size / ms
- time_points_ms = np.arange(0, total_duration_ms, step_size_ms)
- firing_rates_Hz = np.zeros(len(time_points_ms))
- if num_neurons_in_group == 0:
- return time_points_ms, firing_rates_Hz
- for i, t_start_ms in enumerate(time_points_ms):
- t_end_ms = t_start_ms + window_size_ms
- spikes_in_window = np.sum((spike_times_ms >= t_start_ms) & (spike_times_ms < t_end_ms))
- if window_size_ms > 0:
- firing_rates_Hz[i] = spikes_in_window / (num_neurons_in_group * (window_size_ms / 1000.0))
- else:
- firing_rates_Hz[i] = 0 # If window size is 0, rate is 0
- return time_points_ms, firing_rates_Hz
- def calculate_weight(theta_i, theta_j, J_plus, J_minus, sigma_w_deg):
- delta_theta_deg = abs(theta_i - theta_j)
- delta_theta_deg = np.minimum(delta_theta_deg, 360 - delta_theta_deg)
- return J_minus + (J_plus - J_minus) * np.exp(-(delta_theta_deg**2) / (2 * sigma_w_deg**2))
- def generate_random_pulse_times_strict_constrained(start_t_ms, end_t_ms, num_pulses, proportional_jitter_factor=0.5):
- if num_pulses <= 0:
- return np.array([])
- if num_pulses == 1:
- return np.array([start_t_ms])
- min_interval = 200
- total_duration_ms = end_t_ms - start_t_ms
- if total_duration_ms < (num_pulses - 1) * min_interval:
- raise ValueError(
- f"²ÎÊý³åÍ»: ÎÞ·¨ÔÚ {total_duration_ms:.2f}ms ÄÚ·ÅÖà {num_pulses} ¸öÂö³å "
- f"ÇÒ±£³Ö×îС¼ä¸ô {min_interval}ms¡£"
- )
- free_time = total_duration_ms - (num_pulses - 1) * min_interval
- random_shifts = np.random.uniform(0, free_time, num_pulses - 1)
- random_shifts.sort()
- pulse_times = np.zeros(num_pulses)
- pulse_times[0] = start_t_ms
- for i in range(1, num_pulses):
- pulse_times[i] = start_t_ms + i * min_interval + random_shifts[i - 1]
- return pulse_times
- def run_continuous_layer(args):
- left_right_diff_val, iteration_num, gpu_id = args
- output_dir = os.path.join(base_data_dir, f'{left_right_diff_val}')
- os.makedirs(output_dir, exist_ok=True)
- txt_save_path = os.path.join(output_dir, f'E_spikes_run_{iteration_num}.txt')
- if os.path.exists(txt_save_path):
- print(f"Skipping Phase 1 for diff={left_right_diff_val}, run={iteration_num} (File already exists: {txt_save_path})")
- return
- start_scope()
- np.random.seed(iteration_num)
- try:
- cp.cuda.Device(gpu_id).use()
- except Exception as e:
- print(f"Phase 1 Warning: Could not set GPU {gpu_id}. Error: {e}")
- pass
- params = continuous_model_params.copy()
- pulse_params_local = pulse_params.copy()
- sim_params_local = sim_params.copy()
- pulse_params_local['left_right_diff'] = left_right_diff_val
- for par in ['gAMPA_E', 'gAMPA_I', 'gNMDA_E', 'gNMDA_I']:
- params[par] /= params['N_E']
- for par in ['gGABA_E', 'gGABA_I']:
- params[par] /= params['N_I']
- N_E = params['N_E']
- fsel = params['fsel']
- wp = params['wp']
- delay = params['delay']
- N1 = int(fsel*N_E)
- N2 = N1
- N0 = N_E - (N1 + N2)
- params['N0'] = N0
- params['N1'] = N1
- params['N2'] = N2
- wm = 0
- params['wm'] = wm
- weight_matrix = np.zeros((N_E, N_E))
- excitatory_thetas = np.linspace(0, 360, N_E, endpoint=False)
- for l in range(N_E):
- for m in range(N_E):
- weight_matrix[l, m] = calculate_weight(excitatory_thetas[l], excitatory_thetas[m], params['wp'], params['wm'], params['sigma_w'])
- weight_matrix_gpu = cp.asarray(weight_matrix)
- start_time_ms = pulse_params_local['start_time']/ms
- end_time_ms = pulse_params_local['end_time']/ms
- stim_num_left = (pulse_params_local['stim_num_sum'] - pulse_params_local['left_right_diff']) // 2
- stim_num_right = (pulse_params_local['stim_num_sum'] + pulse_params_local['left_right_diff']) // 2
- stim_num_left = max(0, stim_num_left)
- stim_num_right = max(0, stim_num_right)
- input_neuron_indices_left = np.array([], dtype=int)
- spike_times_left = np.array([]) * ms
- if stim_num_left > 0:
- try:
- pulse_times_ms_left = generate_random_pulse_times_strict_constrained(start_time_ms, end_time_ms, stim_num_left)
- input_neuron_indices_left = np.repeat(np.arange(N1), stim_num_left)
- spike_times_left = np.tile(pulse_times_ms_left, N1)*ms
- except ValueError as e:
- print(f"Simulation (diff={left_right_diff_val}, run={iteration_num}) for LEFT side failed: {e}")
- return
- input_neuron_indices_right = np.array([], dtype=int)
- spike_times_right = np.array([]) * ms
- if stim_num_right > 0:
- try:
- pulse_times_ms_right = generate_random_pulse_times_strict_constrained(start_time_ms, end_time_ms, stim_num_right)
- input_neuron_indices_right = np.repeat(np.arange(N1), stim_num_right)
- spike_times_right = np.tile(pulse_times_ms_right, N1)*ms
- except ValueError as e:
- print(f"Simulation (diff={left_right_diff_val}, run={iteration_num}) for RIGHT side failed: {e}")
- return
- net = OrderedDict()
- net['input_neurons_left'] = SpikeGeneratorGroup(N1, input_neuron_indices_left, spike_times_left)
- net['input_neurons_right'] = SpikeGeneratorGroup(N1, input_neuron_indices_right, spike_times_right)
- net['E']=NeuronGroup(2*params['N_E'],E_equations,method='rk2',threshold='V > Vth',reset='V = Vreset;w_SFA+=b_SFA',refractory=params['tau_ref_E'],namespace=params)
- net['E_left']= net['E'][0:params['N_E']]
- net['E_right']= net['E'][params['N_E']:]
- net['I_left']=NeuronGroup(params['N_I'],I_equations,method='rk2',threshold='V > Vth',reset='V = Vreset',refractory=params['tau_ref_I'],namespace=params)
- net['I_right']=NeuronGroup(params['N_I'],I_equations,method='rk2',threshold='V > Vth',reset='V = Vreset',refractory=params['tau_ref_I'],namespace=params)
- net['pgE_left'] = PoissonGroup(params['N_E'], params['nu_ext'])
- net['pgI_left'] = PoissonGroup(params['N_I'], params['nu_ext'])
- net['pgE_right'] = PoissonGroup(params['N_E'], params['nu_ext'])
- net['pgI_right'] = PoissonGroup(params['N_I'], params['nu_ext'])
- if len(input_neuron_indices_left) > 0:
- net['inE_left']=Synapses(net['input_neurons_left'], net['E_left'][pulse_params_local['start_index']:pulse_params_local['end_index']],on_pre='sAMPA_input += 1',delay=delay)
- net['inE_left'].connect(condition='i == j')
- if len(input_neuron_indices_right) > 0:
- net['inE_right']=Synapses(net['input_neurons_right'], net['E_right'][pulse_params_local['start_index']:pulse_params_local['end_index']],on_pre='sAMPA_input += 1',delay=delay)
- net['inE_right'].connect(condition='i == j')
- net['icE_left'] = Synapses(net['pgE_left'], net['E_left'],on_pre='sAMPA_ext += 1', delay=delay)
- net['icE_left'].connect(condition='i == j')
- net['icE_right'] = Synapses(net['pgE_right'], net['E_right'],on_pre='sAMPA_ext += 1', delay=delay)
- net['icE_right'].connect(condition='i == j')
- net['icI_left'] = Synapses(net['pgI_left'], net['I_left'],on_pre='sAMPA_ext += 1', delay=delay)
- net['icI_left'].connect(condition='i == j')
- net['icI_right'] = Synapses(net['pgI_right'], net['I_right'],on_pre='sAMPA_ext += 1', delay=delay)
- net['icI_right'].connect(condition='i == j')
- net['icAMPA_left'] = Synapses(net['E_left'], net['E_left'], on_pre='sAMPA += 1', delay=delay)
- net['icAMPA_left'].connect(condition='i == j')
- net['icNMDA_left'] = Synapses(net['E_left'], net['E_left'], on_pre='x += 1', delay=delay)
- net['icNMDA_left'].connect(condition='i == j')
- net['icGABA_left'] = Synapses(net['I_left'], net['I_left'], on_pre='sGABA += 1', delay=delay)
- net['icGABA_left'].connect(condition='i == j')
- net['icAMPA_right'] = Synapses(net['E_right'], net['E_right'], on_pre='sAMPA += 1', delay=delay)
- net['icAMPA_right'].connect(condition='i == j')
- net['icNMDA_right'] = Synapses(net['E_right'], net['E_right'], on_pre='x += 1', delay=delay)
- net['icNMDA_right'].connect(condition='i == j')
- net['icGABA_right'] = Synapses(net['I_right'], net['I_right'], on_pre='sGABA += 1', delay=delay)
- net['icGABA_right'].connect(condition='i == j')
- @network_operation(when='start')
- def recurrent_input():
- sAMPA_gpu_left = cp.asarray(net['E_left'].sAMPA)
- sNMDA_gpu_left = cp.asarray(net['E_left'].sNMDA)
- sAMPA_gpu_right = cp.asarray(net['E_right'].sAMPA)
- sNMDA_gpu_right = cp.asarray(net['E_right'].sNMDA)
- net['E_left'].S_AMPA = cp.dot(sAMPA_gpu_left, weight_matrix_gpu).get()
- net['E_left'].S_NMDA = cp.dot(sNMDA_gpu_left, weight_matrix_gpu).get()
- net['I_left'].S_AMPA=sum(net['E_left'].sAMPA)
- net['I_left'].S_NMDA=sum(net['E_left'].sNMDA)
- net['E_right'].S_AMPA = cp.dot(sAMPA_gpu_right, weight_matrix_gpu).get()
- net['E_right'].S_NMDA = cp.dot(sNMDA_gpu_right, weight_matrix_gpu).get()
- net['I_right'].S_AMPA=sum(net['E_right'].sAMPA)
- net['I_right'].S_NMDA=sum(net['E_right'].sNMDA)
- net['E_left'].S_GABA=sum(net['I_left'].sGABA)
- net['E_right'].S_GABA=sum(net['I_right'].sGABA)
- net['I_left'].S_GABA=sum(net['I_left'].sGABA)
- net['I_right'].S_GABA=sum(net['I_right'].sGABA)
- net['E_left'].V = np.random.uniform(params['Vreset'],params['Vth'],size=params['N_E']) * volt
- net['I_left'].V = np.random.uniform(params['Vreset'],params['Vth'],size=params['N_I']) * volt
- net['E_right'].V = np.random.uniform(params['Vreset'],params['Vth'],size=params['N_E']) * volt
- net['I_right'].V = np.random.uniform(params['Vreset'],params['Vth'],size=params['N_I']) * volt
- spikemon_E = SpikeMonitor(net['E'])
- defaultclock.dt=0.05*ms
- total_duration = sim_params_local['sim_purations']
- network = Network(list(net.values()) + [recurrent_input, spikemon_E])
- print(f"Continuous Model (diff={left_right_diff_val}, run={iteration_num}): Starting...")
- network.run(total_duration, report='text')
- spike_data = np.column_stack((spikemon_E.i, spikemon_E.t/ms))
- np.savetxt(txt_save_path, spike_data, fmt=['%d', '%.4f'])
- print(f"Continuous Model (diff={left_right_diff_val}, run={iteration_num}): Saved to {txt_save_path}")
- del weight_matrix_gpu
- try:
- cp.get_default_memory_pool().free_all_blocks()
- except:
- pass
- def run_purkinje_layer(args):
- left_right_diff_val, iteration_num, gGABA_val = args
- start_scope()
- output_dir = os.path.join(base_data_dir, f'{gGABA_val}nS', f'{left_right_diff_val}')
- os.makedirs(output_dir, exist_ok=True)
- txt_load_path = os.path.join(base_data_dir, f'{left_right_diff_val}', f'E_spikes_run_{iteration_num}.txt')
- if not os.path.exists(txt_load_path):
- print(f"Error: Continuous model data not found at {txt_load_path}")
- return
- np.random.seed(iteration_num)
- params = continuous_model_params.copy()
- gc_par_local = gc_par.copy()
- PC_par_local = PC_par.copy()
- sim_params_local = sim_params.copy()
- PC_par_local['gGABA'] = gGABA_val * nS
- PC_par_local['gAMPA'] = PC_par_local['gAMPA'] / gc_par_local['N_gc']
- try:
- loaded_data = np.loadtxt(txt_load_path)
- if loaded_data.size == 0:
- E_replay_indices = np.array([], dtype=int)
- E_replay_times = np.array([]) * ms
- elif loaded_data.ndim == 1:
- E_replay_indices = np.array([int(loaded_data[0])])
- E_replay_times = np.array([loaded_data[1]]) * ms
- else:
- E_replay_indices = loaded_data[:, 0].astype(int)
- E_replay_times = loaded_data[:, 1] * ms
- except Exception as e:
- print(f"Error reading file {txt_load_path}: {e}")
- return
- net = OrderedDict()
- net['E_replay'] = SpikeGeneratorGroup(2 * params['N_E'], E_replay_indices, E_replay_times)
- net['E'] = net['E_replay']
- net['pgr'] = PoissonGroup(gc_par_local['N_gc'], rates=gc_par_local['possion_noise'])
- net['gc_layer'] = NeuronGroup(gc_par_local['N_gc'], model=eqs_gc,threshold='v >= vpeak',reset='v = c_reset; u += d_reset',method='euler',namespace=gc_par_local)
- net['gc_layer'].v = gc_par_local['vr']
- net['gc_layer'].u = gc_par_local['b'] * (net['gc_layer'].v - gc_par_local['vr'])
- net['PC_neuron_left'] = NeuronGroup(PC_par_local['N'], eqs_pc, threshold='v >= VSpike', reset='v = vreset; w += b', method='euler',namespace=PC_par_local)
- net['PC_neuron_right'] = NeuronGroup(PC_par_local['N'], eqs_pc, threshold='v >= VSpike', reset='v = vreset; w += b', method='euler',namespace=PC_par_local)
- net['PC_neuron_left'].v = -55 * mV
- net['PC_neuron_left'].w = 0* pA
- net['PC_neuron_right'].v = -55 * mV
- net['PC_neuron_right'].w = 0* pA
- net['gc_left']=net['gc_layer'][0:gc_par_local['N_gc'] // 2]
- net['gc_right']=net['gc_layer'][gc_par_local['N_gc'] // 2:]
- net['icgr']=Synapses(net['pgr'],net['gc_layer'],on_pre="sAMPA_noise+=1",namespace=gc_par_local)
- net['icgr'].connect(condition='i == j')
- pre_indices = []
- post_indices = []
- E_left_global_indices = np.arange(params['N_E'])
- E_right_global_indices = np.arange(params['N_E'], 2 * params['N_E'])
- for l in range(gc_par_local['N_gc'] // 2):
- chosen_pre_indices = np.random.choice(E_left_global_indices, size=gc_par_local['mossy_fiber_input_num'], replace=False)
- pre_indices.extend(chosen_pre_indices)
- post_indices.extend([l] * gc_par_local['mossy_fiber_input_num'])
- for l in range(gc_par_local['N_gc'] // 2, gc_par_local['N_gc']):
- chosen_pre_indices = np.random.choice(E_right_global_indices, size=gc_par_local['mossy_fiber_input_num'], replace=False)
- pre_indices.extend(chosen_pre_indices)
- post_indices.extend([l] * gc_par_local['mossy_fiber_input_num'])
- net['icEgr']=Synapses(net['E'],net['gc_layer'],on_pre="sAMPA+=1",namespace=gc_par_local)
- net['icEgr'].connect(i=pre_indices, j=post_indices)
- net['icgrPc_left']=Synapses(net['gc_left'], net['PC_neuron_left'], on_pre='sAMPA_post += 1')
- net['icgrPc_left'].connect()
- net['icgrPc_right']=Synapses(net['gc_right'], net['PC_neuron_right'], on_pre='sAMPA_post += 1')
- net['icgrPc_right'].connect()
- net['icPcPc_left']=Synapses(net['PC_neuron_left'],net['PC_neuron_left'],on_pre='sGABA+=1')
- net['icPcPc_left'].connect('i==j')
- net['icPcPc_right']=Synapses(net['PC_neuron_right'],net['PC_neuron_right'],on_pre='sGABA+=1')
- net['icPcPc_right'].connect('i==j')
- @network_operation(when='start')
- def recurrent_input_pc():
- net['PC_neuron_left'].S_GABA=sum(net['PC_neuron_right'].sGABA)/PC_par_local['N']
- net['PC_neuron_right'].S_GABA=sum(net['PC_neuron_left'].sGABA)/PC_par_local['N']
- spikemon_PC_left = SpikeMonitor(net['PC_neuron_left'])
- spikemon_PC_right = SpikeMonitor(net['PC_neuron_right'])
- defaultclock.dt=0.05*ms
- total_duration = sim_params_local['sim_purations']
- network = Network(list(net.values()) + [recurrent_input_pc, spikemon_PC_left, spikemon_PC_right])
- print(f"Purkinje Simulation (gGABA={gGABA_val}nS, diff={left_right_diff_val}, run={iteration_num}): Starting run...")
- try:
- network.run(total_duration, report='text')
- print(f"Purkinje Simulation (gGABA={gGABA_val}nS, diff={left_right_diff_val}, run={iteration_num}): Finished run.")
- except Exception as e:
- print(f"Purkinje Simulation (gGABA={gGABA_val}nS, diff={left_right_diff_val}, run={iteration_num}): Failed with error: {e}")
- return
- PC_spike_times_left = spikemon_PC_left.t
- PC_spike_indices_left = spikemon_PC_left.i
- PC_spike_times_right = spikemon_PC_right.t
- PC_spike_indices_right = spikemon_PC_right.i
- np.save(os.path.join(output_dir, f'spikes_PC_left_t_run_{iteration_num}.npy'), PC_spike_times_left/ms)
- np.save(os.path.join(output_dir, f'spikes_PC_left_i_run_{iteration_num}.npy'), PC_spike_indices_left)
- np.save(os.path.join(output_dir, f'spikes_PC_right_t_run_{iteration_num}.npy'), PC_spike_times_right/ms)
- np.save(os.path.join(output_dir, f'spikes_PC_right_i_run_{iteration_num}.npy'), PC_spike_indices_right)
- window_size = 100*ms
- step_size = 2*ms
- time_points, rate_PC_left = calculate_sliding_window_rate(PC_spike_times_left, PC_par_local['N'], total_duration, window_size, step_size)
- _, rate_PC_right = calculate_sliding_window_rate(PC_spike_times_right, PC_par_local['N'], total_duration, window_size, step_size)
- np.save(os.path.join(output_dir, f'rates_time_points_run_{iteration_num}.npy'), time_points)
- np.save(os.path.join(output_dir, f'rates_PC_left_run_{iteration_num}.npy'), rate_PC_left)
- np.save(os.path.join(output_dir, f'rates_PC_right_run_{iteration_num}.npy'), rate_PC_right)
- if __name__ == '__main__':
- try:
- multiprocessing.set_start_method('spawn', force=True)
- except RuntimeError:
- pass
- # phase1_gpu_config = {
- # 1: 3,
- # 2: 3,
- # 3: 3,
- # 4: 3,
- # 5: 3
- # }
- phase1_gpu_config = {
- 0:3
- }
- phase1_num_processes_to_use = sum(list(phase1_gpu_config.values()))
- phase1_gpu_pool = []
- for gid, threads in phase1_gpu_config.items():
- phase1_gpu_pool.extend([gid] * threads)
- # -------------------------------------------------------------
- left_right_diff_values = [1,3,5,9,13]
- num_runs_per_diff = 255
- gGABA_values = range(2, 31)
- num_processes_to_use = 255
- # -------------------------------------------------------------
- print(f"Using {phase1_num_processes_to_use} processes for Phase 1 multiprocessing.")
- print(f"Using {num_processes_to_use} processes for Phase 2 multiprocessing.")
- for diff_val in left_right_diff_values:
- print(f"\n=== Phase 1: Running Continuous Model for diff = {diff_val} ===")
- phase1_tasks = []
- for run_idx in range(1, num_runs_per_diff + 1):
- expected_txt_path = os.path.join(base_data_dir, f'{diff_val}', f'E_spikes_run_{run_idx}.txt')
- if os.path.exists(expected_txt_path):
- print(f"File exists, skipping Phase 1 task submission for diff={diff_val}, run={run_idx}")
- continue
- assigned_gpu = phase1_gpu_pool[run_idx % len(phase1_gpu_pool)]
- phase1_tasks.append((diff_val, run_idx, assigned_gpu))
- if len(phase1_tasks) > 0:
- print(f"Submitting {len(phase1_tasks)} Phase 1 tasks...")
- with multiprocessing.Pool(processes=phase1_num_processes_to_use) as pool:
- for _ in pool.imap_unordered(run_continuous_layer, phase1_tasks):
- pass
- else:
- print("All Phase 1 tasks already completed. Skipping simulation.")
- for g_val in gGABA_values:
- print(f"\n=== Processing gGABA = {g_val}nS, left_right_diff = {diff_val} ===")
- print(f"--- Phase 2: Running Purkinje Model (Multi Threaded) ---")
- current_tasks = []
- for run_idx in range(1, num_runs_per_diff + 1):
- current_tasks.append((diff_val, run_idx, g_val))
- print(f"Submitting {len(current_tasks)} tasks for gGABA = {g_val}nS...")
- with multiprocessing.Pool(processes=num_processes_to_use) as pool:
- for _ in pool.imap_unordered(run_purkinje_layer, current_tasks):
- pass
- print(f"--- Finished gGABA = {g_val}nS ---")
- print(f"\nAll simulations completed across all gGABA and diff_values.")
cortico-cerebellar.py at commit e03ac74, no license · at the source
Overview
- Academy of Medical Engineering and Translational Medicine, Medical Faculty, Tianjin University, Tianjin 300072, China
- State Key Laboratory of Advanced Medical Materials and Medical Devices, Tianjin University, Tianjin 300072, China
- School of Mathematical Sciences, Beihang University, Beijing 100191, China
Abstract
The cerebellum is increasingly implicated in perceptual decision-making, yet it remains unclear how the cerebellar cortex can support sparse evidence accumulation over behavioral time scales without assuming cortical-style dense local excitatory recurrence. We present a biologically constrained modeling framework showing that cerebellar microcircuits can implement graded accumulation and competition in the absence of such recurrence. In our model, type-II Purkinje-neuron excitability generates firing-rate hysteresis that prolongs the impact of brief inputs far beyond intrinsic membrane and synaptic time constants, enabling accumulation across long interevent intervals. Purkinje neuron collateral inhibition produces competitive divergence and tunes temporal evidence weighting, revealing a trade-off between commitment and primacy bias. In a bidirectionally coupled cortico-cerebello-cortic
Reproduced under the paper's license (CC BY), from the paper cited above.
Repository
Its files are read in the Code ↔ Paper reader above.
yyb177/cerebellar-decision-making
e03ac74ba0c66ccb4bb275d1b81b8defd1122c7d, 13 May 2026Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
4 files
- cortico-cerebellar.py, Python, 542 lines
- cortico-cerebello-cortic
al.py , Python, 796 lines - cortico-cortical.py, Python, 307 lines
- README.md, Text, 2 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;
- 3 scripts, each with its path and the digest of its content;
- no match between paragraphs and code yet;
- 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, Materials, and Software Availability
The simulation code used in this study is publicly available at GitHub (88).
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, issue, pages, dates, 5 authors, 5 keywords, 9 MeSH terms, 2 funders, 87 references.
Cite
This paper
Bao, Y., Yu, L., Lu, L., Yang, Z., & Zang, Y. (2026). Cerebellar microcircuits enable robust evidence-based decisions through cortico-cerebellar coupling. Proceedings of the National Academy of Sciences of the United States of America, 123(35), e2616911123. https://
BibTeX
@article{bao2026cerebell
author = {Bao, Yeyao and Yu, Liao and Lu, Liangfu and Yang, Zhuoqin and Zang, Yunliang},
title = {{Cerebellar microcircuits enable robust evidence-based decisions through cortico-cerebellar coupling}},
journal = {Proceedings of the National Academy of Sciences of the United States of America},
year = {2026},
month = aug,
volume = {123},
number = {35},
pages = {e2616911123},
publisher = {National Academy of Sciences},
issn = {0027-8424},
doi = {10.1073/
url = {https://
pmid = {42658769},
pmcid = {PMC13534631}
}
RIS
TY - JOUR
AU - Bao, Yeyao
AU - Yu, Liao
AU - Lu, Liangfu
AU - Yang, Zhuoqin
AU - Zang, Yunliang
TI - Cerebellar microcircuits enable robust evidence-based decisions through cortico-cerebellar coupling
T2 - Proceedings of the National Academy of Sciences of the United States of America
J2 - Proc Natl Acad Sci U S A
PY - 2026
DA - 2026/
VL - 123
IS - 35
SP - e2616911123
SN - 0027-8424
PB - National Academy of Sciences
DO - 10.1073/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1073/
"type": "article-journal",
"title": "Cerebellar microcircuits enable robust evidence-based decisions through cortico-cerebellar coupling",
"container-title": "Proceedings of the National Academy of Sciences of the United States of America",
"author": [
{
"family": "Bao",
"given": "Yeyao"
},
{
"family": "Yu",
"given": "Liao"
},
{
"family": "Lu",
"given": "Liangfu"
},
{
"family": "Yang",
"given": "Zhuoqin"
},
{
"family": "Zang",
"given": "Yunliang"
}
],
"container-title-short":
"volume": "123",
"issue": "35",
"page": "e2616911123",
"DOI": "10.1073/
"PMID": "42658769",
"PMCID": "PMC13534631",
"ISSN": "0027-8424",
"publisher": "National Academy of Sciences",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
8,
27
]
]
}
}
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.1371/journal.pcbi.1014595 [code]
- Cerebellum-inspired neural network of supervised learning with tensor-based sparse coding for multi-class classification.Journal: PLoS computational biologyIn common: Matplotlib, NumPy, 6 references
- [2] doi:10.1038/s41593-026-02255-7 [code]
- Neural circuits encode prior knowledge of temporal statistics.Journal: Nature neuroscienceIn common: Matplotlib, NumPy, 6 references
- [3] doi:10.1016/j.celrep.2026.117262 [code]
- Cerebellar acceleration of learning in an evidence-accumulation task.Journal: Cell reportsIn common: Matplotlib, NumPy, cognitive, 5 references
- [4] doi:10.1126/sciadv.aed6417 [code]
- Intrinsic timing, not temporal prediction, underlies ramping dynamics in visual and parietal cortex during passive behavior.Journal: Science advancesIn common: Matplotlib, NumPy, 5 references
- [5] doi:10.1038/s41467-026-75924-7 [code]
- Data-driven reduced modeling of neural dynamics.Journal: Nature communicationsIn common: Matplotlib, NumPy, computational modeling (no new data), 4 references
- [6] doi:10.1038/s41467-026-75371-4 [code]
- Cerebellar neural populations orchestrate dopamine reward signaling with single-trial precision.Journal: Nature communicationsIn common: Matplotlib, NumPy, 4 references
- [7] doi:10.1038/s41467-026-75704-3 [code]
- A minimal model of working memory in neural systems and neuromorphic circuits.Journal: Nature communicationsIn common: Brian 2, Matplotlib, NumPy, computational modeling (no new data), 1 reference
- [8] doi:10.7554/elife.102813
- Multiple functions of cerebello-thalamic neurons in learning and offline consolidation of a motor skill in mice.Journal: eLifeIn common: 4 references
- [9] doi:10.1038/s42003-026-10034-0 [code]
- Region- and cell type-specific changes in gene expression in the cerebellum after classical fear conditioning.Journal: Communications biologyIn common: Matplotlib, NumPy, 3 references
- [10] doi:10.1038/s41593-026-02388-9 [code]
- Hippocampal CA3 connectomics reveals a gradient of mossy fiber inputs and selective feedforward inhibition onto pyramidal cells.Journal: Nature neuroscienceIn common: Matplotlib, NumPy, 3 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, 3 scripts, and 0 matches 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:77d769f74f6b8c1d…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
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.
