# TimedArray DimensionMismatchError

**URL:** <https://brian.discourse.group/t/timedarray-dimensionmismatcherror/1257>\
**Category:** Support\
**Created:** [15 July 2024 14:15 UTC](https://brian.discourse.group/t/timedarray-dimensionmismatcherror/1257 "2024-07-15T14:15:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pietro](https://avatars.discourse-cdn.com/v4/letter/p/47e85d/32.png) [@pietro](https://brian.discourse.group/u/pietro)\
**Post date:** [15 July 2024 14:15 UTC](https://brian.discourse.group/t/timedarray-dimensionmismatcherror/1257/1 "2024-07-15T14:15:21Z")

</div>

# 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

```auto
# 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)

---

<div class="post-metadata">

**Author:** ![mstimberg](https://yyz2.discourse-cdn.com/free1/user_avatar/brian.discourse.group/mstimberg/32/11_2.png) [@mstimberg](https://brian.discourse.group/u/mstimberg)\
**Post date:** [15 July 2024 19:54 UTC](https://brian.discourse.group/t/timedarray-dimensionmismatcherror/1257/2 "2024-07-15T19:54:53Z")

</div>

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.
