def main(inj_amp, outfile): # Simulation information. simtime = 0.1 simdt = 0.25e-5 plotdt = 0.25e-3 # Cell Compartment infromation diameter = 30e-6 length = 50e-6 Em = EREST_ACT + 10.613e-3 CM = 1e-6 * 1e4 RM = 1 / (0.3E-3 * 1e4) # Channel information. sa, x_sa = compute_comp_area(diameter, length) na_g = 120E-3 * sa * 1E4 na_ek = 115E-3 + EREST_ACT k_g = 36e-3 * sa * 1E4 k_ek = -12E-3 + EREST_ACT # Stimulus information inj_delay = 20E-3 inj_amp = float(inj_amp) inj_width = 40E-3 # Create cell soma = create_compartment('soma', length, diameter, RM, CM, initVM=EREST_ACT, ELEAK=Em) # Create channels K_chan = create_channel(chan_name='K', vdivs=VDIVS, vmin=VMIN, vmax=VMAX, x_params=K_n_params, xpow=4) Na_chan = create_channel(chan_name='Na', vdivs=VDIVS, vmin=VMIN, vmax=VMAX, x_params=Na_m_params, xpow=3, y_params=Na_h_params, ypow=1) # Set conductances nachan = moose.copy(Na_chan, soma.path, 'Na', 1) kchan = moose.copy(K_chan, soma.path, 'K', 1) nachan = set_channel_conductance(nachan, na_g, na_ek) kchan = set_channel_conductance(kchan, k_g, k_ek) # Add channels to soma moose.connect(nachan, 'channel', soma, 'channel', 'OneToOne') moose.connect(kchan, 'channel', soma, 'channel', 'OneToOne') # connect pulse gen pulse_inject = create_pulse_generator(soma, inj_width, inj_amp, delay=inj_delay) # Output table soma_v_table = create_output_table(table_element='/output', table_name='somaVm') soma_i_table = create_output_table(table_element='/output', table_name='somaIm') # Connect output tables moose.connect(soma_v_table, 'requestOut', soma, 'getVm') moose.connect(soma_i_table, 'requestOut', pulse_inject, 'getOutputValue') # Set moose simulation clocks for lable in range(7): moose.setClock(lable, simdt) moose.setClock(8, plotdt) # Run simulation moose.reinit() moose.start(simtime) #save np.save(outfile, soma_v_table.vector)
B_A=0.125e3, B_B=0.0, B_C=0.0, B_D=0.0 - EREST_ACT, B_F=80e-3) K1_n_params = AlphaBetaparams( A_A=1, A_B=0, A_C=1.0, A_D=-20E-3, A_F=-4e-3, B_A=1, B_B=0.0, B_C=1.0, B_D= -20E-3, B_F=4e-3) Na_chan = copy(channel_param_template) k_chan = copy(channel_param_template) k1_chan = copy(channel_param_template) Na_chan['chan_name']='Na' Na_chan['x_params']= Na_m_params Na_chan['y_params']= Na_h_params Na_chan['x_pow']= 3 Na_chan['y_pow']= 1 Na_chan['g_max']= 120E-3 *compute_comp_area(30e-6, 50e-6)[0] *1E4 #Na_chan['g_max']= 0 Na_chan['e_k']= 115E-3 + EREST_ACT k_chan['chan_name']= 'K' k_chan['x_params']= K_n_params k_chan['x_pow']= 4 k_chan['g_max']= 36e-3 *compute_comp_area(30e-6, 50e-6)[0] *1E4 #k_chan['g_max']= 0 k_chan['e_k']= -12E-3 + EREST_ACT k1_chan['chan_name']= 'K1' k1_chan['x_params']= K_n_params k1_chan['x_pow']= 4 k1_chan['g_max']= 0.05 *compute_comp_area(30e-6, 50e-6)[0] *1E4 #k1_chan['g_max']= 0
B_B=71E3, B_C=-1.0, B_D=-4E-3, B_F=5e-3) Na_chan = copy(channel_param_template) k_chan = copy(channel_param_template) SKca_chan = copy(channel_param_template) CaL_chan = copy(channel_param_template) Na_chan['chan_name'] = 'Na' Na_chan['x_params'] = Na_m_params Na_chan['y_params'] = Na_h_params Na_chan['x_pow'] = 3 Na_chan['y_pow'] = 1 Na_chan['g_max'] = 120E-3 * compute_comp_area(30e-6, 50e-6)[0] * 1E4 Na_chan['e_k'] = 115E-3 + EREST_ACT k_chan['chan_name'] = 'K' k_chan['x_params'] = K_n_params k_chan['x_pow'] = 4 k_chan['g_max'] = 36e-3 * compute_comp_area(30e-6, 50e-6)[0] * 1E4 k_chan['e_k'] = -12E-3 + EREST_ACT SKca_chan['chan_name'] = 'SKca' SKca_chan['z_params'] = sk_z_params SKca_chan['z_pow'] = 1 SKca_chan['g_max'] = 2E-6 * compute_comp_area(30e-6, 50e-6)[0] * 1E4 SKca_chan['g_max'] = 0 SKca_chan['e_k'] = -87E-3 SKca_chan['chan_type'] = 'ca_dependent'
def main(model_name, comp_passive, channel_settings, ca_params): # Simulation information. simtime = 1 simdt = 0.25e-5 plotdt = 0.25e-3 diameter = 20e-6 length = 20e-6 # Model creation soma, moose_paths = simple_model(model_name, comp_passive, channel_settings, ca_params, length, diameter) # chirp_test = chirp(gen_name="chirp",amp=1E-9, f0=0.1, f1=500, T=0.8, start=inj_delay, end=inj_width+inj_delay, simdt=simdt,amp_offset=5E-9) # moose.connect(chirp_test, 'valueOut', soma, 'injectMsg') # Output table tabs = creat_moose_tables() # moose.connect(soma_i_table, 'requestOut', chirp_test, 'getValue') # Set moose simulation clocks for lable in range(7): moose.setClock(lable, simdt) moose.setClock(8, plotdt) # Run simulation moose.reinit() moose.start(simtime) # Plot output tables. #v_plot = plot_vm_table(simtime,soma_v_table, soma_i_table, title="soma vs i") #plt.grid(True) #plt.legend(['v', 'i']) #plt.show() # set conductance for a list to Ca_v1, Ca_V2 and CC from collections import namedtuple cond = namedtuple('cond', 'k Ltype Ntype cl') test_conductances = [ cond(k=0.5E-3, Ltype=0.18E-3, Ntype=0.4E-3, cl=40E-3), # control test cond(k=0.5E-3, Ltype=0.18E-3, Ntype=0, cl=40E-3), # L-type frequecy reduce test cond(k=0.5E-3, Ltype=0, Ntype=0.4E-3, cl=40E-3), # N-type amplitude reduce test cond(k=0.5E-3, Ltype=0.18E-3, Ntype=0.4E-3, cl=0), # cl-type Current abolish test cond(k=0.5E-3 * 0.2, Ltype=0.18E-3, Ntype=0.4E-3, cl=40E-3) # K AHP reduce test ] for K, V1, V2, cc in test_conductances: moose.element('/soma/K').Gbar = K * compute_comp_area( length, diameter)[0] * 1E4 moose.element('/soma/Ca_V1').Gbar = V1 * compute_comp_area( length, diameter)[0] * 1E4 moose.element('/soma/Ca_V2').Gbar = V2 * compute_comp_area( length, diameter)[0] * 1E4 moose.element('/soma/ca_cc').Gbar = cc * compute_comp_area( length, diameter)[0] * 1E4 moose.reinit() moose.start(simtime) #plot_internal_currents(*tabs['internal_currents']) plot_vm_table( simtime, tabs['vm'][0], title= 'Conductances: ca_V1(L): {1}, Ca_V2 (N) :{0}, ca_cc :{2} K : {3}'. format(V1, V2, cc, K), xlab="Time in Seconds", ylab="Volage (V)") plt.show()
def main(experiment_title, ca_g_max, skca_g_max): # Simulation information. simtime = 0.1 simdt = 0.25e-6 plotdt = 0.25E-3 # Cell Compartment infromation diameter = 30e-6 length = 50e-6 Em = EREST_ACT + 10.613e-3 CM = 1e-6 * 1e4 RM = 1 / (0.3E-3 * 1e4) # Stimulus information inj_delay = 20E-3 inj_amp = 1E-9 inj_width = 40E-3 channel_settings['CaL']['g_max'] = ca_g_max * compute_comp_area( diameter, length)[0] * 1E4 channel_settings['SKca']['g_max'] = skca_g_max * compute_comp_area( diameter, length)[0] * 1E4 # Create cell soma = create_compartment('soma', length, diameter, RM, CM, initVM=EREST_ACT, ELEAK=Em) # Create channels channels_set = create_set_of_channels(channel_settings, VDIVS, VMIN, VMAX, CADIVS, CAMIN, CAMAX) moose_paths = [soma.path] for channel_name, channel_obj in channels_set.items(): copy_connect_channel_moose_paths(channel_obj, channel_name, moose_paths) # Create calcium pools in library. ca_pool = create_ca_conc_pool(ca_params) # copy calcium pools to all compartments. copy_ca_pools_moose_paths(ca_pool, 'CaPool', moose_paths) # Connect calciums pools to channels in compartments. connect_ca_pool_to_chan(chan_name='SKca', chan_type='ca_dependent', calname='CaPool', moose_paths=moose_paths) connect_ca_pool_to_chan(chan_name='CaL', chan_type='ca_permeable', calname='CaPool', moose_paths=moose_paths) # connect pulse gen. pulse_inject = create_pulse_generator(soma, inj_width, inj_amp, delay=inj_delay) # Output table. soma_v_table = create_output_table(table_element='/output', table_name='somaVm') soma_i_table = create_output_table(table_element='/output', table_name='somaIm') # Connect output tables. moose.connect(soma_v_table, 'requestOut', soma, 'getVm') moose.connect(soma_i_table, 'requestOut', pulse_inject, 'getOutputValue') # Set moose simulation clocks. for lable in range(10): moose.setClock(lable, simdt) moose.setClock(8, plotdt) # Run simulation moose.reinit() moose.start(simtime) # Plot output tables. v_plot = plot_vm_table(simtime, soma_v_table, soma_i_table, title=experiment_title.format(ca_g_max, skca_g_max), xlab='Time', ylab='voltage') plt.grid(True) plt.legend(['v', 'i']) plt.show()