Example #1
0
    def __init__(self,
                 parameters="",
                 equations="",
                 psp=None,
                 pre_spike=None,
                 post_spike=None,
                 functions=None,
                 name=None,
                 description=None,
                 extra_values={}):
        """ 
        *Parameters*:
        
            * **parameters**: parameters of the neuron and their initial value.
            * **equations**: equations defining the temporal evolution of variables.
            * **psp**: post-synaptic potential summed by the post-synaptic neuron.
            * **pre_spike**: updating of variables when a pre-synaptic spike is received.
            * **post_spike**: updating of variables when a post-synaptic spike is emitted.
            * **functions**: additional functions used in the variables' equations.

        """
        _warning(
            "The use of RateSynapse or SpikeSynapse is deprecated, use Synapse instead."
        )
        Synapse.__init__(self,
                         parameters=parameters,
                         equations=equations,
                         psp=psp,
                         pre_spike=pre_spike,
                         post_spike=post_spike,
                         functions=functions,
                         name=name,
                         description=description,
                         extra_values=extra_values)
Example #2
0
    def __init__(self, parameters="", equations="", functions=None, name="", description="", extra_values={}):
        """        
        *Parameters*:
        
            * **parameters**: parameters of the neuron and their initial value.
            * **equations**: equations defining the temporal evolution of variables.
            * **functions**: additional functions used in the variables' equations.

        """
        _warning("The use of RateNeuron or SpikeNeuron is deprecated, use Neuron instead.")
        Neuron.__init__(self, parameters=parameters, equations=equations, functions=functions, name=name, description=description, extra_values=extra_values)
Example #3
0
    def __init__(self, parameters="", equations="", psp=None, functions=None, name=None, description=None, extra_values={}):
        """ 
        *Parameters*:
        
            * **parameters**: parameters of the neuron and their initial value.
            * **equations**: equations defining the temporal evolution of variables.
            * **psp**: post-synaptic potential summed by the post-synaptic neuron.
            * **functions**: additional functions used in the variables' equations.

        """         
        _warning("The use of RateSynapse or SpikeSynapse is deprecated, use Synapse instead.")
        Synapse.__init__(self, parameters=parameters, equations=equations, psp=psp, functions=functions, name=name, description=description, extra_values=extra_values)
Example #4
0
    def __init__(self, parameters="", equations="", spike=None, reset=None, refractory = None, functions=None, name="", description="", extra_values={} ):
        """         
        *Parameters*:
        
            * **parameters**: parameters of the neuron and their initial value.
            * **equations**: equations defining the temporal evolution of variables.
            * **functions**: additional functions used in the variables' equations.                
            * **spike**: condition to emit a spike.
            * **reset**: changes to the variables after a spike                    
            * **refractory**: refractory period of a neuron after a spike.

        """
        _warning("The use of RateNeuron or SpikeNeuron is deprecated, use Neuron instead.")
        Neuron.__init__(self, parameters=parameters, equations=equations, functions=functions, spike=spike, reset=reset, refractory=refractory, name=name, description=description, extra_values=extra_values)
Example #5
0
def find_method(variable):

    if 'implicit' in variable['flags']:
        method = 'implicit'
    elif 'semiimplicit' in variable['flags']:
        method = 'semiimplicit'
    elif 'exponential' in variable['flags']:
        method = 'exponential'
    elif 'midpoint' in variable['flags']:
        method = 'midpoint'
    elif 'explicit' in variable['flags']:
        method = 'explicit'
    elif 'exact' in variable['flags']:
        _warning('The "exact" flag should now be replaced by "event-driven". It will stop being valid in a future release.')
        method = 'event-driven'
    elif 'event-driven' in variable['flags']:
        method = 'event-driven'
    else:
        method= config['method']

    return method
Example #6
0
def _analyse_equation(orig, eq, local_dict, tex_dict):

    left = eq.split('=')[0]
    if left[-1] in ['+', '-', '*', '/']:
        op = left[-1]
        try:
            left = _analyse_part(left[:-1], local_dict, tex_dict)
        except Exception as e:
            _print(e)
            _warning('can not transform the left side of ' + orig +' to LaTeX, you have to do it by hand...')
            left = left[:-1]
        operator = " = " + left +  " " + op + (" (" if op != '+' else '')
    else:
        try:
            left = _analyse_part(left, local_dict, tex_dict)
        except Exception as e:
            _print(e)
            _warning('can not transform the left side of ' + orig +' to LaTeX, you have to do it by hand...')
        operator = " = "
    try:
        right = _analyse_part(eq.split('=')[1], local_dict, tex_dict)
    except Exception as e:
        _print(e)
        _warning('can not transform the right side of ' + orig +' to LaTeX, you have to do it by hand...')
        right = eq.split('=')[1]

    return left + operator + right + (" )" if operator.endswith('(') else "")
Example #7
0
def find_method(variable):

    if 'implicit' in variable['flags']:
        method = 'implicit'
    elif 'semiimplicit' in variable['flags']:
        method = 'semiimplicit'
    elif 'exponential' in variable['flags']:
        method = 'exponential'
    elif 'midpoint' in variable['flags']:
        method = 'midpoint'
    elif 'explicit' in variable['flags']:
        method = 'explicit'
    elif 'exact' in variable['flags']:
        _warning(
            'The "exact" flag should now be replaced by "event-driven". It will stop being valid in a future release.'
        )
        method = 'event-driven'
    elif 'event-driven' in variable['flags']:
        method = 'event-driven'
    else:
        method = config['method']

    return method