Skip to content

Commit

Permalink
bug: overwritten method
Browse files Browse the repository at this point in the history
  • Loading branch information
tpoisot committed Oct 12, 2024
1 parent e2196f0 commit 333a17f
Showing 1 changed file with 1 addition and 29 deletions.
30 changes: 1 addition & 29 deletions src/random/linearfilter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,7 @@ function linearfilter(N::SpeciesInteractionNetwork{<:Partiteness, <:Binary}; α:
return SpeciesInteractionNetwork(copy(N.nodes), edges)
end

"""
linearfilter(N::SpeciesInteractionNetwork{<:Partiteness, <:Binary}; interaction::T=1.0, generality::T=1.0, vulnerability::T=1.0, connectance::T=1.0) where {T <: AbstractFloat}
Keyword version of `linearfilter` where the parameters are all set to 1.0 by default.
"""
function linearfilter(
N::SpeciesInteractionNetwork{<:Partiteness, <:Binary};
interaction::T = 1.0,
generality::T = 1.0,
vulnerability::T = 1.0,
connectance::T = 1.0,
) where {T <: AbstractFloat}
α = [interaction, generality, vulnerability, connectance]
return linearfilter(N; α = α)
end

@testitem "The linearfilter function returns the correct type" begin
@testitem "The linearfilter function returns the correct type" begi
nodes = Unipartite([:A, :B, :C, :D, :E, :F])
edges = Binary(rand(Bool, (richness(nodes, 1), richness(nodes, 2))))
N = SpeciesInteractionNetwork(nodes, edges)
Expand Down Expand Up @@ -100,18 +84,6 @@ end
end
end

@testitem "We can use the keyword version of linearfilter" begin
import Statistics
nodes = Unipartite([:A, :B, :C, :D, :E, :F])
edges = Binary(rand(Bool, (richness(nodes, 1), richness(nodes, 2))))
N = SpeciesInteractionNetwork(nodes, edges)
R = linearfilter(N; α = [1.0, 0.0, 0.0, 0.0])
S = linearfilter(N; generality=0.0, vulnerability=0.0, connectance=0.0)
for interaction in interactions(N)
@test R[interaction[1], interaction[2]] == S[interaction[1], interaction[2]]
end
end

"""
nullmodel(::Type{Degree}, N::SpeciesInteractionNetwork{<:Partiteness, <:Binary})
Expand Down

0 comments on commit 333a17f

Please sign in to comment.