Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporal matrices are identical and ignore extinctions when there is no rewiring #104

Open
SimmonsBI opened this issue Jul 9, 2020 · 0 comments

Comments

@SimmonsBI
Copy link
Collaborator

Elements of output[:p][:tmpA] are all identical when rewire_method = :none in simulate().

Elements of :tmpA should be updated to remove extinct species. e.g. by updating the A matrix as in the below code after each extinction:

extinct = out[:p][:extinctions] 
tokeep = trues(S)
tokeep[extinct] .= false 
A_i = out[:p][:A]
A_eq = A_i[tokeep, tokeep]

Example:

# Load packages
using BioEnergeticFoodWebs
using EcologicalNetworks

import Random.seed!
seed!(123)

siz = 10
con = 0.2
zed = 10.0
A_bool = EcologicalNetworks.nichemodel(siz, con) #use the niche model from Ecological Network to generate food webs
A = Int.(A_bool.A) #convert the UnipartiteNetwork object to Matrix of 1s and 0s
bm = ones(size(A, 1)) # assign biomasses of 1
p = model_parameters(A, Z = zed, rewire_method = :none)
out = simulate(p, bm, start=0, stop=500) 
out[:p][:tmpA][1] == out[:p][:tmpA][4] # true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant