Description of problem
I have a stimuli function which cannot be cast as a simple logical expression. I have interpolated it using scipy.interpolate.interp1d
to make a dimensionless interpolator object, say I(t)
. I wished Brian could handle this semi-explicit input, but apparently it doesn’t.
Is there a way to pass it to a neuron model? When I do so, even after multiplying the correct unit, I get the following error:
TypeError: Object of type <class 'scipy.interpolate._interpolate.interp1d'> does not have dimensions
As a follow-up, how can I do the same if I(t)
returns an N-dimensional array, where N is the size of the network? (The use case would be applying a non-uniform time-dependent input to a network).
Minimal code to reproduce problem
import numpy as np
import brian2 as b2
b2.start_scope()
model = """
dv/dt = -v + I(t) : 1
I: Hz
"""
N = 10
def stim(t):
return np.sin(t)*np.arange(N)
G = b2.NeuronGroup(N, model,)
G.I = stim*b2.Hz
Which returns
TypeError: Object of type <class 'function'> does not have dimensions
Thanks in advance for your help!
Best, Arash