The structure of my code is as follows:
with open('an.text', 'w') as f1:
Nstep1 =10
l2=linspace(0.01,1,Nstep1)
for l in range(Nstep1):
kappa1 = linspace(0.01, 0.4, Nstep1)
for k0 in range(Nstep1):
Nstep=10
VEP = zeros((Nstep1,Nstep1,Nstep))
g1 = linspace(0.01, 0.3, Nstep)
for j in range(Nstep):
#someexpression or calling functions....
res = minimize(EP,(x0),args=CM,bounds=bnds)
VEP[l,k0,j] = res.fun
# optimising over j only
j = unravel_index(argmin(ma.masked_where(VEP==0, VEP)),VEP.shape)
f1.write("%s %s %s %srnn" %(l2[l],kappa1[k0], g1[j],VEP[l,k0,j]))
#f1.write("%s %s %s %srnn" %(l2[l],kappa1[k0], g1[j],VEP[:,:,j]))
I got an error there about the indices. How shall I do that? Thanks
2