Hi,
My name is Yuval and I just started to work with gyrus!
I’m having some difficulties and I was hoping to get some help.
I’m attaching the next simple code, which is trying to calculate some value that depends on gyrus.stimuli (let’s call the stimuli q_hat
)
q = np.array([-0.69066467, -0.20034368, 0.28437363, 0.00342465, 0.10304996], dtype='float')
def calc(q_hat):
J = np.zeros((1))
#J = gyrus.stimuli(np.zeros((1)))
**J[0] = np.sin(q_hat)**
return J[0]
def gyrus_calc(q_hat, dt, synapse=None):
return q_hat.integrate_fold(
integrand=lambda q_hat: dt * calc(q_hat) / 1e-3,
synapse=synapse,
)
op = gyrus_calc(
q_hat=gyrus.stimuli(np.zeros_like(q)),
dt=0.05,
).filter(0.2)
But when trying to assign np.sin(q_hat)
to np.array
I get the error:
----> 6 J[0] = np.sin(q_hat)
ValueError: setting an array element with a sequence.
I assumed that’s because np.sin(q_hat)'
s type is <class 'gyrus.base.Fold'>
So I’ve tried to make J the same type (by losing the comment in the code)
but then I got the following error:
TypeError: 'Fold' object does not support item assignment
So my question is, how do I assign a value like np.sin(q_hat)
to something like J[0]
?
Thanks and very nice tool!
Yuval