Docstrings

EcoNetPostProcessing.extract_last_timestepsMethod
extract_last_timesteps(solution; idxs = nothing, quiet = false, kwargs...)

Returns the biomass matrix of species x time over the last timesteps.

Arguments

  • last: the number of last timesteps to consider. A percentage can also be also be provided as a String ending by %. Defaulted to 1.
  • idxs: vector of species indexes or names. Set to nothing by default.
  • quiet: ignores warning issue while extracting timesteps before last species extinction

If idxs is an integer, it returns a vector of the species biomass instead of a matrix.

Examples

julia> fw = Foodweb([0 0; 1 0])
       m = default_model(fw)
       B0, t_end = [1, 1], 1_000
       sol = simulate(m, B0, t_end);

julia> last = extract_last_timesteps(sol; last = 1, idxs = [2, 1]);
       last ≈ sol.u[end][[2, 1]]
true

julia> last = extract_last_timesteps(sol; last = 1, idxs = ["s2", "s1"]);
       last ≈ sol.u[end][[2, 1]]
true

julia> last2 = extract_last_timesteps(sol; last = 1, idxs = [2])
       last2 ≈ sol.u[end][[2]]
true

julia> last2 = extract_last_timesteps(sol; last = 1, idxs = "s2")
       last2 ≈ sol.u[end][[2]]
true
source
EcoNetPostProcessing.get_alive_speciesMethod
get_alive_species(solution; idxs = nothing, threshold = 0)

Returns a tuple with species having a biomass above threshold at the end of a simulation.

Examples

julia> foodweb = Foodweb([0 0; 0 0]);
       m = default_model(foodweb);
       sol = simulate(m, [0, 0.5], 20; show_degenerated = false);
       get_alive_species(sol)
(species = [:s2], idxs = [2])

julia> sol = simulate(m, [0.5, 0], 20; show_degenerated = false);
       get_alive_species(sol)
(species = [:s1], idxs = [1])

julia> sol = simulate(m, [0.5, 0.5], 20; show_degenerated = false);
       get_alive_species(sol)
(species = [:s1, :s2], idxs = [1, 2])

julia> sol = simulate(m, [0, 0], 20; show_degenerated = false);
       get_alive_species(sol)
(species = Symbol[], idxs = Int64[])
source
EcoNetPostProcessing.get_dBdtMethod
get_dBdt(m::Model)

Generate the function returning the vector of species growth rate (dB/dt) given the vector of their biomass (B), given a Model from EcologicalNetworksDynamics.

The output is aimed to be passed to the jacobian function of ForwardDiff. For more information see ForwardDiff documentation.

See also jacobian.

source
EcoNetPostProcessing.get_interactionMethod
get_interaction(m::Model, B::AbstractVector)

Compute the interaction of the model m. Because interactions are density-dependent, the vectory of species biomass B should be specified. A[i, j] is the interaction from species j to species i, and is formally defined as the derivative of the per capita growth of species i with respect to variation in biomass of species j. See Novak et al. 2016.

See also sensitivity.

source
EcoNetPostProcessing.get_pgrMethod
get_pgr(m::Model)

Generate the function returning the vector of species per capita growth rate (1/B x dB/dt) given the vector of their biomass (B), given a Model from EcologicalNetworksDynamics.

See also sensitivity.

source
EcoNetPostProcessing.keystonenessMethod
keystoneness(m::Model, B::AbstractVector)

Compute species keystoneness from a given model m at the point given by the vector of species biomass B. Most of the time B should be the vector of species equilibrium biomass. Keystoneness of species i is defined as the sum abs(S[i, j]) for j different from i. It quantifies how a change in the growth rate of species i impacts all other species.

For a formal definition see Li et al. 2025.

See also sensitivity.

source
EcoNetPostProcessing.resistanceMethod
resistance(m::Model, B::AbstractVector; response_of = :all, perturbation_on = :all, aggregated = false)

Compute the resistance of species or the entire community to a press disturbance (such as an increase in mortality). Resistance computation is based on the sensitivity matrix. To get resistance computed from simulated dynamics use resistance_simulation.

Main arguments

  • m specifies the dynamical model.
  • B is the vector of species equilibrium biomass.

Keyword arguments

  • response_of the response_of which species is measured, by default set to :all.
  • perturbation_on which species is affected by the press, by default set to :all.
  • agregated if true return the resistance on the species selected by response_of, can be used typically to compute the resistance at the community level. By default set to false, so that resistance is evaluated at the species level.

See also sensitivity.

source
EcoNetPostProcessing.resistance_simulationMethod
resistance_simulation(
m::Model,
B::AbstractVector;
mortality_increment::AbstractVector = fill(0.1, m.richness),
response_of = :all,
aggregated = false,
normalized = true,

)

Compute the resistance of species or group of species to a mortality increase. Resistance is computed from simulation outputs. For analytical computation see resistance. For small mortality_increment values both function should be equivalent.

Resistance is defined as the change in biomass relative to the mortality increment, when normalized is true. When normalized is false, the absolute change in biomass is returned.

When aggregated is set to true, the total change in biomass is computed, and is normalized by the mean mortality increment.

Note that if normalized is true and the mortality increment of species is set to 0, its resistance value will be set to :undefined because of division by 0. To bypass this behaviour, set :normalized to false, and then use the normalization of your choice on the output.

Main arguments

  • m specifies the dynamical model.
  • B is the vector of species equilibrium biomass.

Keyword arguments

  • response_of the response_of which species is measured, by default set to :all.
  • mortality_increment vector which species the increase in mortality rate for each species.
  • agggregated if true return the resistance on the species selected by response_of, can be used typically to compute the resistance at the community level. By default set to false, so that resistance is evaluated at the species level.
  • normalized is the change in biomass normalized by the mortality increment. By default set to true.

See also sensitivity.

source
EcoNetPostProcessing.robustnessMethod
robustness(m::Model; t_end = 1_000, n_rep = 100, threshold = 1e-6)

Compute the community robustness. Robustness is defined as the inverse of the number of secondary extinctions. The number of average number of secondary extinctions is averaged over n_rep random extinction sequences. Each extinction sequences set the order of species extinction, and terminate when all species are extinct.

Main argument

  • m specifies the community.

Keyword arguemnts

  • t_end simulation duration (default to 1_000)
  • n_rep number of extinction sequences (default to 100)
  • threshold biomass value under which species are considered extinct (default to 1e-6)

See also secondary_extinctions.

source
EcoNetPostProcessing.secondary_extinctionsMethod
secondary_extinctions(
m::Model,
extinct_sp::Integer,
B_start::AbstractVector;
t_end = 1_000,
threshold = 1e-6,

)

Compute secondary extinctions following the primary extinction of extinct_sp of a model m with initial biomasses B_start.

Keyword arguments

  • t_end specifies the duration of simulation
  • threshold gives the biomass below which a species is considered extinct.

See also robustness.

source
EcoNetPostProcessing.sensitivityMethod
sensitivity(m::Model, B::AbstractVector)

Compute the sensitivity matrix of the model m. Because interactions are density-dependent, the vectory of species biomass B should be specified. The sensitivity matrix is defined as the inverse of the interaction matrix. See Novak et al. 2016.

source
ForwardDiff.jacobianMethod
jacobian(m::Model, B::AbstractVector)

Compute the jacobian of the system specied by the model B. The jacobian is evaluated in B which gives species biomass.

source