Skip to content

Commit

Permalink
📝 minor edits in the doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Cazelles committed Dec 10, 2021
1 parent 49de9f7 commit 60117e3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
9 changes: 6 additions & 3 deletions src/basic_omnivory_module.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using LinearAlgebra: eigvals
using ForwardDiff
using QuadGK: quadgk

# # Omnivory preference functions
# Omnivory preference functions
function adapt_pref(u, p, t)
return p.ω * u[1] / (p.ω * u[1] + (1 - p.ω) * u[2])
end
Expand All @@ -16,7 +16,7 @@ end
@with_kw mutable struct ModelPar
# Logistic Parameters
r = 2.0
## `K_base` measures the underyling K outside of any forcing applied
# `K_base` measures the underyling K outside of any forcing applied
K_base = 3
K = 3
# Consumer Parameters
Expand All @@ -33,10 +33,13 @@ end
a_RP = 0.2
h_RP = 0.6
e_RP = 0.4
# if Ω = 0 then we have a food chain
Ω = 0.1
# Forcing Function
# 'fixed_pref' for passive omnivory
# 'adapt_pref' for active omnivory
pref::Function = fixed_pref
## Used in the adaptive forcing to bias towards C or R
# Used in the adaptive forcing to bias towards C or R
ω = 0.5
end

Expand Down
6 changes: 3 additions & 3 deletions src/pipeline.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ printstyled("Done! fig_pulse.jl created\n", color = :green)

# Supplementary Information

# The line below is used to run the SI version of the figure: when the 1st
# argument of 'ARGS' is true, then the parameters used are the one for the SI
# figure. Note that we actually use `ARGS` because this is specifically
# The line below is used to run the SI version of the figures: when the 1st
# argument of 'ARGS' is true, then the model parameters used are the ones for
# the SI figure. Note that we actually use `ARGS` because this is specifically
# the vector that captures external arguments. Thus using it allows us to use
# arguments in the command line. So here, to run the SI version of fig_pulse,
# I'd use `julia fig_pulse.jl true`. To mimic this we simply add "true" to
Expand Down
9 changes: 5 additions & 4 deletions src/press.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using DifferentialEquations, NLsolve

# Full analysis for one press simulation (1 system)
# Entire analysis for one press simulation (1 system)
function press_unit(par, p_strength)
# Parameters
u0 = [1.0, 1.5, 1.5]
Expand Down Expand Up @@ -28,8 +28,9 @@ function press_unit(par, p_strength)
if par.pref == adapt_pref
# compute ω
# NB: This may often increases computation time as we may compute
# results for 'fixed' twice but the code is much easier to read.
# Here the time is not a major concern as it takes few minutes to run.
# results for passive omnivory twice but the code is much easier to
# read. Here the time is not a major concern as it takes few minutes to
# run.
par_fix = deepcopy(par)
par_fix.pref = fixed_pref
prob_fix = ODEProblem(model!, u0, t_span, deepcopy(par_fix),
Expand Down Expand Up @@ -90,7 +91,7 @@ function press_unit(par, p_strength)
end

# Perform the pulse for the 3 systems:
# - Food chain: "chain";C OP (fixed)
# - Food chain: "chain";
# - Passive omnivory: "passive";
# - Active omnivory: "active";
function press(base_par, Ω, p_strength)
Expand Down
7 changes: 4 additions & 3 deletions src/pulse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ function pulse_unit(par, p_length, p_strength)

# run
if par.pref == adapt_pref
# compute w
# compute ω
# NB: This may often increases computation time as we may compute
# results for 'fixed' twice but the code is much easier to read.
# Here the time is not a major concern as it takes few minutes to run.
# results for passive omnivory twice but the code is much easier to
# read. Here the time is not a major concern as it takes few minutes to
# run.
par_fix = deepcopy(par)
par_fix.pref = fixed_pref
prob_fix = ODEProblem(model!, u0, t_span, deepcopy(par_fix),
Expand Down

0 comments on commit 60117e3

Please sign in to comment.