From 60117e3868e7e90580e3fef3f344466e92c4d4b3 Mon Sep 17 00:00:00 2001 From: Kevin Cazelles Date: Fri, 10 Dec 2021 14:55:29 -0500 Subject: [PATCH] :memo: minor edits in the doc --- src/basic_omnivory_module.jl | 9 ++++++--- src/pipeline.jl | 6 +++--- src/press.jl | 9 +++++---- src/pulse.jl | 7 ++++--- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/basic_omnivory_module.jl b/src/basic_omnivory_module.jl index e7bb998..8ed6a50 100644 --- a/src/basic_omnivory_module.jl +++ b/src/basic_omnivory_module.jl @@ -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 @@ -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 @@ -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 diff --git a/src/pipeline.jl b/src/pipeline.jl index e9eeed7..618d677 100644 --- a/src/pipeline.jl +++ b/src/pipeline.jl @@ -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 diff --git a/src/press.jl b/src/press.jl index 4b376b5..4f28f67 100644 --- a/src/press.jl +++ b/src/press.jl @@ -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] @@ -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), @@ -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) diff --git a/src/pulse.jl b/src/pulse.jl index 0f067ad..d7ca13e 100644 --- a/src/pulse.jl +++ b/src/pulse.jl @@ -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),