examples/example_24_large_scale_brian2_simulation/clusternet.py
def add_parameters(traj):
        """Adds all neuron group parameters to `traj`."""
        assert(isinstance(traj,Trajectory))

        scale = traj.simulation.scale


        traj.v_standard_parameter = Brian2Parameter

        model_eqs = '''dV/dt= 1.0/tau_POST * (mu - V) + I_syn : 1
                       mu : 1
                       I_syn =  - I_syn_i + I_syn_e : Hz
                    '''

        conn_eqs = '''I_syn_PRE = x_PRE/(tau2_PRE-tau1_PRE) : Hz
                      dx_PRE/dt = -(normalization_PRE*y_PRE+x_PRE)*invtau1_PRE : 1
                      dy_PRE/dt = -y_PRE*invtau2_PRE : 1
                   '''

        traj.f_add_parameter('model.eqs', model_eqs,
                           comment='The differential equation for the neuron model')

        traj.f_add_parameter('model.synaptic.eqs', conn_eqs,
                           comment='The differential equation for the synapses. '
                                   'PRE will be replaced by `i` or `e` depending '
                                   'on the source population')

        traj.f_add_parameter('model.synaptic.tau1', 1*ms, comment = 'The decay time')
        traj.f_add_parameter('model.synaptic.tau2_e', 3*ms, comment = 'The rise time, excitatory')
        traj.f_add_parameter('model.synaptic.tau2_i', 2*ms, comment = 'The rise time, inhibitory')

        traj.f_add_parameter('model.V_th', 'V >= 1.0', comment = "Threshold value")
        traj.f_add_parameter('model.reset_func', 'V=0.0',
                             comment = "String representation of reset function")
        traj.f_add_parameter('model.refractory', 5*ms, comment = "Absolute refractory period")

        traj.f_add_parameter('model.N_e', int(2000*scale), comment = "Amount of excitatory neurons")
        traj.f_add_parameter('model.N_i', int(500*scale), comment = "Amount of inhibitory neurons")

        traj.f_add_parameter('model.tau_e', 15*ms, comment = "Membrane time constant, excitatory")
        traj.f_add_parameter('model.tau_i', 10*ms, comment = "Membrane time constant, inhibitory")

        traj.f_add_parameter('model.mu_e_min', 1.1, comment = "Lower bound for bias, excitatory")
        traj.f_add_parameter('model.mu_e_max', 1.2, comment = "Upper bound for bias, excitatory")

        traj.f_add_parameter('model.mu_i_min', 1.0, comment = "Lower bound for bias, inhibitory")
        traj.f_add_parameter('model.mu_i_max', 1.05, comment = "Upper bound for bias, inhibitory")
def add_parameters(traj):
        """Adds all neuron group parameters to `traj`."""
        assert(isinstance(traj,Trajectory))

        scale = traj.simulation.scale


        traj.v_standard_parameter = Brian2Parameter

        model_eqs = '''dV/dt= 1.0/tau_POST * (mu - V) + I_syn : 1
                       mu : 1
                       I_syn =  - I_syn_i + I_syn_e : Hz
                    '''

        conn_eqs = '''I_syn_PRE = x_PRE/(tau2_PRE-tau1_PRE) : Hz
                      dx_PRE/dt = -(normalization_PRE*y_PRE+x_PRE)*invtau1_PRE : 1
                      dy_PRE/dt = -y_PRE*invtau2_PRE : 1
                   '''

        traj.f_add_parameter('model.eqs', model_eqs,
                           comment='The differential equation for the neuron model')

        traj.f_add_parameter('model.synaptic.eqs', conn_eqs,
                           comment='The differential equation for the synapses. '
                                   'PRE will be replaced by `i` or `e` depending '
                                   'on the source population')

        traj.f_add_parameter('model.synaptic.tau1', 1*ms, comment = 'The decay time')
        traj.f_add_parameter('model.synaptic.tau2_e', 3*ms, comment = 'The rise time, excitatory')
        traj.f_add_parameter('model.synaptic.tau2_i', 2*ms, comment = 'The rise time, inhibitory')

        traj.f_add_parameter('model.V_th', 'V >= 1.0', comment = "Threshold value")
        traj.f_add_parameter('model.reset_func', 'V=0.0',
                             comment = "String representation of reset function")
        traj.f_add_parameter('model.refractory', 5*ms, comment = "Absolute refractory period")

        traj.f_add_parameter('model.N_e', int(2000*scale), comment = "Amount of excitatory neurons")
        traj.f_add_parameter('model.N_i', int(500*scale), comment = "Amount of inhibitory neurons")

        traj.f_add_parameter('model.tau_e', 15*ms, comment = "Membrane time constant, excitatory")
        traj.f_add_parameter('model.tau_i', 10*ms, comment = "Membrane time constant, inhibitory")

        traj.f_add_parameter('model.mu_e_min', 1.1, comment = "Lower bound for bias, excitatory")
        traj.f_add_parameter('model.mu_e_max', 1.2, comment = "Upper bound for bias, excitatory")

        traj.f_add_parameter('model.mu_i_min', 1.0, comment = "Lower bound for bias, inhibitory")
        traj.f_add_parameter('model.mu_i_max', 1.05, comment = "Upper bound for bias, inhibitory")
Adds all neuron group parameters to `traj`.