diff --git a/docs/src/lib/public.md b/docs/src/lib/public.md index a1efb3b..9b7cbf1 100644 --- a/docs/src/lib/public.md +++ b/docs/src/lib/public.md @@ -41,7 +41,7 @@ BioEnergeticFoodWebs.save population_stability total_biomass population_biomass -foodweb_diversity +foodweb_evenness species_richness species_persistence ``` diff --git a/src/BioEnergeticFoodWebs.jl b/src/BioEnergeticFoodWebs.jl index ff947ad..af39ed3 100644 --- a/src/BioEnergeticFoodWebs.jl +++ b/src/BioEnergeticFoodWebs.jl @@ -12,7 +12,7 @@ export trophic_rank, population_stability, total_biomass, population_biomass, - foodweb_diversity, + foodweb_evenness, species_richness, species_persistence diff --git a/src/measures.jl b/src/measures.jl index 38884c4..366a349 100644 --- a/src/measures.jl +++ b/src/measures.jl @@ -118,7 +118,7 @@ species) over the last `last` timesteps. Values close to 1 indicate that all populations have equal biomasses. """ -function foodweb_diversity(p; last=1000) +function foodweb_evenness(p; last=1000) @assert last <= size(p[:B], 1) measure_on = p[:B][end-(last-1):end,:] if sum(measure_on) == 0 diff --git a/test/measures.jl b/test/measures.jl index c53a1be..2876512 100644 --- a/test/measures.jl +++ b/test/measures.jl @@ -34,12 +34,12 @@ module TestMeasures @test_approx_eq_eps population_stability(s, last=2) -1.59099 0.01 @test species_richness(s, last=1) == 1.0 @test species_persistence(s, last=1) == 0.1 - + # Test when the total biomass is 0 empty_p = Dict{Symbol, Any}(:B => zeros(10, 10)) @test isnan(population_biomass(empty_p, last=2)) @test isnan(population_stability(empty_p, last=2)) @test isnan(total_biomass(empty_p, last=2)) - @test isnan(foodweb_diversity(empty_p, last=2)) + @test isnan(foodweb_evenness(empty_p, last=2)) end