当前位置: 首页>>代码示例>>Python>>正文


Python Synapses.connect方法代码示例

本文整理汇总了Python中brian2.Synapses.connect方法的典型用法代码示例。如果您正苦于以下问题:Python Synapses.connect方法的具体用法?Python Synapses.connect怎么用?Python Synapses.connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在brian2.Synapses的用法示例。


在下文中一共展示了Synapses.connect方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run_network

# 需要导入模块: from brian2 import Synapses [as 别名]
# 或者: from brian2.Synapses import connect [as 别名]
def run_network(traj):
    """Runs brian network consisting of
        200 inhibitory IF neurons"""

    eqs = '''
    dv/dt=(v0-v)/(5*ms) : volt (unless refractory)
    v0 : volt
    '''
    group = NeuronGroup(100, model=eqs, threshold='v>10 * mV',
                        reset='v = 0*mV', refractory=5*ms)
    group.v0 = traj.par.v0
    group.v = np.random.rand(100) * 10.0 * mV

    syn = Synapses(group, group, on_pre='v-=1*mV')
    syn.connect('i != j', p=0.2)

    spike_monitor = SpikeMonitor(group, variables=['v'])
    voltage_monitor = StateMonitor(group, 'v', record=True)
    pop_monitor = PopulationRateMonitor(group, name='pop' + str(traj.v_idx))

    net = Network(group, syn, spike_monitor, voltage_monitor, pop_monitor)
    net.run(0.25*second, report='text')

    traj.f_add_result(Brian2MonitorResult, 'spikes',
                      spike_monitor)
    traj.f_add_result(Brian2MonitorResult, 'v',
                      voltage_monitor)
    traj.f_add_result(Brian2MonitorResult, 'pop',
                      pop_monitor)
开发者ID:SmokinCaterpillar,项目名称:pypet,代码行数:31,代码来源:another_network_test.py

示例2: simulate_brunel_network

# 需要导入模块: from brian2 import Synapses [as 别名]
# 或者: from brian2.Synapses import connect [as 别名]
def simulate_brunel_network(
        N_Excit=5000,
        N_Inhib=None,
        N_extern=N_POISSON_INPUT,
        connection_probability=CONNECTION_PROBABILITY_EPSILON,
        w0=SYNAPTIC_WEIGHT_W0,
        g=RELATIVE_INHIBITORY_STRENGTH_G,
        synaptic_delay=SYNAPTIC_DELAY,
        poisson_input_rate=POISSON_INPUT_RATE,
        w_external=None,
        v_rest=V_REST,
        v_reset=V_RESET,
        firing_threshold=FIRING_THRESHOLD,
        membrane_time_scale=MEMBRANE_TIME_SCALE,
        abs_refractory_period=ABSOLUTE_REFRACTORY_PERIOD,
        monitored_subset_size=100,
        random_vm_init=False,
        sim_time=100.*b2.ms):
    """
    Fully parametrized implementation of a sparsely connected network of LIF neurons (Brunel 2000)

    Args:
        N_Excit (int): Size of the excitatory popluation
        N_Inhib (int): optional. Size of the inhibitory population.
            If not set (=None), N_Inhib is set to N_excit/4.
        N_extern (int): optional. Number of presynaptic excitatory poisson neurons. Note: if set to a value,
            this number does NOT depend on N_Excit and NOT depend on connection_probability (this is different
            from the book and paper. Only if N_extern is set to 'None', then N_extern is computed as
            N_Excit*connection_probability.
        connection_probability (float): probability to connect to any of the (N_Excit+N_Inhib) neurons
            CE = connection_probability*N_Excit
            CI = connection_probability*N_Inhib
            Cexternal = N_extern
        w0 (float): Synaptic strength J
        g (float): relative importance of inhibition. J_exc = w0. J_inhib = -g*w0
        synaptic_delay (Quantity): Delay between presynaptic spike and postsynaptic increase of v_m
        poisson_input_rate (Quantity): Poisson rate of the external population
        w_external (float): optional. Synaptic weight of the excitatory external poisson neurons onto all
            neurons in the network. Default is None, in that case w_external is set to w0, which is the
            standard value in the book and in the paper Brunel2000.
            The purpose of this parameter is to see the effect of external input in the
            absence of network feedback(setting w0 to 0mV and w_external>0).
        v_rest (Quantity): Resting potential
        v_reset (Quantity): Reset potential
        firing_threshold (Quantity): Spike threshold
        membrane_time_scale (Quantity): tau_m
        abs_refractory_period (Quantity): absolute refractory period, tau_ref
        monitored_subset_size (int): nr of neurons for which a VoltageMonitor is recording Vm
        random_vm_init (bool): if true, the membrane voltage of each neuron is initialized with a
            random value drawn from Uniform(v_rest, firing_threshold)
        sim_time (Quantity): Simulation time

    Returns:
        (rate_monitor, spike_monitor, voltage_monitor, idx_monitored_neurons)
        PopulationRateMonitor: Rate Monitor
        SpikeMonitor: SpikeMonitor for ALL (N_Excit+N_Inhib) neurons
        StateMonitor: membrane voltage for a selected subset of neurons
        list: index of monitored neurons. length = monitored_subset_size
    """
    if N_Inhib is None:
        N_Inhib = int(N_Excit/4)
    if N_extern is None:
        N_extern = int(N_Excit*connection_probability)
    if w_external is None:
        w_external = w0

    J_excit = w0
    J_inhib = -g*w0

    lif_dynamics = """
    dv/dt = -(v-v_rest) / membrane_time_scale : volt (unless refractory)"""

    network = NeuronGroup(
        N_Excit+N_Inhib, model=lif_dynamics,
        threshold="v>firing_threshold", reset="v=v_reset", refractory=abs_refractory_period,
        method="linear")
    if random_vm_init:
        network.v = random.uniform(v_rest/b2.mV, high=firing_threshold/b2.mV, size=(N_Excit+N_Inhib))*b2.mV
    else:
        network.v = v_rest
    excitatory_population = network[:N_Excit]
    inhibitory_population = network[N_Excit:]

    exc_synapses = Synapses(excitatory_population, target=network, on_pre="v += J_excit", delay=synaptic_delay)
    exc_synapses.connect(p=connection_probability)

    inhib_synapses = Synapses(inhibitory_population, target=network, on_pre="v += J_inhib", delay=synaptic_delay)
    inhib_synapses.connect(p=connection_probability)

    external_poisson_input = PoissonInput(target=network, target_var="v", N=N_extern,
                                          rate=poisson_input_rate, weight=w_external)

    # collect data of a subset of neurons:
    monitored_subset_size = min(monitored_subset_size, (N_Excit+N_Inhib))
    idx_monitored_neurons = sample(range(N_Excit+N_Inhib), monitored_subset_size)
    rate_monitor = PopulationRateMonitor(network)
    # record= some_list is not supported? :-(
    spike_monitor = SpikeMonitor(network, record=idx_monitored_neurons)
    voltage_monitor = StateMonitor(network, "v", record=idx_monitored_neurons)

#.........这里部分代码省略.........
开发者ID:EPFL-LCN,项目名称:neuronaldynamics-exercises,代码行数:103,代码来源:LIF_spiking_network.py

示例3: SynapserClass

# 需要导入模块: from brian2 import Synapses [as 别名]
# 或者: from brian2.Synapses import connect [as 别名]

#.........这里部分代码省略.........
					)
				]
			)
			"""

            # divide and put that in ms...(rough)
            DelayEquationsInt = (int)(_DelayVariable * 0.001 / float(self.SynapsingBrianKwargDict["source"].clock.dt))

            # join
        self.SynapsedCustomOperationStr = "\n".join(
            map(
                lambda __EquationIndexInt: _SymbolStr
                + "_delayer_"
                + str(__EquationIndexInt)
                + "="
                + _SymbolStr
                + "_delayer_"
                + str(__EquationIndexInt - 1),
                xrange(DelayEquationsInt, 1, -1),
            )
            + [_SymbolStr + "delayer_1=" + _SymbolStr]
        )

        # debug
        self.debug(("self.", self, ["SynapsedCustomOperationStr"]))

        # custom
        self.SynapsingBrianKwargDict["source"].custom_operation(self.SynapsedCustomOperationStr)

        # join
        self.SynapsedDelayStateStrsListsList = map(
            lambda __EquationIndexInt: _SymbolStr + "_delayer_ : 1", xrange(DelayEquationsInt)
        )

        # debug
        self.debug(("self.", self, ["SynapsedDelayStateStrsList"]))

        # add in the PreModelInsertStrsList
        if hasattr(self, "AttentionUpdateVariable") == False:
            self.AttentionUpdateVariable = {"PreModelInsertStrsList": []}
        self.AttentionUpdateVariable["PreModelInsertStrsList"] += self.SynapsedDelayStateStrsListsList

    def do_synapse(self):

        # Maybe should import
        from brian2 import Synapses

        # Check
        if len(self.SynapsingDelayDict) > 0.0:

            # map
            map(lambda __ItemTuple: self.setDelay(*__ItemTuple), self.SynapsingDelayDict.items())

            # debug
        """
		self.debug(('self.',self,[
								'SynapsingBrianKwargDict'
								]))
		"""

        # init
        self.SynapsedBrianVariable = Synapses(**self.SynapsingBrianKwargDict)

        # connect
        if type(self.SynapsingProbabilityVariable) == float:

            # debug
            """
			self.debug('we connect with a sparsity of '+str(self.SynapsingProbabilityVariable))
			"""

            self.SynapsedBrianVariable.connect(True, p=self.SynapsingProbabilityVariable)

            # Check
        if self.SynapsingWeigthSymbolStr != "":

            # debug
            """
			self.debug(
				('self.',self,[
					'SynapsedBrianVariable',
					'SynapsingWeigthSymbolStr'
					])
			)
			"""

            # connect
            self.SynapsedBrianVariable.connect(True)

            # get
            self.SynapsedWeigthFloatsArray = getattr(self.SynapsedBrianVariable, self.SynapsingWeigthSymbolStr)

            # set
            self.SynapsedWeigthFloatsArray[:] = np.reshape(
                self.SynapsingWeigthFloatsArray,
                self.SynapsedBrianVariable.source.N * self.SynapsedBrianVariable.target.N,
            )

            # debug
            self.debug(("self.", self, ["SynapsedWeigthFloatsArray"]))
开发者ID:BinWang20140601,项目名称:ShareYourSystem,代码行数:104,代码来源:__init__.py

示例4: simulate_wm

# 需要导入模块: from brian2 import Synapses [as 别名]
# 或者: from brian2.Synapses import connect [as 别名]

#.........这里部分代码省略.........
    presyn_weight_kernel = \
        [(Jneg_excit2excit +
          (Jpos_excit2excit - Jneg_excit2excit) *
          math.exp(-.5 * (360. * min(j, N_excitatory - j) / N_excitatory) ** 2 / sigma_weight_profile ** 2))
         for j in range(N_excitatory)]
    # validate the normalization condition: (360./N_excitatory)*sum(presyn_weight_kernel)/360.
    fft_presyn_weight_kernel = rfft(presyn_weight_kernel)
    weight_profile_45 = deque(presyn_weight_kernel)
    rot_dist = int(round(len(weight_profile_45) / 8))
    weight_profile_45.rotate(rot_dist)

    # define the inhibitory population
    inhib_lif_dynamics = """
        s_NMDA_total : 1  # the post synaptic sum of s. compare with s_NMDA_presyn
        dv/dt = (
        - G_leak_inhib * (v-E_leak_inhib)
        - G_extern2inhib * s_AMPA * (v-E_AMPA)
        - G_inhib2inhib * s_GABA * (v-E_GABA)
        - G_excit2inhib * s_NMDA_total * (v-E_NMDA)/(1.0+1.0*exp(-0.062*v/volt)/3.57)
        )/Cm_inhib : volt (unless refractory)
        ds_AMPA/dt = -s_AMPA/tau_AMPA : 1
        ds_GABA/dt = -s_GABA/tau_GABA : 1
    """

    inhib_pop = NeuronGroup(
        N_inhibitory, model=inhib_lif_dynamics,
        threshold="v>v_firing_threshold_inhib", reset="v=v_reset_inhib", refractory=t_abs_refract_inhib,
        method="rk2")
    # initialize with random voltages:
    inhib_pop.v = numpy.random.uniform(v_reset_inhib / b2.mV, high=v_firing_threshold_inhib / b2.mV,
                                       size=N_inhibitory) * b2.mV
    # set the connections: inhib2inhib
    syn_inhib2inhib = Synapses(inhib_pop, target=inhib_pop, on_pre="s_GABA += 1.0", delay=0.0 * b2.ms)
    syn_inhib2inhib.connect(condition="i!=j", p=1.0)
    # set the connections: extern2inhib
    input_ext2inhib = PoissonInput(target=inhib_pop, target_var="s_AMPA",
                                   N=N_extern_poisson, rate=poisson_firing_rate, weight=1.0)

    # specify the excitatory population:
    excit_lif_dynamics = """
        I_stim : amp
        s_NMDA_total : 1  # the post synaptic sum of s. compare with s_NMDA_presyn
        dv/dt = (
        - G_leak_excit * (v-E_leak_excit)
        - G_extern2excit * s_AMPA * (v-E_AMPA)
        - G_inhib2excit * s_GABA * (v-E_GABA)
        - G_excit2excit * s_NMDA_total * (v-E_NMDA)/(1.0+1.0*exp(-0.062*v/volt)/3.57)
        + I_stim
        )/Cm_excit : volt (unless refractory)
        ds_AMPA/dt = -s_AMPA/tau_AMPA : 1
        ds_GABA/dt = -s_GABA/tau_GABA : 1
        ds_NMDA/dt = -s_NMDA/tau_NMDA_s + alpha_NMDA * x * (1-s_NMDA) : 1
        dx/dt = -x/tau_NMDA_x : 1
    """

    excit_pop = NeuronGroup(N_excitatory, model=excit_lif_dynamics,
                            threshold="v>v_firing_threshold_excit", reset="v=v_reset_excit; x+=1.0",
                            refractory=t_abs_refract_excit, method="rk2")
    # initialize with random voltages:
    excit_pop.v = numpy.random.uniform(v_reset_excit / b2.mV, high=v_firing_threshold_excit / b2.mV,
                                       size=N_excitatory) * b2.mV
    excit_pop.I_stim = 0. * b2.namp
    # set the connections: extern2excit
    input_ext2excit = PoissonInput(target=excit_pop, target_var="s_AMPA",
                                   N=N_extern_poisson, rate=poisson_firing_rate, weight=1.0)
开发者ID:accssharma,项目名称:neuronaldynamics-exercises,代码行数:69,代码来源:wm_model.py

示例5: BrianerClass

# 需要导入模块: from brian2 import Synapses [as 别名]
# 或者: from brian2.Synapses import connect [as 别名]

#.........这里部分代码省略.........
            self.BrianedParentPopulationDeriveBrianerVariable = (
                self.BrianedParentInteractomeDeriveBrianerVariable.ParentDeriveTeamerVariable.ParentDeriveTeamerVariable
            )

        else:

            # debug
            """
			self.debug(
				[
					'There is no projectome structure'
				]
			)
			"""

            # get
            self.BrianedParentPopulationDeriveBrianerVariable = (
                self.ParentDeriveTeamerVariable.ParentDeriveTeamerVariable
            )

            # get
        self.BrianedParentNetworkDeriveBrianerVariable = (
            self.BrianedParentPopulationDeriveBrianerVariable.BrianedParentNetworkDeriveBrianerVariable
        )

        # /####################/#
        # Set the ConnectedTo Variable
        #

        # debug
        """
		self.debug(
			[
				'Check if we have to get the connected to variable',
				('self.',self,['ConnectedToVariable'])
			]
		)
		"""

        # Check
        if self.ConnectedToVariable == None:

            # debug
            """
			self.debug(
				[
					'We setConnection here'
				]
			)
			"""

            # setConnection
            self.setConnection(self.ManagementTagStr, self, self.BrianedParentPopulationDeriveBrianerVariable)

            # /####################/#
            # Set the BrianedParentPopulationDeriveBrianerVariable
            #

            # debug
        """
		self.debug(
			[
				'Do we have to make parent-brian the connected variable ?',
				'self.ConnectedToVariable.BrianedNeurongroupVariable is ',
				str(self.ConnectedToVariable.BrianedNeurongroupVariable)
			]
开发者ID:BinWang20140601,项目名称:ShareYourSystem,代码行数:70,代码来源:__init__+copy+7.py

示例6: BrianerClass

# 需要导入模块: from brian2 import Synapses [as 别名]
# 或者: from brian2.Synapses import connect [as 别名]

#.........这里部分代码省略.........
			#

			#get
			self.BrianedParentNeurongroupDeriveBrianerVariable=self.ParentDeriveTeamerVariable.ParentDeriveTeamerVariable

			#get
			self.BrianedParentNetworkDeriveBrianerVariable=self.BrianedParentNeurongroupDeriveBrianerVariable.BrianedParentNetworkDeriveBrianerVariable


			#/####################/#
			# Set the BrianedParentNeurongroupDeriveBrianerVariable
			#

			#import
			from brian2 import Synapses

			#init
			self.BrianedSynapsesVariable=Synapses(
				source=self.BrianedParentNeurongroupDeriveBrianerVariable.BrianedNeurongroupVariable,
				target=self.PointToVariable.BrianedNeurongroupVariable,
				**self.BrianingSynapsesDict
			)

			#/####################/#
			# Connect options
			#

			#connect
			if type(self.BrianingConnectVariable)==float:

				#debug
				self.debug(
					[
						'we connect with a sparsity of ',
						('self.',self,[
							'BrianingConnectVariable'
						])
					]
				)

				#connect
				self.BrianedSynapsesVariable.connect(
					True,
					p=self.BrianingConnectVariable
				)


			"""
			#/####################/#
			# Reshape the weigths
			#

			#Check
			if self.SynapsingWeigthSymbolStr!="":

				#debug
				'''
				self.debug(
					('self.',self,[
						'BrianedSynapsesVariable',
						'SynapsingWeigthSymbolStr'
						])
				)
				'''

				#connect
开发者ID:BinWang20140601,项目名称:ShareYourSystem,代码行数:70,代码来源:__init__+copy+4.py

示例7: _build_connections

# 需要导入模块: from brian2 import Synapses [as 别名]
# 或者: from brian2.Synapses import connect [as 别名]
    def _build_connections(self, traj, brian_list, network_dict):
        """Connects neuron groups `neurons_i` and `neurons_e`.

        Adds all connections to `brian_list` and adds a list of connections
        with the key 'connections' to the `network_dict`.

        """

        connections = traj.connections

        neurons_i = network_dict['neurons_i']
        neurons_e = network_dict['neurons_e']

        print('Connecting ii')
        self.conn_ii = Synapses(neurons_i,neurons_i, on_pre='y_i += %f' % connections.J_ii)
        self.conn_ii.connect('i != j', p=connections.p_ii)

        print('Connecting ei')
        self.conn_ei = Synapses(neurons_i,neurons_e, on_pre='y_i += %f' % connections.J_ei)
        self.conn_ei.connect('i != j', p=connections.p_ei)

        print('Connecting ie')
        self.conn_ie = Synapses(neurons_e,neurons_i, on_pre='y_e += %f' % connections.J_ie)
        self.conn_ie.connect('i != j', p=connections.p_ie)

        conns_list = [self.conn_ii, self.conn_ei, self.conn_ie]


        if connections.R_ee > 1.0:
            # If we come here we want to create clusters

            cluster_list=[]
            cluster_conns_list=[]
            model=traj.model

            # Compute the number of clusters
            clusters = int(model.N_e/connections.clustersize_e)
            traj.f_add_derived_parameter('connections.clusters', clusters, comment='Number of clusters')

            # Compute outgoing connection probability
            p_out = (connections.p_ee*model.N_e) / \
                    (connections.R_ee*connections.clustersize_e+model.N_e- connections.clustersize_e)

            # Compute within cluster connection probability
            p_in = p_out * connections.R_ee

            # We keep these derived parameters
            traj.f_add_derived_parameter('connections.p_ee_in', p_in ,
                                         comment='Connection prob within cluster')
            traj.f_add_derived_parameter('connections.p_ee_out', p_out ,
                                         comment='Connection prob to outside of cluster')


            low_index = 0
            high_index = connections.clustersize_e
            # Iterate through cluster and connect within clusters and to the rest of the neurons
            for irun in range(clusters):

                cluster = neurons_e[low_index:high_index]

                # Connections within cluster
                print('Connecting ee cluster #%d of %d' % (irun, clusters))
                conn = Synapses(cluster,cluster,
                                on_pre='y_e += %f' % (connections.J_ee*connections.strength_factor))
                conn.connect('i != j', p=p_in)
                cluster_conns_list.append(conn)

                # Connections reaching out from cluster
                # A cluster consists of `clustersize_e` neurons with consecutive indices.
                # So usually the outside world consists of two groups, neurons with lower
                # indices than the cluster indices, and neurons with higher indices.
                # Only the clusters at the index boundaries project to neurons with only either
                # lower or higher indices
                if low_index > 0:
                    rest_low = neurons_e[0:low_index]
                    print('Connecting cluster with other neurons of lower index')
                    low_conn = Synapses(cluster,rest_low,
                                on_pre='y_e += %f' % connections.J_ee)
                    low_conn.connect('i != j', p=p_out)

                    cluster_conns_list.append(low_conn)

                if high_index < model.N_e:
                    rest_high = neurons_e[high_index:model.N_e]
                    print('Connecting cluster with other neurons of higher index')

                    high_conn = Synapses(cluster,rest_high,
                                on_pre='y_e += %f' % connections.J_ee)
                    high_conn.connect('i != j', p=p_out)

                    cluster_conns_list.append(high_conn)

                low_index=high_index
                high_index+=connections.clustersize_e

            self.cluster_conns=cluster_conns_list
            conns_list+=cluster_conns_list
        else:
            # Here we don't cluster and connection probabilities are homogeneous
            print('Connectiong ee')
#.........这里部分代码省略.........
开发者ID:SmokinCaterpillar,项目名称:pypet,代码行数:103,代码来源:clusternet.py

示例8: CNConnections

# 需要导入模块: from brian2 import Synapses [as 别名]
# 或者: from brian2.Synapses import connect [as 别名]
class CNConnections(NetworkComponent):
    """Class to connect neuron groups.

    In case of no clustering `R_ee=1,0` there are 4 connection instances (i->i, i->e, e->i, e->e).

    Otherwise there are 3 + 3*N_c-2 connections with N_c the number of clusters
    (i->i, i->e, e->i, N_c conns within cluster, 2*N_c-2 connections from cluster to outside).

    """

    @staticmethod
    def add_parameters(traj):
        """Adds all neuron group parameters to `traj`."""
        assert(isinstance(traj,Trajectory))

        traj.v_standard_parameter = Brian2Parameter
        scale = traj.simulation.scale

        traj.f_add_parameter('connections.R_ee', 1.0, comment='Scaling factor for clustering')

        traj.f_add_parameter('connections.clustersize_e', 100, comment='Size of a cluster')
        traj.f_add_parameter('connections.strength_factor', 2.5,
                             comment='Factor for scaling cluster weights')

        traj.f_add_parameter('connections.p_ii', 0.25,
                            comment='Connection probability from inhibitory to inhibitory' )
        traj.f_add_parameter('connections.p_ei', 0.25,
                            comment='Connection probability from inhibitory to excitatory' )
        traj.f_add_parameter('connections.p_ie', 0.25,
                            comment='Connection probability from excitatory to inhibitory' )
        traj.f_add_parameter('connections.p_ee', 0.1,
                            comment='Connection probability from excitatory to excitatory' )

        traj.f_add_parameter('connections.J_ii', 0.027/np.sqrt(scale),
                             comment='Connection strength from inhibitory to inhibitory')
        traj.f_add_parameter('connections.J_ei', 0.032/np.sqrt(scale),
                             comment='Connection strength from inhibitory to excitatroy')
        traj.f_add_parameter('connections.J_ie', 0.009/np.sqrt(scale),
                             comment='Connection strength from excitatory to inhibitory')
        traj.f_add_parameter('connections.J_ee', 0.012/np.sqrt(scale),
                             comment='Connection strength from excitatory to excitatory')


    def pre_build(self, traj, brian_list, network_dict):
        """Pre-builds the connections.

        Pre-build is only performed if none of the
        relevant parameters is explored and the relevant neuron groups
        exist.

        :param traj: Trajectory container

        :param brian_list:

            List of objects passed to BRIAN network constructor.

            Adds:

            Connections, amount depends on clustering

        :param network_dict:

            Dictionary of elements shared among the components

            Expects:

            'neurons_i': Inhibitory neuron group

            'neurons_e': Excitatory neuron group

            Adds:

            Connections, amount depends on clustering

        """
        self._pre_build = not _explored_parameters_in_group(traj, traj.parameters.connections)

        self._pre_build = (self._pre_build and 'neurons_i' in network_dict and
                           'neurons_e' in network_dict)

        if self._pre_build:
            self._build_connections(traj, brian_list, network_dict)


    def build(self, traj, brian_list, network_dict):
        """Builds the connections.

        Build is only performed if connections have not
        been pre-build.

        :param traj: Trajectory container

        :param brian_list:

            List of objects passed to BRIAN network constructor.

            Adds:

            Connections, amount depends on clustering

#.........这里部分代码省略.........
开发者ID:SmokinCaterpillar,项目名称:pypet,代码行数:103,代码来源:clusternet.py

示例9: sim_decision_making_network

# 需要导入模块: from brian2 import Synapses [as 别名]
# 或者: from brian2.Synapses import connect [as 别名]

#.........这里部分代码省略.........
    # define the three excitatory subpopulations.
    # A: subpop receiving stimulus A
    excit_pop_A = NeuronGroup(N_Group_A, model=excit_lif_dynamics,
                              threshold="v>v_spike_thr_excit", reset="v=v_reset_excit",
                              refractory=t_abs_refract_excit, method="rk2")
    excit_pop_A.v = rnd.uniform(E_leak_excit / b2.mV, high=E_leak_excit / b2.mV + 5., size=excit_pop_A.N) * b2.mV

    # B: subpop receiving stimulus B
    excit_pop_B = NeuronGroup(N_Group_B, model=excit_lif_dynamics, threshold="v>v_spike_thr_excit",
                              reset="v=v_reset_excit", refractory=t_abs_refract_excit, method="rk2")
    excit_pop_B.v = rnd.uniform(E_leak_excit / b2.mV, high=E_leak_excit / b2.mV + 5., size=excit_pop_B.N) * b2.mV
    # Z: non-sensitive
    excit_pop_Z = NeuronGroup(N_Group_Z, model=excit_lif_dynamics,
                              threshold="v>v_spike_thr_excit", reset="v=v_reset_excit",
                              refractory=t_abs_refract_excit, method="rk2")
    excit_pop_Z.v = rnd.uniform(v_reset_excit / b2.mV, high=v_spike_thr_excit / b2.mV - 1., size=excit_pop_Z.N) * b2.mV

    # now define the connections:
    # projections FROM EXTERNAL POISSON GROUP: ####################################################
    poisson2Inhib = PoissonInput(target=inhib_pop, target_var="s_AMPA",
                                 N=N_extern, rate=firing_rate_extern, weight=w_ext2inhib)
    poisson2A = PoissonInput(target=excit_pop_A, target_var="s_AMPA",
                             N=N_extern, rate=firing_rate_extern, weight=w_ext2excit)

    poisson2B = PoissonInput(target=excit_pop_B, target_var="s_AMPA",
                             N=N_extern, rate=firing_rate_extern, weight=w_ext2excit)
    poisson2Z = PoissonInput(target=excit_pop_Z, target_var="s_AMPA",
                             N=N_extern, rate=firing_rate_extern, weight=w_ext2excit)

    ###############################################################################################

    # GABA projections FROM INHIBITORY population: ################################################
    syn_inhib2inhib = Synapses(inhib_pop, target=inhib_pop, on_pre="s_GABA += 1.0", delay=0.5 * b2.ms)
    syn_inhib2inhib.connect(p=1.)
    syn_inhib2A = Synapses(inhib_pop, target=excit_pop_A, on_pre="s_GABA += 1.0", delay=0.5 * b2.ms)
    syn_inhib2A.connect(p=1.)
    syn_inhib2B = Synapses(inhib_pop, target=excit_pop_B, on_pre="s_GABA += 1.0", delay=0.5 * b2.ms)
    syn_inhib2B.connect(p=1.)
    syn_inhib2Z = Synapses(inhib_pop, target=excit_pop_Z, on_pre="s_GABA += 1.0", delay=0.5 * b2.ms)
    syn_inhib2Z.connect(p=1.)
    ###############################################################################################

    # AMPA projections FROM EXCITATORY A: #########################################################
    syn_AMPA_A2A = Synapses(excit_pop_A, target=excit_pop_A, on_pre="s_AMPA += w_pos", delay=0.5 * b2.ms)
    syn_AMPA_A2A.connect(p=1.)
    syn_AMPA_A2B = Synapses(excit_pop_A, target=excit_pop_B, on_pre="s_AMPA += w_neg", delay=0.5 * b2.ms)
    syn_AMPA_A2B.connect(p=1.)
    syn_AMPA_A2Z = Synapses(excit_pop_A, target=excit_pop_Z, on_pre="s_AMPA += 1.0", delay=0.5 * b2.ms)
    syn_AMPA_A2Z.connect(p=1.)
    syn_AMPA_A2inhib = Synapses(excit_pop_A, target=inhib_pop, on_pre="s_AMPA += 1.0", delay=0.5 * b2.ms)
    syn_AMPA_A2inhib.connect(p=1.)
    ###############################################################################################

    # AMPA projections FROM EXCITATORY B: #########################################################
    syn_AMPA_B2A = Synapses(excit_pop_B, target=excit_pop_A, on_pre="s_AMPA += w_neg", delay=0.5 * b2.ms)
    syn_AMPA_B2A.connect(p=1.)
    syn_AMPA_B2B = Synapses(excit_pop_B, target=excit_pop_B, on_pre="s_AMPA += w_pos", delay=0.5 * b2.ms)
    syn_AMPA_B2B.connect(p=1.)
    syn_AMPA_B2Z = Synapses(excit_pop_B, target=excit_pop_Z, on_pre="s_AMPA += 1.0", delay=0.5 * b2.ms)
    syn_AMPA_B2Z.connect(p=1.)
    syn_AMPA_B2inhib = Synapses(excit_pop_B, target=inhib_pop, on_pre="s_AMPA += 1.0", delay=0.5 * b2.ms)
    syn_AMPA_B2inhib.connect(p=1.)
    ###############################################################################################

    # AMPA projections FROM EXCITATORY Z: #########################################################
    syn_AMPA_Z2A = Synapses(excit_pop_Z, target=excit_pop_A, on_pre="s_AMPA += 1.0", delay=0.5 * b2.ms)
开发者ID:accssharma,项目名称:neuronaldynamics-exercises,代码行数:70,代码来源:decision_making.py

示例10: BrianerClass

# 需要导入模块: from brian2 import Synapses [as 别名]
# 或者: from brian2.Synapses import connect [as 别名]

#.........这里部分代码省略.........
			'''

			#set
			self.BrianedParentInteractomeDeriveBrianerVariable=self.ParentDeriveTeamerVariable.ParentDeriveTeamerVariable

			#get
			self.BrianedParentNeurongroupDeriveBrianerVariable=self.BrianedParentInteractomeDeriveBrianerVariable.ParentDeriveTeamerVariable.ParentDeriveTeamerVariable

		else:

			#debug
			'''
			self.debug(
				[
					'There is no projectome structure'
				]
			)
			'''

			#get
			self.BrianedParentNeurongroupDeriveBrianerVariable=self.ParentDeriveTeamerVariable.ParentDeriveTeamerVariable

		#get
		self.BrianedParentNetworkDeriveBrianerVariable=self.BrianedParentNeurongroupDeriveBrianerVariable.BrianedParentNetworkDeriveBrianerVariable


		#/####################/#
		# Set the ConnectedTo Variable
		#

		#debug
		self.debug(
			[
				'Check if we have to get the connected to variable',
				('self.',self,['ConnectedToVariable'])
			]
		)

		#Check
		if self.ConnectedToVariable==None:

			#debug
			self.debug(
				[
					'We setConnection here'
				]
			)

			#setConnection
			self.setConnection(
				self.ManagementTagStr,
				self,
				self.BrianedParentNeurongroupDeriveBrianerVariable
			)

		#/####################/#
		# Set the BrianedParentNeurongroupDeriveBrianerVariable
		#

		#debug
		self.debug(
			[
				'Do we have to make parent-brian the connected variable ?',
				'self.ConnectedToVariable.BrianedNeurongroupVariable is ',
				str(self.ConnectedToVariable.BrianedNeurongroupVariable)
			]
开发者ID:BinWang20140601,项目名称:ShareYourSystem,代码行数:70,代码来源:__init__+copy+5.py


注:本文中的brian2.Synapses.connect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。