Em = -65e-3 pulse_dur = 100e-3 pulse_amp = 0.1e-9 pulse_delay1 = 50e-3 pulse_delay2 = 1e9 # Create a neutral directory for the neuron neuron = moose.Neutral('/neuron') # Create the soma and connect a pulse to it l = u.createCompartment(neuron,'swagginWagon',soma_l,soma_rad,RM,CM,RA,Em) n = u.createPulse(l,'rollingWave',pulse_dur,pulse_amp,pulse_delay1,pulse_delay2) # Create a neutral directory for the data and create data tables for the soma data = moose.Neutral('/data') m = u.createDataTables(l,data) # Set the clock so that all components of the simulation run appropriately moose.setClock(4, simDt) # Run the experiment moose.reinit() moose.start(simTime) # Compute delta VM at the steady state delta_Vm = l.Rm*n.level[0]*(1-np.exp(-0.3/(l.Rm*l.Cm))) print delta_Vm # Compute actual delta Vm at the steady state actual_delta_Vm = (np.max(m.vector) - np.min(m.vector))
neuron = moose.Neutral('/neuron') squid = u.createCompartment(neuron, 'HHsquidswag', squid_l, squid_rad, RM, CM, RA, initVm, Em) # Set the axial resistance to match the one in the ionchannel.py file # and set the container to be used for channel creation squid.Ra = 1 container = squid.parent.path # Create the external current to be applied to the compartment squid_pulse = u.createPulse(squid, 'rollingWave', pulse_dur, pulse_amp, pulse_delay1, pulse_delay2) # Create the data tables necessary to run the model data = moose.Neutral('/data') squid_Vm, squid_current = u.createDataTables(squid, data, squid_pulse) # Create the channels necessary for the giant squid axon and place them in a library u.createChanLib(libraryName, chan_set, rateParams, CaParams) # Create copies of the prototype channels and connect them to the # compartment, along with their conductances u.addChannelSet(cond_set, libraryName, neuron, compType) u.add_calcium(libraryName, neuron, Ca_pool_params, compType) for key in chan_set.keys(): if ("Ca" in key): u.connect_cal2chan(chan_set[key].name, chan_set[key].chan_type, neuron, Ca_pool_params.caName, compType) # Plot the simulation simtime = 0.1
slm = moose.element(cell_path + '/' + comp) sh = u.addSynChan(slm, AMPA) synapseHandler.append(sh) # Connect the presynaptic neuron to each synapse for i in dict.values(): shnum = i[ 'syn_num'] - 1 # get the correct index to be used for the synapseHandler presyncell = u.createRandSpike(i, synapseHandler[shnum]) # Create a neutral object to store the data in CA1_data = moose.Neutral('/CA1_data') CA1_tables = [] for comp in CA1_cell: CA1_tables.append( u.createDataTables(compname=comp, data_hierarchy=CA1_data)) # Create a variable to store the voltage table generated for the central somatic compartment # to be used in the plot CA1_soma_Vm = CA1_tables[0][0] # Get all the distances and names associated with the primary apical dendritic tree prim_ap_names = list(chain( *prim_ap_name_list)) # unordered list of prim apical dendrite compartments prim_ap_names_index = [ j for j, n in enumerate(distList2[0]) if n in prim_ap_names ] prim_ap_dist_list = [distList[x] for x in prim_ap_names_index] prim_ap_names = [nameList[x] for x in prim_ap_names_index ] # ordered list of prim apical dend compartments
u.setCompParameters(sd_cell, 'Compartment', RM, CM, RA, Em) # Re-define the cell variables so that they just include compartments # (i.e. exclude spines) sd_cell = moose.wildcardFind('/cell1/#[TYPE=Compartment]') # Create data hierarchies for the two different cells sd_data = moose.Neutral('/gran_data') sd_soma_pulse = u.createPulse(sd_cell[0], 'rollingWave', pulse_dur, pulse_amp, pulse_delay1, pulse_delay2) # Create data tables for the membrane potential for each compartment sd_tables = [] for comp in sd_cell: sd_tables.append(u.createDataTables(comp, sd_data)) # Choose the soma and a representative dendrite to view how voltage changes # for the granule cell sd_soma0_Vm = sd_tables[0] # Run the experiment and plot the results for both neurons moose.setClock(4, simDt) moose.reinit() moose.start(simTime) f2 = plt.figure(2) t = plt.linspace(0, simTime, len(sd_soma0_Vm.vector)) plt.plot(t, sd_soma0_Vm.vector, 'r', label='sd_soma_Vm') plt.legend() f2.show()
pc.plot_gate_params(libchan, plot_powers, VMIN, VMAX, CAMIN, CAMAX) # Re-create the python variable pointing to the MS cell to limit results just to # type compartment (excludes the spines and allows for createDataTables function to # work properly) MS_cell = moose.wildcardFind('/library/MScell/#[TYPE=SymCompartment]') # Create the pulse and apply it to the MS cell's soma MS_soma_pulse = u.createPulse(MS_cell[0], 'rollingWave', pulse_dur, pulse_amp, pulse_delay1, pulse_delay2) # Create a neutral object to store the data in MS_data = moose.Neutral('/MS_data') MS_tables = [] for comp in MS_cell: MS_tables.append(u.createDataTables(comp, MS_data, MS_soma_pulse)) # Create a variable for the table recording the voltage for the MS cell's soma MS_soma_Vm = MS_tables[0][0] # Define variables needed for running the simulation, and set the clocks for all the channels, compartments, # and tables recording voltage and current during the simulation simTime = 400e-3 simdt = 10e-6 plotdt = 0.2e-3 for i in range(10): moose.setClock(i, simdt) moose.setClock(8, plotdt) # Run the experiment using the hsolve method and plot the voltage for the MS cell soma
for comp in list(chain(*thin_LM_name_list)): comp = moose.element(cell_path + '/' + comp) u.scaleCompRmCm(comp = comp, scaling_factor = ssl.scale_factors['thin_LM_spine_scale']) for chan in cond_set_test: chan = moose.element(comp.path + '/' + chan) u.scaleChannelCond(chan = chan, scaling_factor = ssl.scale_factors['thin_LM_spine_scale']) # Create the pulse and apply it to the CA1 cell's central somatic compartment CA1_soma_pulse = u.createPulse(CA1_cell[0], 'rollingWave', pulse_dur, pulse_amp, pulse_delay1, pulse_delay2) # Create a neutral object to store the data in CA1_data = moose.Neutral('/CA1_data') CA1_tables = [] for comp in CA1_cell: CA1_tables.append(u.createDataTables(comp,CA1_data,CA1_soma_pulse)) # Create a variable to store the voltage table generated for the central somatic compartment # to be used in the plot CA1_soma_Vm = CA1_tables[0][0] # Get all the distances and names associated with the primary apical dendritic tree prim_ap_names = list(chain(*prim_ap_name_list)) prim_ap_names_index = [j for j, n in enumerate(distList2[0]) if n in prim_ap_names] prim_ap_dist_list = [distList[x] for x in prim_ap_names_index] prim_ap_names = [nameList[x] for x in prim_ap_names_index] # ordered list of prim apical dend compartments # Choose 3 of the compartments along the primary apical dendrite to monitor voltage attenuation. Selective # dendrites were chosen at roughly 100 um, 225 um, and 350 um (furthest compartment on primary apical dend) primApicalPlotListName = [prim_ap_names[67], prim_ap_names[133], prim_ap_names[215]] indexforprimApicalPlots = [x for x, n in enumerate(distList2[0]) if n in primApicalPlotListName]
moose.showfield('/gran_cell/soma') # Re-create the python variable pointing to the gran_cell to limit results just to # type compartment (excludes the spines and allows for createDataTables function to # work properly) gran_cell = moose.wildcardFind('/gran_cell/#[TYPE=Compartment]') # Create the pulse and apply it to the granule cell's soma g_soma_pulse = u.createPulse(gran_cell[0], 'rollingWave', pulse_dur, pulse_amp, pulse_delay1, pulse_delay2) # Create a neutral object to store the data in gran_data = moose.Neutral('/gran_data') gran_tables = [] for comp in gran_cell: gran_tables.append(u.createDataTables(comp, gran_data, g_soma_pulse)) # Choose the soma and a representative dendrite to view how voltage changes # for the granule cell g_soma0_Vm = gran_tables[0][0] g_soma0_Iex = gran_tables[0][1] g_dend_5_00_Vm = gran_tables[-11][0] g_dend_5_00_Iex = gran_tables[-11][1] # Plot the simulation simTime = 0.5 simdt = 0.25e-5 plotdt = 0.25e-3 for i in range(10): moose.setClock(i, simdt)
CaPoolParams=Ca_pool_params) # Re-create the python variable pointing to the gran_cell to limit results just to # type compartment (excludes the spines and allows for createDataTables function to # work properly) l2_cell = moose.wildcardFind(l2_cell.path + '/' + '#[TYPE=' + compType + ']') # Create the pulse and apply it to the granule cell's soma l2_soma_pulse = u.createPulse(l2_cell[0], 'rollingWave', pulse_dur, pulse_amp, pulse_delay1, pulse_delay2) # Create a neutral object to store the data in l2_data = moose.Neutral('/l2_data') l2_tables = [] for comp in l2_cell: l2_tables.append(u.createDataTables(comp, l2_data, l2_soma_pulse)) # Choose the soma and a representative dendrite to view how voltage changes # for the granule cell l2_soma_Vm = l2_tables[0][0] l2_soma_Iex = l2_tables[0][1] l2_ap2_Vm = l2_tables[2][0] l2_ap2_Iex = l2_tables[2][1] # Plot the simulation simTime = 0.5 simdt = 0.25e-5 plotdt = 0.25e-3 for i in range(10): moose.setClock(i, simdt)
# Re-create the python variable pointing to the MS cell to limit results just to # type compartment (excludes the spines and allows for createDataTables function to # work properly) MS_cell = moose.wildcardFind('/library/MScell/#[TYPE=SymCompartment]') # Create the pulse and apply it to the MS cell's soma MS_soma_pulse = u.createPulse(MS_cell[0], 'rollingWave', pulse_dur, pulse_amp, pulse_delay1, pulse_delay2) # Create a neutral object to store the data in MS_data = moose.Neutral('/MS_data') MS_tables = [] for comp in MS_cell: MS_tables.append(u.createDataTables(comp,MS_data,MS_soma_pulse)) # Create a variable for the table recording the voltage for the MS cell's soma MS_soma_Vm = MS_tables[0][0] # Define variables needed for running the simulation, and set the clocks for all the channels, compartments, # and tables recording voltage and current during the simulation simTime = 400e-3 simdt = 10e-6 plotdt = 0.2e-3 for i in range(10): moose.setClock(i, simdt) moose.setClock(8, plotdt) # Run the experiment using the hsolve method and plot the voltage for the MS cell soma
synapseHandler = [] for comp in randsynList: slm = moose.element(cell_path + '/' + comp) sh = u.addSynChan(slm, AMPA) synapseHandler.append(sh) # Connect the presynaptic neuron to each synapse for i in dict.values(): shnum = i['syn_num'] - 1 # get the correct index to be used for the synapseHandler presyncell = u.createRandSpike(i, synapseHandler[shnum]) # Create a neutral object to store the data in CA1_data = moose.Neutral('/CA1_data') CA1_tables = [] for comp in CA1_cell: CA1_tables.append(u.createDataTables(compname = comp, data_hierarchy = CA1_data)) # Create a variable to store the voltage table generated for the central somatic compartment # to be used in the plot CA1_soma_Vm = CA1_tables[0][0] # Get all the distances and names associated with the primary apical dendritic tree prim_ap_names = list(chain(*prim_ap_name_list)) # unordered list of prim apical dendrite compartments prim_ap_names_index = [j for j, n in enumerate(distList2[0]) if n in prim_ap_names] prim_ap_dist_list = [distList[x] for x in prim_ap_names_index] prim_ap_names = [nameList[x] for x in prim_ap_names_index] # ordered list of prim apical dend compartments # Choose 3 of the compartments along the primary apical dendrite to monitor voltage attenuation. Selective # dendrites were chosen at roughly 100 um, 235 um, and 370 um (furthest compartment on primary apical dend) primApicalPlotListName = [prim_ap_names[67], prim_ap_names[123], prim_ap_names[199]] indexforprimApicalPlots = [x for x, n in enumerate(distList2[0]) if n in primApicalPlotListName]
Em) # Create the dendritic compartments under the neuron directory dend_branch = u.discretize(neuron, numDends, dend_l, dend_rad, RM, CM, RA, Em) # Connect the soma to the first element of the dendritic branch moose.connect(soma, 'axialOut', dend_branch[0], 'handleAxial') # Create a pulse and connect it to the soma soma_pulse = u.createPulse(soma, 'rollingWave', pulse_dur, pulse_amp, pulse_delay) # Create data tables to store the voltage for the soma and each compartment # making up the dendritic branch data = moose.Neutral('/data') soma_Vm = u.createDataTables(soma, data) dend_tables = [] for dend in dend_branch: dend_tables.append(u.createDataTables(dend, data)) # Store the location of the middle dendrite so that it can be accessed # for plotting purposes mid_dend = len(dend_branch) // 2 # Run the experiment and plot the results moose.setClock(4, simDt) moose.reinit() moose.start(simTime) t = plt.linspace(0, simTime, len(soma_Vm.vector)) plt.plot(t, soma_Vm.vector, 'r', label='Vm_soma') plt.plot(t, dend_tables[mid_dend].vector, 'b', label='Vm_mid_dend')
presyn2 = {'name': 'presyn2', 'rate': 0, 'refractT': 1e-3, 'delay': 5e-3} # Create HH Na and K channels with their corresponding conductances, and place them in a library # so that they can be implemented into the compartments (if so desired) cond_set = {'Na': 120e-3 * 1e4, 'K': 36e-3 * 1e4} libraryName = '/library' compType = 'Compartment' u.createChanLib(libraryName, chan_set, rateParams, CaParams=None) # Create copies of the prototype channels and connect them to each compartment under the neuron hierarchy u.addChannelSet(cond_set, libraryName, neuron, compType) # Create data tables to store the voltage for the soma and dendrite, and ignore current output # since there is no pulse being provided to the soma data = moose.Neutral('/data') soma_Vm, _ = u.createDataTables(compname=soma, data_hierarchy=data) dend_Vm, _ = u.createDataTables(compname=dend, data_hierarchy=data) # Create the excitatory synchan and return the handler to be used in the creation of the RandSpike glu_handler = u.addSynChan(dend, glu) presyn1 = u.createRandSpike(presyn1, glu_handler) # Create the inhibitory synchan and return the handler to be used in the creation of the RandSpike GABA_handler = u.addSynChan(dend, GABA) presyn2 = u.createRandSpike(presyn2, GABA_handler) # Create tables to store the output time of the RandSpikes spike_table = moose.Table('st') moose.connect(presyn1, 'spikeOut', spike_table, 'spike') spike_table2 = moose.Table('st2') moose.connect(presyn2, 'spikeOut', spike_table2, 'spike')
# Create data hierarchies for the two different cells l2_data = moose.Neutral('/l2_data') gran_data = moose.Neutral('/gran_data') # Create pulses and connect them to each neuron's soma l2_soma_pulse = u.createPulse(l2_cell[0], 'rollingWave', pulse_dur, pulse_amp, pulse_delay1, pulse_delay2) g_soma_pulse = u.createPulse(gran_cell[0], 'rollingWave', pulse_dur, pulse_amp, pulse_delay1, pulse_delay2) # Create data tables for the membrane potential for each compartment l2_tables = [] gran_tables = [] for comp in l2_cell: l2_tables.append(u.createDataTables(comp,l2_data)) for comp in gran_cell: gran_tables.append(u.createDataTables(comp,gran_data)) # Choose the soma and a representative dendrite to view how voltage changes # for the layer 2 cell l2_soma_Vm = l2_tables[0] l2_ap2_Vm = l2_tables[2] # Choose the soma and a representative dendrite to view how voltage changes # for the granule cell g_soma0_Vm = gran_tables[0] g_dend_5_00_Vm = gran_tables[-11] # Run the experiment and plot the results for both neurons moose.setClock(4,simDt)
soma = u.createCompartment(neuron, 'swagginSoma', soma_l, soma_rad, RM, CM, RA, Em) dend = u.createCompartment(neuron, 'swagginDend', dend_l, dend_rad, RM, CM, RA, Em) # Create the pulse soma_pulse = u.createPulse(soma, 'rollingWave', pulse_dur, pulse_amp, pulse_delay) # Connect the soma to the dendrite moose.connect(soma, 'axialOut', dend, 'handleAxial') # Create a neutral directory for the data and create data tables for the soma # and the dendrite data = moose.Neutral('/data') soma_Vm = u.createDataTables(soma, data) dend_Vm = u.createDataTables(dend, data) # Set the clock so that all components of the simulation run appropriately moose.setClock(4, simDt) # Run the experiment moose.reinit() moose.start(simTime) # Plot the voltages for both the soma and dendrite t = plt.linspace(0, simTime, len(soma_Vm.vector)) plt.plot(t, soma_Vm.vector, 'r', label='Vm_soma') plt.plot(t, dend_Vm.vector, 'b', label='Vm_dend') plt.legend() plt.show()
pulse_dur = 100e-3 pulse_amp = 0.1e-9 pulse_delay = 50e-3 pulse_delay2 = 1e9 soma = u.createCompartment(neuron, 'swagginSoma', soma_l, soma_rad, RM, CM, RA, Em, Em) dend = u.createCompartment(neuron, 'swagginDend', dend_l, dend_rad, RM, CM, RA, Em, Em) moose.connect(soma, 'axialOut', dend, 'handleAxial') # Create data tables to store the voltage for the soma and each compartment # making up the dendritic branch data = moose.Neutral('/data') soma_pulse = u.createPulse(soma, 'rollingWave', pulse_dur, pulse_amp, pulse_delay, pulse_delay2) soma_Vm, soma_Iex = u.createDataTables(soma, data, soma_pulse) dend_Vm, dend_Iex = u.createDataTables(dend, data, soma_pulse) synchan = moose.SynChan('/neuron/swagginDend/glu') synchan.Gbar = 1e-8 synchan.tau1 = 2e-3 synchan.tau2 = 2e-3 synchan.Ek = -0.010 msg = moose.connect(dend, 'channel', synchan, 'channel') sh = moose.SimpleSynHandler('/neuron/swagginDend/glu/synhandler') moose.connect(sh, 'activationOut', synchan, 'activation') sh.synapse.num = 1 sh.synapse[0].delay = 1e-3 moose.showmsg(sh) moose.showmsg(synchan) moose.showfield(sh.synapse[0])