def addSynapses(self):
        self.pre_list = []

        # E0
        syn_ = h.Exp2Syn(self.dend2(0.5))
        self.pre_list.append(syn_)  # AMPA        Pyramidal
        syn_.tau1 = 0.5
        syn_.tau2 = 3
        syn_.e = 0

        # E1
        syn_ = h.Exp2Syn(self.dend1(0.5))
        self.pre_list.append(syn_)  # AMPA        Pyramidal
        syn_.tau1 = 0.5
        syn_.tau2 = 3
        syn_.e = 0

        # I2
        syn_ = h.Exp2Syn(self.dend1(0.5))
        self.pre_list.append(syn_)  # AMPA        EC
        syn_.tau1 = 1
        syn_.tau2 = 8
        syn_.e = -75

        # I3
        syn_ = h.Exp2Syn(self.dend1(0.5))
        self.pre_list.append(syn_)  # AMPA        EC
        syn_.tau1 = 35
        syn_.tau2 = 100
        syn_.e = -75
Exemple #2
0
 def addSegmentSynapse(self, layerDict, dist2sec, distKeys, synList,
                       synType):
     for layer in layerDict:
         for dist in distKeys:
             sec_choice = dist2sec[dist]
             for seg_choice in layerDict[layer][sec_choice]:
                 nmda_flag = 0
                 if self.synvars['type'] == "E2-NMDA2":
                     syn = h.Exp2Syn(sec_choice(seg_choice))
                     nmda = h.Exp2NMDA_Wang(sec_choice(seg_choice))
                     nmda_flag = 1
                 if self.synvars['type'] == "Log_E2Syn":
                     syn = h.Log_E2Syn(sec_choice(seg_choice))
                 if self.synvars['type'] == "Add_E2Syn":
                     syn = h.Add_E2Syn(sec_choice(seg_choice))
                 if self.synvars['type'] == "Mult_E2Syn":
                     syn = h.Mult_E2Syn(sec_choice(seg_choice))
                 if self.synvars['type'] == "E2":
                     syn = h.Exp2Syn(sec_choice(seg_choice))
                 if self.synvars['type'] == "E2_Prob":
                     syn = h.E2_Prob(sec_choice(seg_choice))
                     syn.P = self.synvars['P']
                 if self.synvars['type'] == "E2_STP_Prob":
                     syn = h.E2_STP_Prob(sec_choice(seg_choice))
                 if self.synvars['type'] == "STDPE2":
                     syn = h.STDPE2(sec_choice(seg_choice))
                 if self.synvars['type'] == "STDPE2_Clo":
                     syn = h.STDPE2_Clo(sec_choice(seg_choice))
                 if self.synvars['type'] == "STDPE2_STP":
                     syn = h.STDPE2_STP(sec_choice(seg_choice))
                 if self.synvars['type'] == "STDPE2_Prob":
                     syn = h.STDPE2_Prob(sec_choice(seg_choice))
                     syn.P = self.synvars['P']
                 #initializes different variables depending on synapse
                 if (self.synvars['type'] == "STDPE2_STP") | (
                         self.synvars['type'] == "E2_STP_Prob"):
                     syn.F1 = self.synvars['F1']
                 if (self.synvars['type'] == "STDPE2_Clo") | (
                         self.synvars['type'] == "STDPE2_STP") | (
                             self.synvars['type'] == "STDPE2") | (
                                 self.synvars['type'] == "STDPE2_Prob"):
                     syn.wmax = self.synvars['wmax']
                     syn.wmin = self.synvars['wmin']
                     syn.thresh = self.synvars['thresh']
                 if (self.synvars['type'] == "E2_Prob") | (
                         self.synvars['type'] == "E2_STP_Prob") | (
                             self.synvars['type'] == "STDPE2_STP") | (
                                 self.synvars['type'] == "STDPE2_Prob"):
                     h.use_mcell_ran4(1)
                     syn.seed = self.ranGen.randint(1, 4.295e9)
                 syn.tau1 = 0.5
                 syn.tau2 = 0.6
                 syn.e = 0
                 if nmda_flag == 1:
                     if synType == 'NMDA':
                         synList[layer].append(nmda)
                     else:
                         synList[layer].append(syn)
                 else:
                     synList[layer].append(syn)
Exemple #3
0
    def initialize(self, sim):
        #####  Make sure to save spikes vector and vector stim object
        # Attach a NetCon/synapse on the high-level neuron(s) soma. We can use the NetCon.event(time) method to send
        # a spike to the synapse. Which, is a spike occurs, the high-level neuron will inhibit the low-level neuron.
        self._spikes = h.Vector()  # start off with empty input
        vec_stim = h.VecStim()
        vec_stim.play(self._spikes)
        self._vect_stim = vec_stim

        self._high_level_neurons = list(
            sim.net.get_node_set('high_level_neurons').gids())
        self._pag_neurons = list(sim.net.get_node_set('pag_neurons').gids())

        io.log_info('Found {} high level neurons'.format(
            len(self._high_level_neurons)))
        for gid in self._high_level_neurons:
            cell = sim.net.get_cell_gid(gid)
            self._spike_events[gid] = np.array([])

            # Create synapse
            # These values will determine how the high-level neuron behaves with the input
            syn = h.Exp2Syn(0.5, cell.hobj.soma[0])
            syn.e = 0.0
            syn.tau1 = 0.1
            syn.tau2 = 0.3
            self._synapses[gid] = syn

            nc = h.NetCon(self._vect_stim, syn)
            nc.threshold = sim.net.spike_threshold
            nc.weight[0] = 0.2
            nc.delay = 1.0
            self._netcons[gid] = nc

        io.log_info('Found {} PAG neurons'.format(len(self._pag_neurons)))
        for gid in self._pag_neurons:
            trg_cell = sim.net.get_cell_gid(
                gid)  # network._rank_node_ids['LUT'][51]
            self._spike_events[gid] = np.array([])

            syn = h.Exp2Syn(0.5, sec=trg_cell.hobj.soma[0])
            syn.e = 0.0
            syn.tau1 = 0.1
            syn.tau2 = 0.3
            self._synapses[gid] = syn

            nc = h.NetCon(self._vect_stim, syn)
            nc.threshold = sim.net.spike_threshold
            nc.weight[0] = 0.2
            nc.delay = 1.0
            self._netcons[gid] = nc

        # Attach another netcon to the low-level neuron(s) that will record
        self._low_level_neurons = list(
            sim.net.get_node_set('low_level_neurons').gids())
        io.log_info('Found {} low level neurons'.format(
            len(self._low_level_neurons)))

        self._set_spike_detector(sim)
        pc.barrier()
Exemple #4
0
    def initialize(self, sim):
        network = sim.net

        #####  Make sure to save spikes vector and vector stim object
        # Attach a NetCon/synapse on the high-level neuron(s) soma. We can use the NetCon.event(time) method to send
        # a spike to the synapse. Which, is a spike occurs, the high-level neuron will inhibit the low-level neuron.
        self._spikes = h.Vector(np.array([]))  # start off with empty input
        vec_stim = h.VecStim()
        vec_stim.play(self._spikes)
        self._vect_stim = vec_stim

        self._high_level_neurons = list(sim.net.get_node_set('high_level_neurons').gids())
        self._pag_neurons = list(sim.net.get_node_set('pag_neurons').gids())
        # self._pag_neurons = [i for i in np.arange(50,75)]

        for gid in self._high_level_neurons:
            cell = sim.net.get_cell_gid(gid)

            # Create synapse
            # These values will determine how the high-level neuron behaves with the input
            new_syn = h.Exp2Syn(0.5, cell.hobj.soma[0])
            new_syn.e = 0.0
            new_syn.tau1 = 0.1
            new_syn.tau2 = 0.3

            nc = h.NetCon(self._vect_stim, new_syn)
            ##nc = h.NetCon(vec_stim, new_syn)
            nc.weight[0] = 0.5
            nc.delay = 1.0

            self._synapses[gid] = new_syn
            self._netcons[gid] = nc

        io.log_info('Found {} PAG neurons'.format(len(self._pag_neurons)))
        for gid in self._pag_neurons:
            trg_cell = network.get_cell_gid(gid)  # network._rank_node_ids['LUT'][51]
            syn = h.Exp2Syn(0.5, sec=trg_cell.hobj.soma[0])
            syn.e = 0.0
            syn.tau1 = 0.1
            syn.tau2 = 0.3
            self._synapses[gid] = syn

            nc = h.NetCon(self._vect_stim, syn)
            nc.weight[0] = 0.5
            nc.delay = 1.0
            self._netcons[gid] = nc


        # Attach another netcon to the low-level neuron(s) that will record
        self._low_level_neurons = list(sim.net.get_node_set('low_level_neurons').gids())
        for gid in self._low_level_neurons:
            cell = sim.net.get_cell_gid(gid)
            # NOTE: If you set the segment to 0.5 it will interfere with the record_spikes module. Neuron won't let
            # us record from the same place multiple times, so for now just set to 0.0. TODO: read and save spikes in biosimulator.
            nc = h.NetCon(cell.hobj.soma[0](0.0)._ref_v, None, sec=cell.hobj.soma[0])
            self._netcons[gid] = nc

        self._set_spike_detector(sim)
Exemple #5
0
    def initialize(self, sim):
        # Attach a NetCon/synapse on the high-level neuron(s) soma. We can use the NetCon.event(time) method to send
        # a spike to the synapse. Which, is a spike occurs, the high-level neuron will inhibit the low-level neuron.
        spikes = h.Vector([])  # start off with empty input
        vec_stim = h.VecStim()
        vec_stim.play(spikes)
        self._high_level_neurons = list(
            sim.net.get_node_set('high_level_neurons').gids())
        self._eus_neurons = list(sim.net.get_node_set('eus_neurons').gids())

        for gid in self._high_level_neurons:
            cell = sim.net.get_cell_gid(gid)

            # Create synapse
            # These values will determine how the high-level neuron behaves with the input
            new_syn = h.Exp2Syn(0.7, cell.hobj.soma[0])
            new_syn.e = 0.0
            new_syn.tau1 = 1.0
            new_syn.tau2 = 3.0

            nc = h.NetCon(vec_stim, new_syn)
            nc.weight[0] = 0.5
            nc.delay = 1.0

            self._synapses[gid] = new_syn
            self._netcons[gid] = nc

        for gid in self._eus_neurons:
            cell = sim.net.get_cell_gid(gid)

            # Create synapse
            # These values will determine how the high-level neuron behaves with the input
            new_syn = h.Exp2Syn(0.9, cell.hobj.soma[0])
            new_syn.e = 0.0
            new_syn.tau1 = 1.0
            new_syn.tau2 = 3.0

            nc = h.NetCon(vec_stim, new_syn)
            nc.weight[0] = 0.5
            nc.delay = 1.0

            self._synapses[gid] = new_syn
            self._netcons[gid] = nc

        # Attach another netcon to the low-level neuron(s) that will record
        self._low_level_neurons = list(
            sim.net.get_node_set('low_level_neurons').gids())
        for gid in self._low_level_neurons:
            cell = sim.net.get_cell_gid(gid)
            # NOTE: If you set the segment to 0.5 it will interfere with the record_spikes module. Neuron won't let
            # us record from the same place multiple times, so for now just set to 0.0. TODO: read and save spikes in biosimulator.
            nc = h.NetCon(cell.hobj.soma[0](0.0)._ref_v,
                          None,
                          sec=cell.hobj.soma[0])
            self._netcons[gid] = nc

        self._set_spike_detector(sim)
Exemple #6
0
def make_syn_mech(mech_name, seg):
    if mech_name == 'AMPA':
        syn = h.Exp2Syn(seg)
    elif mech_name == 'GABA_A':
        syn = h.Exp2Syn(seg)
    elif mech_name == 'GABA_B':
        syn = h.Exp2Syn(seg)
    else:
        raise ValueError("Unrecognized synaptic mechanism name %s", mech_name)
    return syn
    def create_synapses(self):
        self.synlist.append(h.Exp2Syn(self.soma(0.5)))  # Excitatory
        self.synlist[-1].tau2 = 0.1
        self.synlist[-1].tau2 = 2.0
        self.synlist[-1].e = 0

        self.synlist.append(h.Exp2Syn(self.soma(0.5)))  # Inhibitory
        self.synlist[-1].e = -75
        self.synlist[-1].tau1 = 0.1
        self.synlist[-1].tau2 = 2.0
    def define_biophysics(self, syn_loc):
        """Assign the membrane properties across the cell."""
        for sec in self.all:  # 'all' exists in parent object.
            sec.Ra = 70  # Axial resistance in Ohm * cm
            sec.cm = 1  # Membrane capacitance in micro Farads / cm^2
        # Insert active Hodgkin-Huxley current in the soma

        self.dap_syn_ = h.Exp2Syn(self.soma(0.5))
        self.dap_syn_.tau1 = 2
        self.dap_syn_.tau2 = 5
        self.dap_syn_.e = 50

        self.dap_nc_ = h.NetCon(self.soma(0.5)._ref_v,\
            self.dap_syn_, sec=self.soma)
        self.dap_nc_.delay = 0
        self.dap_nc_.threshold = 10

        self.dend_syn = h.Exp2Syn(self.dend(syn_loc))
        #self.dend_syn.tau1 = 1
        #self.dend_syn.tau2 = 17
        self.dend_syn = h.ExpSyn(self.dend(syn_loc))
        self.dend_syn.tau = .5
        self.dend_syn.e = 0

        self.soma.insert('clarke')
        # FINAL VERSIONS
        self.soma.gl_clarke = 0.003
        self.soma.tau_n_bar_clarke = 7
        self.dap_nc_.weight[0] = 7.5e-3
        self.soma.gkrect_clarke = 0.6

        # SWEEP VALUES
        #self.soma.gcaN_clarke      = 0
        #self.soma.gcaL_clarke      = 0
        #self.soma.gcak_clarke      = 0
        #self.soma.gnapbar_clarke   = 0
        #self.soma.tau_mc_clarke    = 0
        #self.soma.tau_hc_clarke    = 0
        #self.soma.tau_n_bar_clarke = 0
        #self.dap_nc_.weight[0]     = 0
        #self.soma.gkrect_clarke    = 0
        #self.soma.gnabar_clarke    = 0

        #self.soma.insert('pas')
        #self.soma.g_pas = 1e-3       # Passive conductance in S/cm2
        #self.soma.e_pas = -64         # Leak reversal potential mV

        #self.soma.insert('extracellular')

        # Insert passive current in the dendrite
        self.dend.insert('pas')
        self.dend.g_pas = 0.001  # Passive conductance in S/cm2
        self.dend.e_pas = -54.3  # Leak reversal potential mV
    def create_synapses(self):
        self.synlist.append(h.Exp2Syn(self.soma(0.5)))  # Excitatory
        self.synlist[-1].e = 0
        self.synlist[-1].tau2 = 0.1
        self.synlist[-1].tau2 = 2.0

        self.synlist.append(h.Exp2Syn(self.soma(0.5)))  # Inhibitory
        self.synlist[-1].e = -75

        # Here we use the same temporal parameters as excitatory synapses
        self.synlist[-1].tau1 = 0.2
        self.synlist[-1].tau2 = 4.0
Exemple #10
0
    def create_synapses(self):
        # self.synlist
        self.synlist.append(h.Exp2Syn(
            self.dend1[0](0.5)))  # An excitatory synapse
        self.synlist[-1].e = 0
        self.synlist[-1].tau1 = 0.25
        self.synlist[-1].tau2 = 3

        self.synlist.append(h.Exp2Syn(
            self.dend1[0](0.5)))  # An inhibitory synapse
        self.synlist[-1].e = -80
        self.synlist[-1].tau1 = 2
        self.synlist[-1].tau2 = 10
Exemple #11
0
    def addSynapses(self):
        self.pre_list = []

        # GC(AMPA) syn to prox dend similar to GC>BC
        syn_ = h.Exp2Syn(self.hcdend1[0](0.5))
        self.pre_list.append(syn_)  
        syn_.tau1 = 0.3
        syn_.tau2 = 0.6
        syn_.e = 0
        
        # GC(AMPA) syn to prox dend similar to GC>BC
        syn_ = h.Exp2Syn(self.hcdend2[0](0.5))
        self.pre_list.append(syn_) 
        syn_.tau1 = 0.3
        syn_.tau2 = 0.6
        syn_.e = 0
       
        # GC(AMPA) syn to prox dend similar to GC>BC
        syn_ = h.Exp2Syn(self.hcdend3[0](0.5))
        self.pre_list.append(syn_) 
        syn_.tau1 = 0.3
        syn_.tau2 = 0.6
        syn_.e = 0
       
        # GC(AMPA) syn to prox dend similar to GC>BC
        syn_ = h.Exp2Syn(self.hcdend4[0](0.5))
        self.pre_list.append(syn_) 
        syn_.tau1 = 0.3
        syn_.tau2 = 0.6
        syn_.e = 0
        
        # MC(AMPA) syn to mid dend similar to CA3>int Aaron
        syn_ = h.Exp2Syn(self.hcdend1[1](0.5))
        self.pre_list.append(syn_) 
        syn_.tau1 = .9
        syn_.tau2 = 3.6
        syn_.e = -70 # diff than model template I took it from, that seems to be wrong
        
        # MC(AMPA) syn to mid dend similar to CA3>int Aaron
        syn_ = h.Exp2Syn(self.hcdend2[1](0.5))
        self.pre_list.append(syn_) 
        syn_.tau1 = .9
        syn_.tau2 = 3.6
        syn_.e = -70 # diff than model template I took it from, that seems to be wrong

        # MC(AMPA) syn to mid dend similar to CA3>int Aaron
        syn_ = h.Exp2Syn(self.hcdend3[1](0.5))
        self.pre_list.append(syn_) 
        syn_.tau1 = .9
        syn_.tau2 = 3.6
        syn_.e = -70 # diff than model template I took it from, that seems to be wrong
        
        # MC(AMPA) syn to mid dend similar to CA3>int Aaron
        syn_ = h.Exp2Syn(self.hcdend4[1](0.5))
        self.pre_list.append(syn_) 
        syn_.tau1 = .9
        syn_.tau2 = 3.6
        syn_.e = -70 # diff than model template I took it from, that seems to be wrong
Exemple #12
0
def add_GABAsyns(model,
                 locs=[[0, 0.5]],
                 gmax=0.5,
                 tau1=0.1,
                 tau2=4,
                 rev=-75,
                 NoSynDends=[]):
    model.GABAlist = []
    model.ncGABAlist = []
    gmax = gmax / 1000.  # Set in nS and convert to muS
    for loc in locs:
        locInd = int(loc[0])
        if (locInd == -1):
            synloc = model.soma
        else:
            synloc = model.dends[int(loc[0])]
        GABA = h.Exp2Syn(float(loc[1]), sec=synloc)
        GABA.tau1 = tau1
        GABA.tau2 = tau2
        GABA.e = rev
        if (int(loc[0]) in NoSynDends):
            gg = 0  # same input into a single branch
        else:
            gg = gmax
        NC = h.NetCon(h.nil, GABA, 0, 0, gg)
        model.GABAlist.append(GABA)
        model.ncGABAlist.append(NC)
    print('inhibitory synapses generated')
Exemple #13
0
def add_AMPAsyns(model,
                 locs=[[0, 0.5]],
                 gmax=0.5,
                 tau1=0.1,
                 tau2=2,
                 NoSynDends=[]):
    model.AMPAlist = []
    model.ncAMPAlist = []
    gmax = gmax / 1000.  # Set in nS and convert to muS
    for loc in locs:
        locInd = int(loc[0])
        if (locInd == -1):
            synloc = model.soma
        else:
            synloc = model.dends[int(loc[0])]
        AMPA = h.Exp2Syn(float(loc[1]), sec=synloc)
        AMPA.tau1 = tau1
        AMPA.tau2 = tau2
        if (int(loc[0]) in NoSynDends):
            gg = 0  # same input into a single branch
        else:
            gg = gmax
        NC = h.NetCon(h.nil, AMPA, 0, 0,
                      gg)  # NetCon(source, target, threshold, delay, weight)
        model.AMPAlist.append(AMPA)
        model.ncAMPAlist.append(NC)
    print('AMPA synapses added')
Exemple #14
0
    def __init__(self):
        self.soma = h.Section()
        self.ap_dend = h.Section()

        self.soma.L = 30.0
        self.soma.diam = 30.0
        self.soma.nseg = 1
        self.soma.insert('hh')

        self.ap_dend = h.Section()
        self.ap_dend.L = 500.0
        self.ap_dend.diam = 2
        self.ap_dend.nseg = 23
        self.ap_dend.insert('hh')
        self.ap_dend.gnabar_hh = 0.012
        self.ap_dend.gkbar_hh = 0.0036
        self.ap_dend.gl_hh = 0.00003
        self.ap_dend.connect(self.soma, 1.0, 0)

        # synaptic input
        self.esyn = h.Exp2Syn(0.5,
                              sec=self.ap_dend)  #syn points to ap_dend,0.5
        self.esyn.tau1 = 0.5
        self.esyn.tau2 = 1.0
        self.esyn.e = 0
Exemple #15
0
def rewire_synapse(model, loc, lidx, tau1=0.5, tau2=2.5):
    AMPAtmp = h.Exp2Syn(float(loc[1]), sec=model.dends[int(loc[0])])
    AMPAtmp.tau1 = tau1
    AMPAtmp.tau2 = tau2
    NCtmp = h.NetCon(model.Estimlist[lidx], AMPAtmp, 0, 0, model.gmax)
    model.AMPAlist[lidx] = AMPAtmp
    model.ncAMPAlist[lidx] = NCtmp
Exemple #16
0
def add_synapses_on_spines(num_of_synapses,SynList,ConList,model_properties):

    # Add AMPA synapses
    for j in range(num_of_synapses):
        SynList.append(h.Exp2Syn(SPINE_HEAD_X,sec=HCell.spine[(j*2)+1]))
        ConList.append(h.NetCon(Stim1,SynList[-1]))
        SynList[-1].e=E_SYN
        SynList[-1].tau1=TAU_1_AMPA
        SynList[-1].tau2=TAU_2_AMPA

        ConList[-1].weight[0] = model_properties['AMPA_W']
        ConList[-1].delay = model_properties['DELAY']

    # Add NMDA synapses
    for j in range(num_of_synapses):
        SynList.append(h.NMDA(SPINE_HEAD_X,sec=HCell.spine[(j*2)+1]))
        ConList.append(h.NetCon(Stim1,SynList[-1]))
        SynList[-1].e=E_SYN
        SynList[-1].tau_r_NMDA = model_properties['tau_1_NMDA']
        SynList[-1].tau_d_NMDA = model_properties['tau_2_NMDA']
        SynList[-1].n_NMDA = model_properties['N_NMDA']
        SynList[-1].gama_NMDA = model_properties['GAMMA_NMDA']
        ConList[-1].weight[0] = model_properties['NMDA_W']

        ConList[-1].delay = model_properties['DELAY']


    return SynList,ConList
Exemple #17
0
def add_synapses_on_list_of_segments(list_of_segments, SynList, ConList,
                                     seg_to_num_of_syn):
    # delete previous synapses
    HCell.delete_spine()

    num_of_synapses = add_spines_on_segments(list_of_segments,
                                             seg_to_num_of_syn)

    for j in range(num_of_synapses):

        SynList.append(h.Exp2Syn(SPINE_HEAD_X, sec=HCell.spine[(j * 2) + 1]))
        ConList.append(h.NetCon(Stim1, SynList[-1]))
        SynList[-1].e = E_SYN
        SynList[-1].tau1 = TAU_1_AMPA
        SynList[-1].tau2 = TAU_2_AMPA
        ConList[-1].weight[0] = AMPA_W
        ConList[-1].delay = DELAY

    for j in range(num_of_synapses):

        SynList.append(h.NMDA(SPINE_HEAD_X, sec=HCell.spine[(j * 2) + 1]))
        ConList.append(h.NetCon(Stim1, SynList[-1]))
        SynList[-1].e = E_SYN
        SynList[-1].tau_r_NMDA = TAU_1_NMDA
        SynList[-1].tau_d_NMDA = TAU_2_NMDA
        ConList[-1].weight[0] = NMDA_W
        ConList[-1].delay = DELAY
        SynList[-1].n_NMDA = N_NMDA
        SynList[-1].gama_NMDA = GAMMA_NMDA

    return SynList, ConList
Exemple #18
0
 def create_syn(self, e, tau1, tau2):
     syn = h.Exp2Syn(self.sec(0.5), sec=self.sec)
     syn.e = e
     syn.tau1 = tau1
     syn.tau2 = tau2
     
     self.syn_list.append(syn)
    def __init__(self, stim, post_pop, n_targets, target_segs, tau1, tau2, e,
                 thr, delay, weight):
        """
        divergence,
                 tau1, tau2, e, g_max, thr, delay, weight, name = "GC->MC"
        """

        self.pre_pop = stim
        self.post_pop = post_pop
        post_pop.add_connection(self)
        synapses = []
        netcons = []

        if type(n_targets) == int:
            # Select n_targets from post_pop
            target_cells = np.random.choice(post_pop.cells,
                                            n_targets,
                                            replace=False)
        else:
            target_cells = post_pop.cells[n_targets]

        for curr_cell in target_cells:
            curr_seg_pool = curr_cell.get_segs_by_name(target_segs)
            for seg in curr_seg_pool:
                curr_syn = h.Exp2Syn(seg(0.5))
                curr_syn.tau1 = tau1
                curr_syn.tau2 = tau2
                curr_syn.e = e
                curr_netcon = h.NetCon(stim, curr_syn, thr, delay, weight)
                netcons.append(curr_netcon)
                synapses.append(curr_syn)

        self.netcons = netcons
        self.pre_cell_targets = np.array(target_cells)
        self.synapses = synapses
def set_AMPA_NMDA_synapses(num_of_synapses):

    del SynList[:]
    del ConList[:]

    for j in range(num_of_synapses):

        SynList.append(h.Exp2Syn(SPINE_HEAD_X, sec=HCell.spine[(j * 2) + 1]))
        ConList.append(h.NetCon(Stim1, SynList[-1]))
        SynList[-1].e = E_SYN
        SynList[-1].tau1 = TAU_1_AMPA
        SynList[-1].tau2 = TAU_2_AMPA
        ConList[-1].weight[0] = AMPA_W
        ConList[-1].delay = DELAY

    for j in range(num_of_synapses):

        SynList.append(h.NMDA(SPINE_HEAD_X, sec=HCell.spine[(j * 2) + 1]))
        ConList.append(h.NetCon(Stim1, SynList[-1]))
        SynList[-1].e = E_SYN
        SynList[-1].tau_r_NMDA = TAU_1_NMDA
        SynList[-1].tau_d_NMDA = TAU_2_NMDA
        ConList[-1].weight[0] = NMDA_W
        ConList[-1].delay = DELAY
        SynList[-1].n_NMDA = N_NMDA
        SynList[-1].gama_NMDA = GAMMA_NMDA
Exemple #21
0
def exp2syn(syn_params, xs, secs):
    '''
    Create a list of exp2syn synapses

    Parameters
    ----------
    syn_params: dict
        parameters of a synapse
    xs: float
        normalized distance along the section

    secs: hoc object
        target section

    Returns
    -------
    syns: synapse objects

    '''
    syns = []

    for x, sec in zip(xs, secs):
        syn = h.Exp2Syn(x, sec=sec)
        syn.e = syn_params['erev']
        syn.tau1 = syn_params['tau1']
        syn.tau2 = syn_params['tau2']
        syns.append(syn)
    return syns
Exemple #22
0
def add_synapses_on_spines(num_of_synapses,
                           SynList,
                           ConList,
                           model_properties,
                           AMPA_BLOCKED=False):

    # Add AMPA synapses
    for j in range(num_of_synapses):
        SynList.append(h.Exp2Syn(SPINE_HEAD_X, sec=HCell.spine[(j * 2) + 1]))
        ConList.append(h.NetCon(Stim1, SynList[-1]))
        SynList[-1].e = E_SYN
        SynList[-1].tau1 = TAU_1_AMPA
        SynList[-1].tau2 = TAU_2_AMPA
        ConList[-1].delay = model_properties['DELAY']
        if AMPA_BLOCKED:
            ConList[-1].weight[0] = AMPA_W_B
        else:
            ConList[-1].weight[0] = AMPA_W

    # Add NMDA synapses
    for j in range(num_of_synapses):
        SynList.append(h.NMDA(SPINE_HEAD_X, sec=HCell.spine[(j * 2) + 1]))
        ConList.append(h.NetCon(Stim1, SynList[-1]))
        SynList[-1].e = E_SYN
        SynList[-1].tau_r_NMDA = TAU_1_NMDA
        SynList[-1].tau_d_NMDA = TAU_2_NMDA
        SynList[-1].n_NMDA = N_NMDA
        SynList[-1].gama_NMDA = GAMMA_NMDA
        ConList[-1].weight[0] = NMDA_W
        ConList[-1].delay = model_properties['DELAY']

    return SynList, ConList
Exemple #23
0
    def syn_create(self, secloc, e, tau1, tau2):
        """Create an h.Exp2Syn synapse.

        Parameters
        ----------
        secloc : instance of nrn.Segment
            The section location. E.g., soma(0.5).
        e: float
            Reverse potential (in mV)
        tau1: float
            Rise time (in ms)
        tau2: float
            Decay time (in ms)

        Returns
        -------
        syn : instance of h.Exp2Syn
            A two state kinetic scheme synapse.
        """
        if not isinstance(secloc, nrn.Segment):
            raise TypeError(f'secloc must be instance of'
                            f'nrn.Segment. Got {type(secloc)}')
        syn = h.Exp2Syn(secloc)
        syn.e = e
        syn.tau1 = tau1
        syn.tau2 = tau2
        return syn
Exemple #24
0
def plot_synapses(shp,putative_dict,expname,Synlist,c):
    putative_syns = putative_dict[expname]
    trees = putative_syns[0]
    secs = putative_syns[1]
    segs = putative_syns[2]

    for i in range(len(segs)):

        if trees[i] == 'dend':
            Synlist.append(h.Exp2Syn(segs[i],sec=HCell.dend[secs[i]]))
        else:
            Synlist.append(h.Exp2Syn(segs[i],sec=HCell.apic[secs[i]]))
        Synlist[-1].e=E_SYN
        Synlist[-1].tau1=TAU_1
        Synlist[-1].tau2=TAU_2
        shp.point_mark(Synlist[-1],c,STYLE,SIZE)
Exemple #25
0
def add_synapses_on_list_of_segments(list_of_segments, HCell, SynList, ConList,
                                     config):
    HCell.delete_spine()
    if len(list_of_segments) == 0:
        return

    add_spines_on_segments(HCell, list_of_segments)
    num_of_synapses = len(list_of_segments)
    for j in range(num_of_synapses):

        SynList.append(
            h.Exp2Syn(config.SPINE_HEAD_X, sec=HCell.spine[(j * 2) + 1]))
        ConList.append(h.NetCon(config.stim, SynList[-1]))
        SynList[-1].e = config.E_SYN
        SynList[-1].tau1 = config.TAU_1_AMPA
        SynList[-1].tau2 = config.TAU_2_AMPA
        ConList[-1].weight[0] = config.AMPA_W

    for j in range(num_of_synapses):

        SynList.append(
            h.NMDA(config.SPINE_HEAD_X, sec=HCell.spine[(j * 2) + 1]))
        ConList.append(h.NetCon(config.stim, SynList[-1]))
        SynList[-1].e = config.E_SYN
        SynList[-1].tau_r_NMDA = config.TAU_1_NMDA
        SynList[-1].tau_d_NMDA = config.TAU_2_NMDA
        SynList[-1].n_NMDA = config.N_NMDA
        SynList[-1].gama_NMDA = config.GAMMA_NMDA
        ConList[-1].weight[0] = config.NMDA_W
def createSyn(synvars,sec_choice,seg_choice):
	if synvars['type'] == "E3_NMDA":
		syn = h.E3_NMDA(sec_choice(seg_choice))
	if synvars['type'] == "E2":	
		syn = h.Exp2Syn(sec_choice(seg_choice))
	if synvars['type'] == "E2_Prob":
		syn = h.E2_Prob(sec_choice(seg_choice))
		syn.P = synvars['P']
	if synvars['type'] == "E2_STP_Prob":
		syn = h.E2_STP_Prob(sec_choice(seg_choice))
	if synvars['type'] == "STDPE2":
		syn = h.STDPE2(sec_choice(seg_choice))
	if synvars['type'] == "STDPE2_Clo":
		syn = h.STDPE2_Clo(sec_choice(seg_choice))	
	if synvars['type'] == "STDPE2_STP"	:
		syn = h.STDPE2_STP(sec_choice(seg_choice))
	if synvars['type'] == "STDPE2_Prob":
		syn = h.STDPE2_Prob(sec_choice(seg_choice))
		syn.P = synvars['P']
	#initializes different variables depending on synapse		
	if (synvars['type'] == "STDPE2_STP")|(synvars['type'] == "E2_STP_Prob"):	
		syn.F1 = synvars['F1']		
	if  (synvars['type'] == "STDPE2_Clo" )|( synvars['type'] == "STDPE2_STP")|( synvars['type'] == "STDPE2")| (synvars['type'] == "STDPE2_Prob"):	
		syn.wmax = synvars['wmax']
		syn.wmin = synvars['wmin']
		syn.thresh = synvars['thresh']
	if  (synvars['type'] == "E2_Prob" )|( synvars['type'] == "E2_STP_Prob")|(synvars['type'] == "STDPE2_STP") | (synvars['type'] == "STDPE2_Prob"):
		h.use_mcell_ran4(1)   		
		syn.seed = self.ranGen.randint(1,4.295e9)
	syn.tau1 = 0.5
	syn.tau2 = 0.6
	syn.e = 0
        
        return syn
Exemple #27
0
    def add_exp2_syn(self, secname, pos=0.5, **kw):
        p = combine(default_model_parameters, kw)

        syn = h.Exp2Syn(self.sections[secname](pos))
        syn.tau1 = p['tau1']
        syn.tau2 = p['tau2']
        self.synapses.append(syn)
        return len(self.synapses)-1
Exemple #28
0
 def addDoubleExpSynapse(self, loc, tau1, tau2, e_r):
     loc = MorphLoc(loc, self)
     # create the synapse
     syn = h.Exp2Syn(self.sections[loc['node']](loc['x']))
     syn.tau1 = tau1
     syn.tau2 = tau2
     syn.e = e_r
     # store the synapse
     self.syns.append(syn)
Exemple #29
0
 def create_synapse(self, syn_type):
     if syn_type == 'e' and self.e_synapse is not None: return
     if syn_type == 'i' and self.i_synapse is not None: return
     syn = h.Exp2Syn(self.cell_obj.sec(0.5))
     if syn_type == 'e':
         syn.e = 0.0
         self.e_synapse = syn
     else:
         syn.e = -75.0
         self.i_synapse = syn
Exemple #30
0
def addReducedSynapses(cell):
    for syntype in cell.synGroups:
        # soma
        for ii in range(2):
            #syn = createSyn(cell.synvars,cell.soma,0.5)
            syn = h.Exp2Syn(0.5, sec=cell.soma)
            syn.tau1 = 0.5
            syn.tau2 = 0.6
            syn.e = 0
            cell.synGroups[syntype]['soma'].append(syn)