Skip to content

Commit aaca49f

Browse files
committed
🐛 this is robustness AFAIK
1 parent 110b28d commit aaca49f

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

‎src/lib/robustness.jl‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@ function robustness(Ns::Vector{T}; threshold::Int = 50) where {T<:SpeciesInterac
88
init_rich = richness(Ns[1])
99

1010
# threshold richness
11+
# threshold = X% of original size of network
1112
thresh_rich = floor(Int, threshold / 100 * init_rich)
1213

13-
# get first index in network series that is equal to or less than e50
14+
# get first index in network series that is equal to or less than threshold richness
15+
# this is effectively the number of primary extinctions since each element = 1 primary extinction
1416
net_in = findfirst(x -> x <= thresh_rich, richness.(Ns))
1517

16-
# cummulative number of extinctions
17-
T_p = init_rich - richness.(Ns)[net_in]
18+
# we subtract 1 since 1st network in series is the OG network (no extinctions)
19+
primary = net_in - 1
1820

19-
# return prop of primary extinctions as total number primary extinctions (length Ns - 1)
20-
return T_p/init_rich
21+
# return prop of primary extinctions as total number of initial species
22+
return primary/init_rich
2123
end

0 commit comments

Comments
 (0)