def main(): # 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) RA = 4 # Stimulus information inj_delay = 20E-3 inj_amp = 1E-9 inj_width = 40E-3 # Create cell chicken_model = create_swc_model( root_name='E19', file_name='E19-cell_filling-caudal.CNG.swc', RM=RM, CM=CM, RA=RA, ELEAK=Em, initVM=Em) soma = moose.element('/E19[0]/soma') # Create channels channels_set = create_set_of_channels(channel_settings, VDIVS, VMIN, VMAX) # Fetch all compartment paths. moose_paths = [] for comp in moose.wildcardFind(chicken_model.path + '/#[TYPE=Compartment]'): moose_paths.append(comp.path) # Copy all channels to compartments. for channel_name, channel_obj in channels_set.items(): copy_connect_channel_moose_paths(channel_obj, channel_name, 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') chicken_dend_table = create_output_table(table_element='/output', table_name='chkdend') # Connect output tables moose.connect(soma_v_table, 'requestOut', soma, 'getVm') moose.connect(soma_i_table, 'requestOut', pulse_inject, 'getOutputValue') moose.connect(chicken_dend_table, 'requestOut', moose.element('/E19[0]/dend_36_0'), 'getVm') # 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, chicken_dend_table, title="soma vs dend new k1 chan g_bar = 0.05") v_plot.legend(['soma_v', 'i', 'dend_v']) plt.grid(True) plt.show()
def main(): # 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 = 1E-9 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) # Plot output tables. v_plot = plot_vm_table(simtime, "soma voltage", soma_v_table, soma_i_table) plt.grid(True) plt.legend(['v', 'i']) plt.show()
def main(experiment_title): # 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 # 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) plt.grid(True) plt.legend(['v', 'i']) plt.show()
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(): # 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) # Stimulus information inj_delay = 20E-3 inj_amp = 1E-9 inj_width = 40E-3 # 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) moose_paths = [soma.path] for channel_name, channel_obj in channels_set.items(): copy_connect_channel_moose_paths(channel_obj, channel_name, 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(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 voltage") plt.grid(True) plt.legend(['v', 'i']) plt.show()
def main(experiment_title, _rate, syn_g_max): # Simulation information. simtime = 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) RA = 4 dend_n = 5 # Create two compartmental model. soma = create_compartment('soma', length, diameter, RM, CM, initVM=EREST_ACT, ELEAK=Em) # Soma creation bunch = create_n_dends('dend_', dend_n, length, diameter, RM, CM, RA) # Dend creation for item in bunch.values(): item.Em = Em item.initVm = EREST_ACT bunch = connect_n_serial(bunch) moose.connect(soma, 'axial', list(bunch.values())[0], 'raxial') # Create channels channels_set = create_set_of_channels(channel_settings, VDIVS, VMIN, VMAX, CADIVS, CAMIN, CAMAX) # Create synaptic channel synapses_and_handles = [ create_synaptic_channel(setting.syn_name, syn_g_max, setting.tau1, setting.tau2, setting.ek, setting.synapse_count, setting.delay) for setting in synapse_settings ] # Copy the synaptic channels to moose compartments. moose_paths = [moose.element('/dend_2').path] for syn, syn_handle in synapses_and_handles: copy_syn_channel_moose_paths(syn, syn.name, moose_paths) # create pre-synaptic input spikegen_1 = create_spikegen(name='spikegen_1', type='random', refractory_period=1E-3, rate=_rate) moose.connect(spikegen_1, 'spikeOut', moose.element('/dend_2[0]/syn[0]/synhandler').synapse[0], 'addSpike') # connect channels to compartments. for channel_name, channel_obj in channels_set.items( ): # Copy channels to soma. copy_connect_channel_moose_paths(channel_obj, channel_name, moose_paths) # Output table. soma_v_table = create_output_table(table_element='/output', table_name='somaVm') dend1_v_table = create_output_table(table_element='/output', table_name='dend1Vm') # Connect output tables. moose.connect(soma_v_table, 'requestOut', soma, 'getVm') moose.connect(dend1_v_table, 'requestOut', moose.element('/dend_2'), 'getVm') # 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, dend1_v_table, title=experiment_title.format(_rate, syn_g_max), xlab='Time', ylab='voltage') plt.grid(True) plt.legend(['soma', 'dend']) plt.show()