示例#1
0
    def inputs_calc(self,g_tt_vec,time_step_sim,numb_syn,w_vec_tt,syn_func,tau_syn,tt,delta_t,spike_trains_complete):
        
        from Euler_Method import Euler # import Euler to perform the Euler integration method
        
        for syn in range(1,numb_syn+1): # loop through synapses
            for sp in range(1,len(spike_trains_complete[syn-1])): # loop through spikes
        
                if spike_trains_complete[syn-1][sp-1]>=tt-time_step_sim and spike_trains_complete[syn-1][sp-1]<tt+time_step_sim:
                    g_tt_vec[syn-1]=g_tt_vec[syn-1]+w_vec_tt[syn-1]

            # call function from Euler_Method to integrate the conductance
            g_1=Euler()
            g_tt_vec[syn-1]=g_1.euler_integration(syn_func, tau_syn, g_tt_vec[syn-1], tt, time_step_sim, delta_t) # gives us the value of the differential equation at certain time
        
        return [g_tt_vec]      
示例#2
0
 def inputs(self,g_tt_vec,time_step_sim,spikes,spiketrue,numb_syn,weight,syn_func,tau_syn,tt,counter,delta_t):
     
     from Euler_Method import Euler
     
     for syn in range(1,numb_syn+1):  # loop over synapses 
         
         # get spike times:                 
         if np.sum(spiketrue[np.where(np.tile(tt,len(spikes))==spikes)])>0: 
            
             # input is delivered   
             counter += 1
             g_tt_vec[syn-1]=g_tt_vec[syn-1]+weight[syn-1]
         
         # call function from Euler_Method to integrate the conductance
         g_1=Euler()
         g_tt_vec[syn-1]=g_1.euler_integration(syn_func, tau_syn, g_tt_vec[syn-1], tt, time_step_sim, delta_t) # gives us the value of the differential equation at certain time
     
     return [g_tt_vec,counter]
示例#3
0
    def inputs_pois(self, g_tt_vec, time_step_sim, firing_rate, numb_syn,
                    weight, syn_func, tau_syn, tt, counter, delta_t):

        # g_tt_vec contains all the conductances from the last timestep
        # syn_func contains the function of the the conductances, of the synapse type (needed for Euler Integration)
        # weight is the synaptic strength
        # counter counts the number of inputs

        from Euler_Method import Euler

        for syn in range(1, numb_syn + 1):
            if random.uniform(0, 1) <= (firing_rate * time_step_sim / 1000):
                counter += 1
                g_tt_vec[syn - 1] = g_tt_vec[syn - 1] + weight[syn - 1]

            # call function from Euler_Method to integrate the conductance
            g_1 = Euler()
            g_tt_vec[syn - 1] = g_1.euler_integration(
                syn_func, tau_syn, g_tt_vec[syn - 1], tt, time_step_sim,
                delta_t
            )  # gives us the value of the differential equation at certain time

        return [g_tt_vec, counter]
    [g_i_tt_vec] = synapse_i.inputs_calc(g_i_tt_vec, time_step_sim,
                                         numb_inh_syn, w_i_vec_tt, inhib_syn,
                                         tau_i, tt, delta_t,
                                         spike_trains_complete_i)
    total_inh_input_tt = sum([ww * (E_i - V_tt) for ww in g_i_tt_vec])

    # Include STDP in excitatory synapses. (1)
    # Check if there was LTD by comparing all new pre-spikes in this timepoint with the latest post-spike.
    w_e_vec_tt = exc_STDP.STDP_post_pre(last_post_spike - time_step_sim / 10,
                                        spike_trains_complete_e, tt,
                                        time_step_sim, w_e_vec_tt, tau_LTD,
                                        A_LTD, w_max)

    # update the postsynaptic neuron.
    total_input_tt = total_exc_input_tt + total_inh_input_tt
    V_1 = Euler()
    V = V_1.euler_integration(memb_volt, arg_for_V, V_tt, tt, time_step_sim,
                              delta_t)

    if V < V_thresh:
        V_tt = V
    else:  # if threshold is reached -> spike & reset mem V
        V_tt = V_reset
        # log spike time (for figure)
        V_vals.append(0)
        t_vals.append(tt - time_step_sim / 10)
        spike_times.append(tt)
        number_spikes += 1

        ### include STDP in excitatory synapses. (2)
        # check if there was LTP: compare this post-spike to all most recent pre-spikes.