# Description of problem

Hi everyone, I am trying to give a time-dependent input to a population of neurons. I have the values I want to input previously stored in an array, which I use to create a TimedArray, but I am failing to run the simulation.
The code below is an attempt with an input of ones, to try and understand where the dimension mismatch error stems from.

# Minimal code to reproduce problem

``````# configure
dtime = 100
T = 1000
N = 5000
J = 1*br.Hz
br.start_scope()
br.defaultclock.dt = dtime*br.ms

# define external drive
drive = br.TimedArray(br.ones((int(T/dtime),N)),dt=dtime*br.ms)

# define equations
eqs='''
dphi/dt = omega_int + a_int*sin(phi) + coupl + drive(t,i)*Hz + sigma_int*xi : 1
coupl : hertz
drive : 1
omega_int : hertz
a_int : hertz
sigma_int : hertz**0.5
'''

# define population
neurons = br.NeuronGroup(N,eqs,threshold='sin(phi)>0.6',reset='',method='heun')
neurons.phi = 2*math.pi * br.np.random.uniform(size=N)
neurons.omega_int = 1*br.Hz
neurons.a_int = 1*br.Hz
neurons.sigma_int = 1*br.Hz**0.5
conn = br.Synapses(neurons,neurons,'coupl_post = J/N_pre*sin(phi_pre-phi_post) : hertz (summed)')
conn.connect(p=1)

br.run(T*br.ms)
``````

# What you have aready tried

Changing the units of measurement for “drive”, always getting a DimensionMismatchError

# Expected output (if relevant)

Simulation where “drive” is summed to the derivative of “phi”

# Actual output (if relevant)

DimensionMismatchError
Object was created here (most recent call only, full details in debug log):
File ‘/mnt/hubel-data-103/Pietro/Kur_Crit/brian_utils.py’, line 45, in simulate_Kuramoto
neurons = br.NeuronGroup(N,eqs,threshold=‘sin(phi)>0.6’,reset=‘’,method=‘heun’)

# Full traceback of error (if relevant)

Hi @pietro. I cannot reproduce the `DimensionMismatchError` with your script (I am getting “ValueError: ValueError: Function drive does not specify how it deals with units.”), but maybe you are not using version 2.7.1? In either case, I think the error is due to the fact that you define both a function/`TimedArray` named `drive`, and a neuronal variable of the same name (`drive : 1`). This is a bug in the sense that it should give a better error message, but removing `drive : 1` from your equations should make your example work.

1 Like