euba/BacArena

More individuals than space on the grid error

wtscott31 opened this issue · 3 comments

Hi all,

I keep getting an error (Error: 'More individuals than space on the grid error') when I attempt to run simulations for S. enterica and E. coli models to replicate a coculture. I think the error stems from my use of the mat or postmat. However, it is unclear, based on the documentation, where the actual problem lies. Can anyone please help me?

See the following:
arena <- Arena(Lx = 0.05, Ly = 0.05, n=25, m=25, tstep = 1)
mat1 <- matrix(sample(c(0,1), 625, replace = TRUE), nrow = 25, ncol = 25)
mat2 <- matrix(sample(c(5,5), 625, replace = TRUE), nrow = 25, ncol = 25)
arena <- addOrg(arena,bac1,amount=5, posmat = mat1, biomass = 300000000)
arena <- addOrg(arena,bac2,amount=5, posmat = mat2, biomass = 5000000000)

hi @wtscott31
Sorry for the delayed response!
The problem is that the second matrix (mat2) is ill-defined. As input, the number 1 is aspected for each position. Also, amount and posmat are exclusive. I added error messages to improve debugging!
Thank you for reporting the issue.

Hi, @jotech; thanks for your reply and suggestion.

I made some changes to my script based on your comments. However, I still get the 'More individuals than space on the grid error.' Could you please include a few pointers on how to use posmat in future versions of the documentation? This would help users such as myself.

what about:

library(BacArena)
data(Ec_core)
bac1 <- Bac(Ec_core)
arena <- Arena(Lx = 0.05, Ly = 0.05, n=25, m=25, tstep = 1)
mat1 <- matrix(sample(c(0,1), 625, replace = TRUE), nrow = 25, ncol = 25)
arena <- addOrg(arena,bac1, posmat = mat1, biomass = 300000000)