FunctionImplementation class¶
(Shortest import: from brian2.core.functions import FunctionImplementation)
- class brian2.core.functions.FunctionImplementation(name=None, code=None, namespace=None, dependencies=None, availability_check=None, dynamic=False, compiler_kwds=None)[source]¶
Bases:
objectA simple container object for function implementations.
- Parameters
name : str, optional
The name of the function in the target language. Should only be specified if the function has to be renamed for the target language.
code : language-dependent, optional
A language dependent argument specifying the implementation in the target language, e.g. a code string or a dictionary of code strings.
namespace : dict-like, optional
A dictionary of mappings from names to values that should be added to the namespace of a
CodeObjectusing the function.dependencies : dict-like, optional
A mapping of names to
Functionobjects, for additional functions needed by this function.availability_check : callable, optional
A function that will be called to check whether the function should be made available (e.g. depending on whether it is supported by the compiler). The function should do nothing if the function is available, or raise a
NotImplementedErrorwith a message explaining why it isn’t.dynamic : bool, optional
Whether this
code/namespaceis dynamic, i.e. generated for each new context it is used in. If set toTrue,codeandnamespacehave to be callable with aGroupas an argument and are expected to return the finalcodeandnamespace. Defaults toFalse.
Methods
get_code(owner)get_namespace(owner)Details