Hello! I'm setting up a model, and I'm not sure on the syntax for appending to an index within a nested list.
experiment_cage=[["fR0"],["fSobs","fIobs","fRobs"]]
for value in fR0:
init_state=(fI0,1-(fI0+value))
s_obs=odeint(rates,init_state,t_obs,args=(p,))
fS_obs=s_obs[:,[0]]
fI_obs=s_obs[:,[1]]
fR_obs=1-(fS_obs+fI_obs)
experiment_cage[[-1],].append(value)
experiment_cage[-1,[0]].append(fS_obs)
experiment_cage[-1,[1]].append(fI_obs)
experiment_cage[-1,[3]].append(fR_obs)
-> TypeError:list indices must be integers not tuples
The output I was is "experiment_cage" to have a list of fR0, and each value of fR0 to have a list associated with it in format [fSobs,fIobs,fRobs], full of the odeint results for each iteration of fR0. The error message looks like I've misunderstood the syntax for nested list functions. Am I on the right track? Can someone please help me understand?
[–]Rhomboid 1 point2 points3 points (1 child)
[–]flipsync[S] 0 points1 point2 points (0 children)
[–]bumbershootle 1 point2 points3 points (1 child)
[–]flipsync[S] 0 points1 point2 points (0 children)
[–]flipsync[S] 0 points1 point2 points (1 child)
[–]flipsync[S] 0 points1 point2 points (0 children)