Exemple #1
0
    def __init__(self, syn_type, syn_shape, c_m, i_offset,
                 v_init, tau_e, tau_i, e_e, e_i):
        
        # initialise Section object with 'pas' mechanism
        nrn.Section.__init__(self)
        self.seg = self(0.5)
        self.L = 100
        self.seg.diam = 1000/pi # gives area = 1e-3 cm2
                
        self.syn_type = syn_type
        self.syn_shape = syn_shape
        self.v_init = v_init
        
        # insert synapses
        assert syn_type in ('current', 'conductance'), "syn_type must be either 'current' or 'conductance'. Actual value is %s" % syn_type
        assert syn_shape in ('alpha', 'exp'), "syn_type must be either 'alpha' or 'exp'"
        synapse_model = StandardIF.synapse_models[syn_type][syn_shape]
        self.esyn = synapse_model(0.5, sec=self)
        self.isyn = synapse_model(0.5, sec=self)
        if self.syn_type == 'conductance' and self.syn_shape == 'exp':
            self.esyn_TM = h.tmgsyn(0.5, sec=self)
            self.isyn_TM = h.tmgsyn(0.5, sec=self)
        
        # insert current source
        self.stim = h.IClamp(0.5, sec=self)
        self.stim.delay = 0
        self.stim.dur = 1e12
        self.stim.amp = i_offset

        # for recording spikes
        self.spike_times = h.Vector(0)
        self.gsyn_trace = {}
        self.recording_time = 0
Exemple #2
0
 def __init__(self, romans=0, judeans=1):
     self.source_section = h.Section()
     self.source = self.source_section(0.5)._ref_v
     self.synapse = h.tmgsyn(self.source_section(0.5))
     self.record = Mock()
     self.record_v = Mock()
     self.record_gsyn = Mock()
     self.memb_init = Mock()
     self.excitatory_TM = None
     self.inhibitory_TM = None
     self.romans = romans
     self.judeans = judeans
     self.foo_init = -99.9
Exemple #3
0
    def __init__(self,
                 post_pop,
                 t_pattern,
                 spat_pattern,
                 target_segs,
                 tau_1,
                 tau_facil,
                 U,
                 tau_rec,
                 e,
                 weight,
                 rec_cond=False):

        self.init_parameters = locals()
        post_pop.add_connection(self)
        synapses = []
        netcons = []
        t_pattern = list(t_pattern)  # nrn does not like np.ndarrays?
        target_cells = post_pop[spat_pattern]
        self.pre_pop = 'Implicit'
        self.post_pop = post_pop
        self.vecstim = h.VecStim()
        self.pattern_vec = h.Vector(t_pattern)
        self.vecstim.play(self.pattern_vec)
        conductances = []

        for curr_cell in target_cells:
            curr_seg_pool = curr_cell.get_segs_by_name(target_segs)
            curr_conductances = []
            for seg in curr_seg_pool:
                curr_syn = h.tmgsyn(seg(0.5))
                curr_syn.tau_1 = tau_1
                curr_syn.tau_facil = tau_facil
                curr_syn.U = U
                curr_syn.tau_rec = tau_rec
                curr_syn.e = e
                curr_netcon = h.NetCon(self.vecstim, curr_syn)
                curr_gvec = h.Vector()
                curr_gvec.record(curr_syn._ref_g)
                curr_conductances.append(curr_gvec)
                curr_netcon.weight[0] = weight
                netcons.append(curr_netcon)
                synapses.append(curr_syn)
            if rec_cond:
                conductances.append(curr_conductances)

        self.conductances = conductances
        self.netcons = netcons
        self.pre_cell_targets = np.array(spat_pattern)
        self.synapses = synapses
    def __init__(self, pre_pop, post_pop, target_pool, target_segs, divergence,
                 tau_1, tau_facil, U, tau_rec, e, thr, delay, weight):
        """Create a connection with tmgsyn as published by Tsodyks, Pawelzik &
        Markram, 1998.
        The tmgsyn is a dynamic three state implicit resource synapse model.
        The response onset is instantaneous and the decay is exponential.
        It combines a frequency dependent depression and a facilitation
        mechanism that both depend on independent time constants.
        The synaptic targets are chosen by proximity, that is the target pool
        are the cells in closest proximity.

        Parameters
        ----------
        pre_pop - gennetwork.Population
            The presynaptic population
        post_pop - gennetwork.Population
            the postsynaptic population
        target_pool - int
            the number of cells in the target pool
        target_segs - str
            the name of the segments that are possible synaptic targets at the
            postsynaptic population
        divergence - int
            divergence in absolute terms, that is the number of synapses each
            presynaptic cell forms
        tau_1 - numeric
            the time constant of synaptic decay. conforms to the transition
            from the active to the inactive resource state. units of time as in
            neuron standard units
        tau_facil - numeric
            the time constant of facilitation decay. this essentially creates
            the frequency dependence. set to 0 for no facilitation.
        U - numeric
            maximum of postsynaptic response. has to be considered together
            with the weight from the netcon.
        tau_rec - numeric
            time constant of recovery from inactive for recovered state.
            gives depression since inactive resources do not contribute to
            postsynaptic signal. set to 0 for no depression.
        e - numeric
            equilibrium potential of the postsynaptic conductance
        thr - numeric
            threshold for synaptic event at the presynaptic source
        delay - numeric
            delay between presynaptic signal and onset of postsynaptic signal
        weight - numeric
            weight for the netcon object connecting source and target

        Returns
        -------
        None

        Use Cases
        ---------
        >>> tmgsynConnection(nw.population[0], nw.population[1],
                             3, 'prox', 1, 6.0, 0, 0.04, 0, 0, 10, 3, 0)
        A non-facilitating, non-depressing excitatory connection.

        """
        self.init_parameters = locals()
        self.pre_pop = pre_pop
        self.post_pop = post_pop
        pre_pop.add_connection(self)
        post_pop.add_connection(self)
        pre_pop_rad = (np.arange(pre_pop.get_cell_number(), dtype=float) /
                       pre_pop.get_cell_number()) * (2 * np.pi)
        post_pop_rad = (np.arange(post_pop.get_cell_number(), dtype=float) /
                        post_pop.get_cell_number()) * (2 * np.pi)

        pre_pop_pos = pos(pre_pop_rad)
        post_pop_pos = pos(post_pop_rad)
        pre_cell_target = []
        synapses = []
        netcons = []
        conductances = []

        for idx, curr_cell_pos in enumerate(pre_pop_pos):

            curr_dist = []
            for post_cell_pos in post_pop_pos:
                curr_dist.append(euclidian_dist(curr_cell_pos, post_cell_pos))

            sort_idc = np.argsort(curr_dist)
            closest_cells = sort_idc[0:target_pool]
            picked_cells = np.random.choice(closest_cells,
                                            divergence,
                                            replace=False)
            pre_cell_target.append(picked_cells)
            for tar_c in picked_cells:

                curr_syns = []
                curr_netcons = []
                curr_conductances = []

                curr_seg_pool = post_pop[tar_c].get_segs_by_name(target_segs)
                chosen_seg = np.random.choice(curr_seg_pool)
                for seg in chosen_seg:
                    curr_syn = h.tmgsyn(chosen_seg(0.5))
                    curr_syn.tau_1 = tau_1
                    curr_syn.tau_facil = tau_facil
                    curr_syn.U = U
                    curr_syn.e = e
                    curr_syn.tau_rec = tau_rec
                    curr_syns.append(curr_syn)
                    curr_netcon = h.NetCon(pre_pop[idx].soma(0.5)._ref_v,
                                           curr_syn,
                                           thr,
                                           delay,
                                           weight,
                                           sec=pre_pop[idx].soma)
                    curr_gvec = h.Vector()
                    curr_gvec.record(curr_syn._ref_g)
                    curr_conductances.append(curr_gvec)
                    curr_netcons.append(curr_netcon)
                    netcons.append(curr_netcons)
                    synapses.append(curr_syns)
            conductances.append(curr_conductances)
        self.conductances = conductances
        self.netcons = netcons
        self.pre_cell_targets = np.array(pre_cell_target)
        self.synapses = synapses
Exemple #5
0
h.nrn_load_dll("C:\\Users\\DanielM\\Repos\\models_dentate\\dentate_gyrus_Santhakumar2005_and_Yim_patterns\\dentategyrusnet2005\\nrnmech.dll")

stim_periods = [1000, 100, 33, 20]

for period in stim_periods:
    """Setup stimulation pattern"""
    t_pattern = np.arange(100, 100+10*period, period)
    vecstim = h.VecStim()
    pattern_vec = h.Vector(t_pattern)
    vecstim.play(pattern_vec)

    """Setup tmgsyn"""
    mc_tmgsyn = MossyCell()

    mc_tmgsyn_syn = h.tmgsyn(mc_tmgsyn.all_secs[1](0.5))
    mc_tmgsyn_syn.e = 0
    mc_tmgsyn_syn.tau_facil = 0 # This parameter gives the frequency dependence of facilitation
    mc_tmgsyn_syn.tau_1 = 6.2
    mc_tmgsyn_syn.tau_rec = 30 # ???
    mc_tmgsyn_syn.U = 0.1
    #mc_tmgsyn_syn.u0 = 0.04
    mc_tmgsyn_netcon = h.NetCon(vecstim, mc_tmgsyn_syn)
    mc_tmgsyn_netcon.weight[0] = 0.62*10**(-2)

    mc_tmgsyn_rec_g = h.Vector()
    mc_tmgsyn_rec_g.record(mc_tmgsyn_syn._ref_g)

    mc_tmgsyn._SEClamp(dur1=t_pattern[9]+500, amp1=-70, rs=0.001)
    rec_curr = h.Vector()
    rec_curr.record(mc_tmgsyn.vclamp._ref_i)
Exemple #6
0
exp2syn_sec = h.Section()
tmgsyn_sec = h.Section()
tmgexp2syn_sec = h.Section()
secs = [exp2syn_sec, tmgsyn_sec, tmgexp2syn_sec]
for sec in secs:
    sec.insert('pas')
    sec(0.5).pas.e = pas_e

# Create the synapses
exp2syn_syn = h.Exp2Syn(exp2syn_sec(0.5))
exp2syn_syn.tau1 = tau_1
exp2syn_syn.tau2 = tau_2
exp2syn_syn.e = syn_e
exp2syn_syn.g = gmax

tmgsyn_syn = h.tmgsyn(tmgsyn_sec(0.5))
tmgsyn_syn.tau_1 = tau_2  # Note that tau_2 is the decay tau at script level!
tmgsyn_syn.tau_facil = tau_facil
tmgsyn_syn.tau_rec = tau_rec
tmgsyn_syn.e = syn_e
#tmgsyn_syn.g = gmax
tmgsyn_syn.U = U

tmgexp2syn_syn = h.tmgexp2syn(tmgexp2syn_sec(0.5))
tmgexp2syn_syn.tau_1 = tau_1
tmgexp2syn_syn.tau_2 = tau_2
tmgexp2syn_syn.tau_facil = tau_facil
tmgexp2syn_syn.tau_rec = tau_rec
tmgexp2syn_syn.e = syn_e
#tmgexp2syn_syn.g = gmax
tmgexp2syn_syn.U = U