Skip to content

Commit

Permalink
Merge pull request #6 from PoisotLab/foodweb_evenness
Browse files Browse the repository at this point in the history
foodweb_diversity becomes foodweb_evenness
  • Loading branch information
Timothée Poisot authored Nov 2, 2016
2 parents baff0a0 + a8b55ba commit 3e43827
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/src/lib/public.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ BioEnergeticFoodWebs.save
population_stability
total_biomass
population_biomass
foodweb_diversity
foodweb_evenness
species_richness
species_persistence
```
2 changes: 1 addition & 1 deletion src/BioEnergeticFoodWebs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export trophic_rank,
population_stability,
total_biomass,
population_biomass,
foodweb_diversity,
foodweb_evenness,
species_richness,
species_persistence

Expand Down
2 changes: 1 addition & 1 deletion src/measures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/measures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 3e43827

Please sign in to comment.