Skip to content

Instantly share code, notes, and snippets.

@evadelmas
evadelmas / extinction_perturbation.jl
Last active March 11, 2021 23:13
Basics of extinction cascades simulation following either primary extinction or perturbation - with the BioEnergeticFoodWebs.jl model
#=
Modifying biomass values "during" simulation
This Gist show how to
- initialize the BEFWm with a food web and your choice of parameters
- run a burn-in to remove structurally doomed species (to avoid detecting them as false secondary extinctions)
- target a species for primary extinction or perturbation
- run the model
- detect secondary extinctions / measure things
=#
@evadelmas
evadelmas / robustness.jl
Last active March 4, 2021 18:59
Robustness analysis with the BioEnergeticFoodWebs model: Calculate R50 -- number of primary extinctions necessary to remove 50% of the species in a community
using BioEnergeticFoodWebs, Random
#=
Status `~/.julia/environments/v1.3/Project.toml`
[9b49b652] BioEnergeticFoodWebs v1.2.0
[9a3f8284] Random
=#
Random.seed!(5436)
A = nichemodel(100,0.2)
A = convert(Array{Int64, 2}, A)