Hi @schmitts . When you use neuron.a = ... you perform an initialization at the beginning of the simulation. This evaluates to False (or rather 0 – you don’t need to put int around it when you use a boolean variable, though). It will not be executed during the simulation. Otherwise, writing something like neuron.v = 'E_L + rand()*10*mV' at the beginning of your simulation would screw up your results quite badly
If you want to update a continuously, you’d need to use
Thanks. As a followup question. What do you suggest to use for time dependend stimulus that also depends on the compartment? For a NeuronGroup I would probably use a 2D TimedArray. But for a multi-compartment neuron I’m less sure about the correct indexing. I would prefer to express it more explicitely: neuron.dendrite = ... to set up the stimulus, but as I’ve re-learned this would get evaluated too early.
So if each compartment should have its own stimulus, then I’d use the index i and create the 2D TimedArray with the columns for each compartment in the correct way. But I guess you might instead have only a few different stimuli. I’d then put these into a TimedArray and for convenience also a “stimulus” that is 0 for all the compartments that shouldn’t receive any stimulus. Then, you’d add an integer variable to your model
eqs = '''... stimulus_idx : integer (constant)'''
and refer to that index with stimulus(t, stimulus_idx), with stimulus being the name of the TimedArray. You can then quite intuitively set the stimulus for certain compartments, e.g.:
# Soma gets stimulus type 1 (note the .main to only refer to the soma):
neuron.main.stimulus_idx = 1
# Single dendrite compartment gets stimulus 2:
neuron.dendrite.stimulus_idx = 2
# All other compartments get stimulus 0
Oh no The actual error is the compilation error, there seems to be an issue with SpatialNeuron, functions like TimedArray and Cython… The details are a bit tricky to explain, but I think I have a basic idea what went wrong. You should be able to use prefs.codegen.target = 'numpy' to use Python code generation or set_device('cpp_standalone') to use C++ standalone mode as a workaround for now.