Hi Adam, there’s some basic documentation here: Functions — Brian 2 2.4.2 documentation
Were it gets complicated is when you want this function to change things in model variables instead of simply returning a value. If this is in C++ standalone mode, you can make use of the fact that all variables are stored in globally available arrays and that you can get their names with something like device.get_array_name(neurongroup.variables['V'])
. There is a discussion thread that should give some more hints: User-defined functions
Let me know if you run into issues, this part of Brian still needs quite a bit of polishing.
2 Likes