I am working with a network of excitatory pyramidal (PYR) and inhibitory (PVN) neurons. The model is working fine. But I wish to additionally measure the average membrane potential of the PYR group as a surrogate for estimating field potential fluctuations. I added one line of code:
PYRvoltage_average = np.mean(PYR_v, axis=0)
But despite reading up on this for awhile, I continue to get error messages. I appreciate any help solving this problem
Minimal code to reproduce problem
PYR_v = StateMonitor(PYR,'v',record = True)
PYRvoltage_average = np.mean(PYR_v, axis=0)
Full traceback of error
TypeError Traceback (most recent call last)
Cell In[247], line 53
50 PYRspike_data.to_csv('PYRspikedata.csv', index=False)
51 #PYRvoltage_data=PYR_v.v
52 #np.save('PYRvoltage_data.npy',PYRvoltage_data)
---> 53 PYRvoltage_average = np.mean(PYR_v, axis=0)
File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\numpy\core\fromnumeric.py:3504, in mean(a, axis, dtype, out, keepdims, where)
3501 else:
3502 return mean(axis=axis, dtype=dtype, out=out, **kwargs)
-> 3504 return _methods._mean(a, axis=axis, dtype=dtype,
3505 out=out, **kwargs)
File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\numpy\core\_methods.py:118, in _mean(a, axis, dtype, out, keepdims, where)
115 dtype = mu.dtype('f4')
116 is_float16_result = True
--> 118 ret = umr_sum(arr, axis, dtype, out, keepdims, where=where)
119 if isinstance(ret, mu.ndarray):
120 with _no_nep50_warning():
TypeError: unsupported operand type(s) for +: 'StateMonitorView' and 'StateMonitorView'