def test_stim_pyramidal_impact(): simulation_clock=Clock(dt=.5*ms) trial_duration=1*second dcs_start_time=.5*second stim_levels=[-8,-6,-4,-2,-1,-.5,-.25,0,.25,.5,1,2,4,6,8] voltages = np.zeros(len(stim_levels)) for idx,stim_level in enumerate(stim_levels): print('testing stim_level %.3fpA' % stim_level) eqs = exp_IF(default_params.C, default_params.gL, default_params.EL, default_params.VT, default_params.DeltaT) # AMPA conductance - recurrent input current eqs += exp_synapse('g_ampa_r', default_params.tau_ampa, siemens) eqs += Current('I_ampa_r=g_ampa_r*(E-vm): amp', E=default_params.E_ampa) # AMPA conductance - background input current eqs += exp_synapse('g_ampa_b', default_params.tau_ampa, siemens) eqs += Current('I_ampa_b=g_ampa_b*(E-vm): amp', E=default_params.E_ampa) # AMPA conductance - task input current eqs += exp_synapse('g_ampa_x', default_params.tau_ampa, siemens) eqs += Current('I_ampa_x=g_ampa_x*(E-vm): amp', E=default_params.E_ampa) # Voltage-dependent NMDA conductance eqs += biexp_synapse('g_nmda', default_params.tau1_nmda, default_params.tau2_nmda, siemens) eqs += Equations('g_V = 1/(1+(Mg/3.57)*exp(-0.062 *vm/mV)) : 1 ', Mg=default_params.Mg) eqs += Current('I_nmda=g_V*g_nmda*(E-vm): amp', E=default_params.E_nmda) # GABA-A conductance eqs += exp_synapse('g_gaba_a', default_params.tau_gaba_a, siemens) eqs += Current('I_gaba_a=g_gaba_a*(E-vm): amp', E=default_params.E_gaba_a) eqs +=InjectedCurrent('I_dcs: amp') group=NeuronGroup(1, model=eqs, threshold=-20*mV, refractory=pyr_params.refractory, reset=default_params.Vr, compile=True, freeze=True, clock=simulation_clock) group.C=pyr_params.C group.gL=pyr_params.gL @network_operation(clock=simulation_clock) def inject_current(c): if simulation_clock.t>dcs_start_time: group.I_dcs=stim_level*pA monitor=StateMonitor(group, 'vm', simulation_clock, record=True) net=Network(group, monitor, inject_current) net.run(trial_duration, report='text') voltages[idx]=monitor.values[0,-1]*1000 voltages=voltages-voltages[7] plt.figure() plt.plot(stim_levels,voltages) plt.xlabel('Stimulation level (pA)') plt.ylabel('Voltage Change (mV)') plt.show()
def __init__(self, params=default_params, pyr_params=pyr_params(), inh_params=inh_params(), background_input=None, task_inputs=None, clock=defaultclock): self.params=params self.pyr_params=pyr_params self.inh_params=inh_params self.background_input=background_input self.task_inputs=task_inputs ## Set up equations # Exponential integrate-and-fire neuron eqs = exp_IF(params.C, params.gL, params.EL, params.VT, params.DeltaT) eqs += Equations('g_muscimol : nS') # AMPA conductance - recurrent input current eqs += exp_synapse('g_ampa_r', params.tau_ampa, siemens) eqs += Current('I_ampa_r=g_ampa_r*(E-vm): amp', E=params.E_ampa) # AMPA conductance - background input current eqs += exp_synapse('g_ampa_b', params.tau_ampa, siemens) eqs += Current('I_ampa_b=g_ampa_b*(E-vm): amp', E=params.E_ampa) # AMPA conductance - task input current eqs += exp_synapse('g_ampa_x', params.tau_ampa, siemens) eqs += Current('I_ampa_x=g_ampa_x*(E-vm): amp', E=params.E_ampa) # Voltage-dependent NMDA conductance eqs += biexp_synapse('g_nmda', params.tau1_nmda, params.tau2_nmda, siemens) eqs += Equations('g_V = 1/(1+(Mg/3.57)*exp(-0.062 *vm/mV)) : 1 ', Mg=params.Mg) eqs += Current('I_nmda=g_V*g_nmda*(E-vm): amp', E=params.E_nmda) # GABA-A conductance eqs += exp_synapse('g_gaba_a', params.tau_gaba_a, siemens) eqs += Current('I_gaba_a=g_gaba_a*(E-vm): amp', E=params.E_gaba_a) eqs +=InjectedCurrent('I_dcs: amp') NeuronGroup.__init__(self, params.network_group_size, model=eqs, threshold=-20*mV, refractory=1*ms, reset=params.Vr, compile=True, freeze=True, clock=clock) self.init_subpopulations() self.init_connectivity(clock)
def test_stim_pyramidal_impact(): simulation_clock = Clock(dt=.5 * ms) trial_duration = 1 * second dcs_start_time = .5 * second stim_levels = [-8, -6, -4, -2, -1, -.5, -.25, 0, .25, .5, 1, 2, 4, 6, 8] voltages = np.zeros(len(stim_levels)) for idx, stim_level in enumerate(stim_levels): print('testing stim_level %.3fpA' % stim_level) eqs = exp_IF(default_params.C, default_params.gL, default_params.EL, default_params.VT, default_params.DeltaT) # AMPA conductance - recurrent input current eqs += exp_synapse('g_ampa_r', default_params.tau_ampa, siemens) eqs += Current('I_ampa_r=g_ampa_r*(E-vm): amp', E=default_params.E_ampa) # AMPA conductance - background input current eqs += exp_synapse('g_ampa_b', default_params.tau_ampa, siemens) eqs += Current('I_ampa_b=g_ampa_b*(E-vm): amp', E=default_params.E_ampa) # AMPA conductance - task input current eqs += exp_synapse('g_ampa_x', default_params.tau_ampa, siemens) eqs += Current('I_ampa_x=g_ampa_x*(E-vm): amp', E=default_params.E_ampa) # Voltage-dependent NMDA conductance eqs += biexp_synapse('g_nmda', default_params.tau1_nmda, default_params.tau2_nmda, siemens) eqs += Equations('g_V = 1/(1+(Mg/3.57)*exp(-0.062 *vm/mV)) : 1 ', Mg=default_params.Mg) eqs += Current('I_nmda=g_V*g_nmda*(E-vm): amp', E=default_params.E_nmda) # GABA-A conductance eqs += exp_synapse('g_gaba_a', default_params.tau_gaba_a, siemens) eqs += Current('I_gaba_a=g_gaba_a*(E-vm): amp', E=default_params.E_gaba_a) eqs += InjectedCurrent('I_dcs: amp') group = NeuronGroup(1, model=eqs, threshold=-20 * mV, refractory=pyr_params.refractory, reset=default_params.Vr, compile=True, freeze=True, clock=simulation_clock) group.C = pyr_params.C group.gL = pyr_params.gL @network_operation(clock=simulation_clock) def inject_current(c): if simulation_clock.t > dcs_start_time: group.I_dcs = stim_level * pA monitor = StateMonitor(group, 'vm', simulation_clock, record=True) net = Network(group, monitor, inject_current) net.run(trial_duration, report='text') voltages[idx] = monitor.values[0, -1] * 1000 voltages = voltages - voltages[7] plt.figure() plt.plot(stim_levels, voltages) plt.xlabel('Stimulation level (pA)') plt.ylabel('Voltage Change (mV)') plt.show()
def __init__(self, params=default_params, pyr_params=pyr_params(), inh_params=inh_params(), plasticity_params=plasticity_params(), background_input=None, task_inputs=None, clock=defaultclock): self.params = params self.pyr_params = pyr_params self.inh_params = inh_params self.plasticity_params = plasticity_params self.background_input = background_input self.task_inputs = task_inputs ## Set up equations # Exponential integrate-and-fire neuron eqs = exp_IF(params.C, params.gL, params.EL, params.VT, params.DeltaT) eqs += Equations('g_muscimol : nS') # AMPA conductance - recurrent input current eqs += exp_synapse('g_ampa_r', params.tau_ampa, siemens) eqs += Current('I_ampa_r=g_ampa_r*(E-vm): amp', E=params.E_ampa) # AMPA conductance - background input current eqs += exp_synapse('g_ampa_b', params.tau_ampa, siemens) eqs += Current('I_ampa_b=g_ampa_b*(E-vm): amp', E=params.E_ampa) # AMPA conductance - task input current eqs += exp_synapse('g_ampa_x', params.tau_ampa, siemens) eqs += Current('I_ampa_x=g_ampa_x*(E-vm): amp', E=params.E_ampa) # Voltage-dependent NMDA conductance eqs += biexp_synapse('g_nmda', params.tau1_nmda, params.tau2_nmda, siemens) eqs += Equations('g_V = 1/(1+(Mg/3.57)*exp(-0.062 *vm/mV)) : 1 ', Mg=params.Mg) eqs += Current('I_nmda=g_V*g_nmda*(E-vm): amp', E=params.E_nmda) # GABA-A conductance eqs += exp_synapse('g_gaba_a', params.tau_gaba_a, siemens) eqs += Current('I_gaba_a=(g_gaba_a+g_muscimol)*(E-vm): amp', E=params.E_gaba_a) eqs += InjectedCurrent('I_dcs: amp') # Total synaptic conductance eqs += Equations( 'g_syn=g_ampa_r+g_ampa_x+g_ampa_b+g_V*g_nmda+g_gaba_a : siemens') eqs += Equations( 'g_syn_exc=g_ampa_r+g_ampa_x+g_ampa_b+g_V*g_nmda : siemens') # Total synaptic current eqs += Equations( 'I_abs=(I_ampa_r**2)**.5+(I_ampa_b**2)**.5+(I_ampa_x**2)**.5+(I_nmda**2)**.5+(I_gaba_a**2)**.5 : amp' ) NeuronGroup.__init__(self, params.network_group_size, model=eqs, threshold=-20 * mV, refractory=1 * ms, reset=params.Vr, compile=True, freeze=True, clock=clock) self.init_subpopulations() self.init_connectivity(clock)
def __init__(self, lip_size, params, background_inputs=None, visual_cortex_input=None, go_input=None): self.lip_size = lip_size self.N = 2 * self.lip_size self.params = params self.background_inputs = background_inputs self.visual_cortex_input = visual_cortex_input self.go_input = go_input ## Set up equations # Exponential integrate-and-fire neuron eqs = exp_IF(params.C, params.gL, params.EL, params.VT, params.DeltaT) # AMPA conductance - recurrent input current eqs += exp_synapse('g_ampa_r', params.tau_ampa, siemens) eqs += Current('I_ampa_r=g_ampa_r*(E-vm): amp', E=params.E_ampa) # AMPA conductance - background input current eqs += exp_synapse('g_ampa_b', params.tau_ampa, siemens) eqs += Current('I_ampa_b=g_ampa_b*(E-vm): amp', E=params.E_ampa) # AMPA conductance - task input current eqs += exp_synapse('g_ampa_x', params.tau_ampa, siemens) eqs += Current('I_ampa_x=g_ampa_x*(E-vm): amp', E=params.E_ampa) # AMPA conductance - go input current eqs += exp_synapse('g_ampa_g', params.tau_ampa, siemens) eqs += Current('I_ampa_g=g_ampa_g*(E-vm): amp', E=params.E_ampa) # Voltage-dependent NMDA conductance eqs += biexp_synapse('g_nmda', params.tau1_nmda, params.tau2_nmda, siemens) eqs += Equations('g_V = 1/(1+(Mg/3.57)*exp(-0.062 *vm/mV)) : 1 ', Mg=params.Mg) eqs += Current('I_nmda=g_V*g_nmda*(E-vm): amp', E=params.E_nmda) # GABA-A conductance eqs += exp_synapse('g_gaba_a', params.tau_gaba_a, siemens) eqs += Current('I_gaba_a=g_gaba_a*(E-vm): amp', E=params.E_gaba_a) # GABA-B conductance eqs += biexp_synapse('g_gaba_b', params.tau1_gaba_b, params.tau2_gaba_b, siemens) eqs += Current('I_gaba_b=g_gaba_b*(E-vm): amp', E=params.E_gaba_b) # Total synaptic conductance eqs += Equations( 'g_syn=g_ampa_r+g_ampa_x+g_ampa_g+g_ampa_b+g_V*g_nmda+g_gaba_a+g_gaba_b : siemens' ) eqs += Equations( 'g_syn_exc=g_ampa_r+g_ampa_x+g_ampa_g+g_ampa_b+g_V*g_nmda : siemens' ) # Total synaptic current eqs += Equations( 'I_abs=abs(I_ampa_r)+abs(I_ampa_b)+abs(I_ampa_x)+abs(I_ampa_g)+abs(I_nmda)+abs(I_gaba_a) : amp' ) NeuronGroup.__init__(self, self.N, model=eqs, threshold=-20 * mV, reset=params.EL, compile=True) self.init_subpopulations() self.connections = [] self.init_connectivity() if self.background_inputs is not None: # Background -> E+I population connections background_left_ampa = init_connection(self.background_inputs[0], self.left_lip.neuron_group, 'g_ampa_b', self.params.w_ampa_min, self.params.w_ampa_max, self.params.p_b_e, delay=5 * ms) background_right_ampa = init_connection( self.background_inputs[1], self.right_lip.neuron_group, 'g_ampa_b', self.params.w_ampa_min, self.params.w_ampa_max, self.params.p_b_e, delay=5 * ms) self.connections.append(background_left_ampa) self.connections.append(background_right_ampa) if self.visual_cortex_input is not None: # Task input -> E population connections vc_left_lip_ampa = init_connection(self.visual_cortex_input[0], self.left_lip.e_contra_vis, 'g_ampa_x', self.params.w_ampa_min, self.params.w_ampa_max, self.params.p_v_ec_vis, delay=270 * ms) vc_right_lip_ampa = init_connection(self.visual_cortex_input[1], self.right_lip.e_contra_vis, 'g_ampa_x', self.params.w_ampa_min, self.params.w_ampa_max, self.params.p_v_ec_vis, delay=270 * ms) self.connections.append(vc_left_lip_ampa) self.connections.append(vc_right_lip_ampa) if self.go_input is not None: go_left_lip_i_ampa = init_connection(self.go_input, self.left_lip.i_group, 'g_ampa_g', self.params.w_ampa_min, self.params.w_ampa_max, self.params.p_g_i, delay=5 * ms) go_right_lip_i_ampa = init_connection(self.go_input, self.right_lip.i_group, 'g_ampa_g', self.params.w_ampa_min, self.params.w_ampa_max, self.params.p_g_i, delay=5 * ms) go_left_lip_e_ampa = init_connection(self.go_input, self.left_lip.e_group, 'g_ampa_g', self.params.w_ampa_min, self.params.w_ampa_max, self.params.p_g_e, delay=5 * ms) go_right_lip_e_ampa = init_connection(self.go_input, self.right_lip.e_group, 'g_ampa_g', self.params.w_ampa_min, self.params.w_ampa_max, self.params.p_g_e, delay=5 * ms) self.connections.append(go_left_lip_i_ampa) self.connections.append(go_right_lip_i_ampa) self.connections.append(go_left_lip_e_ampa) self.connections.append(go_right_lip_e_ampa)
def __init__(self, lip_size, params, background_inputs=None, visual_cortex_input=None, go_input=None): self.lip_size=lip_size self.N=2*self.lip_size self.params=params self.background_inputs=background_inputs self.visual_cortex_input=visual_cortex_input self.go_input=go_input ## Set up equations # Exponential integrate-and-fire neuron eqs = exp_IF(params.C, params.gL, params.EL, params.VT, params.DeltaT) # AMPA conductance - recurrent input current eqs += exp_synapse('g_ampa_r', params.tau_ampa, siemens) eqs += Current('I_ampa_r=g_ampa_r*(E-vm): amp', E=params.E_ampa) # AMPA conductance - background input current eqs += exp_synapse('g_ampa_b', params.tau_ampa, siemens) eqs += Current('I_ampa_b=g_ampa_b*(E-vm): amp', E=params.E_ampa) # AMPA conductance - task input current eqs += exp_synapse('g_ampa_x', params.tau_ampa, siemens) eqs += Current('I_ampa_x=g_ampa_x*(E-vm): amp', E=params.E_ampa) # AMPA conductance - go input current eqs += exp_synapse('g_ampa_g', params.tau_ampa, siemens) eqs += Current('I_ampa_g=g_ampa_g*(E-vm): amp', E=params.E_ampa) # Voltage-dependent NMDA conductance eqs += biexp_synapse('g_nmda', params.tau1_nmda, params.tau2_nmda, siemens) eqs += Equations('g_V = 1/(1+(Mg/3.57)*exp(-0.062 *vm/mV)) : 1 ', Mg=params.Mg) eqs += Current('I_nmda=g_V*g_nmda*(E-vm): amp', E=params.E_nmda) # GABA-A conductance eqs += exp_synapse('g_gaba_a', params.tau_gaba_a, siemens) eqs += Current('I_gaba_a=g_gaba_a*(E-vm): amp', E=params.E_gaba_a) # GABA-B conductance eqs += biexp_synapse('g_gaba_b', params.tau1_gaba_b, params.tau2_gaba_b, siemens) eqs += Current('I_gaba_b=g_gaba_b*(E-vm): amp', E=params.E_gaba_b) # Total synaptic conductance eqs += Equations('g_syn=g_ampa_r+g_ampa_x+g_ampa_g+g_ampa_b+g_V*g_nmda+g_gaba_a+g_gaba_b : siemens') eqs += Equations('g_syn_exc=g_ampa_r+g_ampa_x+g_ampa_g+g_ampa_b+g_V*g_nmda : siemens') # Total synaptic current eqs += Equations('I_abs=abs(I_ampa_r)+abs(I_ampa_b)+abs(I_ampa_x)+abs(I_ampa_g)+abs(I_nmda)+abs(I_gaba_a) : amp') NeuronGroup.__init__(self, self.N, model=eqs, threshold=-20*mV, reset=params.EL, compile=True) self.init_subpopulations() self.connections=[] self.init_connectivity() if self.background_inputs is not None: # Background -> E+I population connections background_left_ampa=init_connection(self.background_inputs[0], self.left_lip.neuron_group, 'g_ampa_b', self.params.w_ampa_min, self.params.w_ampa_max, self.params.p_b_e, delay=5*ms) background_right_ampa=init_connection(self.background_inputs[1], self.right_lip.neuron_group, 'g_ampa_b', self.params.w_ampa_min, self.params.w_ampa_max, self.params.p_b_e, delay=5*ms) self.connections.append(background_left_ampa) self.connections.append(background_right_ampa) if self.visual_cortex_input is not None: # Task input -> E population connections vc_left_lip_ampa=init_connection(self.visual_cortex_input[0], self.left_lip.e_contra_vis, 'g_ampa_x', self.params.w_ampa_min, self.params.w_ampa_max, self.params.p_v_ec_vis, delay=270*ms) vc_right_lip_ampa=init_connection(self.visual_cortex_input[1], self.right_lip.e_contra_vis, 'g_ampa_x', self.params.w_ampa_min, self.params.w_ampa_max, self.params.p_v_ec_vis, delay=270*ms) self.connections.append(vc_left_lip_ampa) self.connections.append(vc_right_lip_ampa) if self.go_input is not None: go_left_lip_i_ampa=init_connection(self.go_input, self.left_lip.i_group, 'g_ampa_g', self.params.w_ampa_min, self.params.w_ampa_max, self.params.p_g_i, delay=5*ms) go_right_lip_i_ampa=init_connection(self.go_input, self.right_lip.i_group, 'g_ampa_g', self.params.w_ampa_min, self.params.w_ampa_max, self.params.p_g_i, delay=5*ms) go_left_lip_e_ampa=init_connection(self.go_input, self.left_lip.e_group, 'g_ampa_g', self.params.w_ampa_min, self.params.w_ampa_max, self.params.p_g_e, delay=5*ms) go_right_lip_e_ampa=init_connection(self.go_input, self.right_lip.e_group, 'g_ampa_g', self.params.w_ampa_min, self.params.w_ampa_max, self.params.p_g_e, delay=5*ms) self.connections.append(go_left_lip_i_ampa) self.connections.append(go_right_lip_i_ampa) self.connections.append(go_left_lip_e_ampa) self.connections.append(go_right_lip_e_ampa)
def __init__( self, params=default_params, pyr_params=pyr_params(), inh_params=inh_params(), plasticity_params=plasticity_params(), background_input=None, task_inputs=None, clock=defaultclock, ): self.params = params self.pyr_params = pyr_params self.inh_params = inh_params self.plasticity_params = plasticity_params self.background_input = background_input self.task_inputs = task_inputs ## Set up equations # Exponential integrate-and-fire neuron eqs = exp_IF(params.C, params.gL, params.EL, params.VT, params.DeltaT) eqs += Equations("g_muscimol : nS") # AMPA conductance - recurrent input current eqs += exp_synapse("g_ampa_r", params.tau_ampa, siemens) eqs += Current("I_ampa_r=g_ampa_r*(E-vm): amp", E=params.E_ampa) # AMPA conductance - background input current eqs += exp_synapse("g_ampa_b", params.tau_ampa, siemens) eqs += Current("I_ampa_b=g_ampa_b*(E-vm): amp", E=params.E_ampa) # AMPA conductance - task input current eqs += exp_synapse("g_ampa_x", params.tau_ampa, siemens) eqs += Current("I_ampa_x=g_ampa_x*(E-vm): amp", E=params.E_ampa) # Voltage-dependent NMDA conductance eqs += biexp_synapse("g_nmda", params.tau1_nmda, params.tau2_nmda, siemens) eqs += Equations("g_V = 1/(1+(Mg/3.57)*exp(-0.062 *vm/mV)) : 1 ", Mg=params.Mg) eqs += Current("I_nmda=g_V*g_nmda*(E-vm): amp", E=params.E_nmda) # GABA-A conductance eqs += exp_synapse("g_gaba_a", params.tau_gaba_a, siemens) eqs += Current("I_gaba_a=(g_gaba_a+g_muscimol)*(E-vm): amp", E=params.E_gaba_a) eqs += InjectedCurrent("I_dcs: amp") # Total synaptic conductance eqs += Equations("g_syn=g_ampa_r+g_ampa_x+g_ampa_b+g_V*g_nmda+g_gaba_a : siemens") eqs += Equations("g_syn_exc=g_ampa_r+g_ampa_x+g_ampa_b+g_V*g_nmda : siemens") # Total synaptic current eqs += Equations( "I_abs=(I_ampa_r**2)**.5+(I_ampa_b**2)**.5+(I_ampa_x**2)**.5+(I_nmda**2)**.5+(I_gaba_a**2)**.5 : amp" ) NeuronGroup.__init__( self, params.network_group_size, model=eqs, threshold=-20 * mV, refractory=1 * ms, reset=params.Vr, compile=True, freeze=True, clock=clock, ) self.init_subpopulations() self.init_connectivity(clock)