Veq = -65. # mV tmax = 300. # ms dt = .1 # ms K = 4 ## initialization ##################################################################### ## Step 0: initialize the morphology # Specify the path to an '.swc' file. morphfile = 'morphologies/ball_and_stick_taper.swc' # Define the ion channel distributions for dendrites and soma. Here the neuron model is # passive. d_distr = {'L': {'type': 'fit', 'param': [Veq, 50.], 'E': Veq, 'calctype': 'pas'}} s_distr = {'L': {'type': 'fit', 'param': [Veq, 50.], 'E': Veq, 'calctype': 'pas'}} # initialize a greensTree. Here, all the quantities are stored to compute the GF in the # frequency domain (algorithm of Koch and Poggio, 1985). greenstree = morphR.greensTree(morphfile, soma_distr=s_distr, ionc_distr=d_distr, cnodesdistr='all') # initialize a greensFunctionCalculator using the previously created greensTree. This class # stores all variables necessary to compute the GF in a format fit for simulation, either # the plain time domain or with the partial fraction decomposition. gfcalc = morphR.greensFunctionCalculator(greenstree) gfcalc.set_impedances_logscale(fmax=7, base=10, num=200) # Now a list of input locations needs to be defined. For the sparse reformulation, the # first location needs to be the soma inlocs = [ {'node': 1, 'x': .5, 'ID': 0}, {'node': 4, 'x': .5, 'ID': 1}, {'node': 5, 'x': .5, 'ID': 2}, {'node': 6, 'x': .5, 'ID': 3}, {'node': 7, 'x': .5, 'ID': 4}, {'node': 8, 'x': .5, 'ID': 5}, {'node': 9, 'x': .5, 'ID': 6}] ## Steps 1,2,3 and 4: # find sets of nearest neighbours, computes the necessary GF kernels, then computes the # sparse kernels and then fits the partial fraction decomposition using the VF algorithm. alphas, gammas, pairs, Ms = gfcalc.kernelSet_sparse(inlocs, FFT=False, kernelconstants=True) ## Step 4 bis: compute the vectors that will be used in the simulation
'E': Veq, 'calctype': 'pas' } } s_distr = { 'L': { 'type': 'fit', 'param': [Veq, 50.], 'E': Veq, 'calctype': 'pas' } } # initialize a greensTree. Here, all the quantities are stored to compute the GF in the # frequency domain (algorithm of Koch and Poggio, 1985). greenstree = morphR.greensTree(morphfile, soma_distr=s_distr, ionc_distr=d_distr, cnodesdistr='all') # initialize a greensFunctionCalculator using the previously created greensTree. This class # stores all variables necessary to compute the GF in a format fit for simulation, either # the plain time domain or with the partial fraction decomposition. gfcalc = morphR.greensFunctionCalculator(greenstree) gfcalc.set_impedances_logscale(fmax=7, base=10, num=200) # Now a list of input locations needs to be defined. For the sparse reformulation, the # first location needs to be the soma inlocs = [{ 'node': 1, 'x': .5, 'ID': 0 }, { 'node': 4, 'x': .5,
## membrane params ##################################################### # real default channel distribution distr_sim = {'L': {'type': 'fit', 'calctype': 'pas', 'param': [-65., 20.], 'E': -65.} } # real soma channel distribution s_distr_sim = {'L': {'type': 'fit', 'calctype': 'pas', 'param': [-65., 20.], 'E': -65.}, 'Kv3_1': {'type': 'flat', 'calctype': 'pas', 'param': [0.766*1e6], 'E': -80.}, 'Na_Ta': {'type': 'flat', 'calctype': 'pas', 'param': [1.71 *1e6], 'E': 50.} } ######################################################################## ## initialization ###################################################### morphfile = 'morphologies/stellate_v2.swc'#ball_and_stick_taper.swc'#ball_and_stick_taper.swc'#N19ttwt.CNG.swc'#3y_tree.swc'#neocortical_pyramidv2.swc'# # greenstree greenstree_sim = morphR.greensTree(morphfile, soma_distr=s_distr_sim, ionc_distr=distr_sim, pprint=False) # greens tree # greenstree_calc = morphR.greensTree(morphfile, soma_distr=s_distr_calc, ionc_distr=distr_calc, pprint=False) greenstree_calc = copy.deepcopy(greenstree_sim) snode = greenstree_calc.tree.get_node_with_index(1) print 'number of dendrites: ', len(snode.get_child_nodes()[2:]) gs_soma = snode.get_content()['physiology'].gs print gs_soma print snode.get_content()['physiology'].es for key in gs_soma.keys(): gs_soma[key] = 0. gfcalc = morphR.greensFunctionCalculator(greenstree_calc) gfcalc.set_impedances_logscale(fmax=7, base=10, num=200) inlocs = greenstree_calc.distribute_inlocs(num=50, distrtype='random', radius=0.0070) # inlocs = [{'node': 1, 'x': 0.5, 'ID': 0}, {'node': 18, 'x': 0.6, 'ID': 1}] # (inlocs, inlocs_2) = greenstree_calc.distribute_inlocs(num=15, distrtype='fromleaf', radius=0.0120, split_radius=0.0050)