Comments (6)
It would be nice if codegen targets could create extra keyword arguments in Brian itself to cover this sort of thing. What do you think @mstimberg?
from brian2genn.
+1 for extra keyword arguments per Synapse / Group objects :)
from brian2genn.
Some more fine-grained control would be definitely nice, I also briefly discussed this with @moritzaugustin last week. The problem that I'm seeing is to not mix device-specific details and the model itself too much. The nice thing about our current device implementation is that most of the time you'll set a bunch of preferences and device settings in the beginning, but all the rest of the model is independent of the device and does not need any changes if you change the device. Having something like Synapses(..., span_type='pre')
would go against this. While we could avoid errors when switching the device by simply passing on all unknown keyword arguments to a device, and silently ignoring unknown keyword arguments on the device, I think this would still not be great for two reasons:
- A typo in a keyword argument (say,
onpre=...
instead ofon_pre=...
) would be quietly ignored. - Users reading a code using such a keyword argument might be confused because the Brian 2 documentation does not mention the argument.
I think we only have two options, both with their advantages and disadvantages:
- Use the preference, but have it accept a dictionary of names and strategies, e.g. something like
Of course this will be more meaningful/readable when assigning names manually, or writing something like:
devices.genn.synapse_span_type = {'synapses': 'pre', 'synapses_1': 'post'}
(or just using the object references instead of their name)devices.genn.synapse_span_type = {exc_syn.name: 'pre', inh_syn.name: 'post'}
- Use a generic
device_options
argument for main classes such asNeuronGroup
,Synapses
and maybeSpikeMonitor
andStateMonitor
that takes a dictionary. Keys that a device does not know about will be ignored (maybe with a warning as we do forset_device
/build
):syn = Synapses(..., device_options={'span_type': 'pre'})
The advantage of solution 1 is that it separates the device settings from the main model code, but it needs you to make use of Python's naming (or mix it in with the model code again), which most users are not really aware of. I think I prefer option 2, even though it mixes model and device implementations a bit – given that it is named device_options
, I think this should at least be clear to the user.
from brian2genn.
Yes, it is a bit of a difficult construct and I also liked the clean separation of model and device-specific information. But on the other hand I would struggle to use version 1 (get the naming sorted) and I also think it would be somewhat difficult for users to keep it in check when scripts get longer and one has to change the spantype on top when introducing or changing the synapse group somewhere else.
So my preference would be the second option.
from brian2genn.
I also like option 2 (now) as overall user convenience seems higher. Moreover, devices still can offer global prefs (e.g. in your case span_type) that apply to all synaptic pathways at once, which for simple structured models still allows clear abstraction of device and model specification within option 2.
from brian2genn.
This could be revisited within GSoC2021.
from brian2genn.
Related Issues (20)
- Question: How to work around restriction of synaptic output variable or summed variable? HOT 4
- Cannot open include file: 'brianlib/stdint_compat.h from clocks.h HOT 22
- Building genn executable fails after a certain number of successful runs when parameter fitting HOT 12
- Workaround for network-operation? HOT 30
- Use GeNN's new run_regularly mechanisms for run_regularly statements
- Use GeNN's initvar snippets for synapse creation
- Brian2genn model build is completed, but system cannot find the path specified HOT 17
- RuntimeError: Project compilation failed HOT 2
- Undeclared Identifier Error for Multiple Runs HOT 6
- potential problem with handling of build_options
- Custom header files are missing when used in `device.insert_code` calls HOT 1
- C99 math functions fail on integer type arguments HOT 18
- Inaccurate updates when having multiple differential equations in neuron groups HOT 3
- StateMonitor fails to collect data from some Synapses HOT 3
- use individually named dir instead of GeNNworkspace HOT 1
- [Feature request] Support for slower clocks in Monitors HOT 3
- RNG & seeding HOT 4
- SpikeGenerator problem HOT 2
- Error code 50 HOT 3
- Failed to build, error: ‘spikeCount_neurongroup’ was not declared in this scope HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from brian2genn.