Skip to content

Commit 42eef82

Browse files
committed
- Add comments to bifurcation diagram functions.
1 parent 586d29f commit 42eef82

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/bifurcations.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#Creates a bifurcation diagram of a specific reaction network and for the given parameter and range.
12
function bifurcation_diagram(model::DiffEqBase.AbstractReactionNetwork, pOrg::AbstractVector, parameter::Symbol, range::AbstractVector, replacements::Expr...;mult=false::Bool,progress_update=2147483640.::Float64)
23
p_idx = findfirst(model.params.==parameter)
34
mult && (range*=pOrg[p_idx])
@@ -15,6 +16,7 @@ function bifurcation_diagram(model::DiffEqBase.AbstractReactionNetwork, pOrg::Ab
1516
return bif_diagram(parameter,range,fps,stabilities,colors,deepcopy(model.syms))
1617
end
1718

19+
#Bifurcation diagram structure, contains all the information in a bifurcation diagram.
1820
struct bif_diagram
1921
param::Symbol
2022
param_values::AbstractVector
@@ -24,6 +26,7 @@ struct bif_diagram
2426
reactant_syms::Vector{Symbol}
2527
end
2628

29+
#Creates a two dimensional bifurcation diagram of a specific reaction network and for the given parameters and ranges.
2730
function bifurcation_diagram_2d(model::DiffEqBase.AbstractReactionNetwork, pOrg::AbstractVector, parameter1::Symbol, parameter2::Symbol, range1::AbstractVector, range2::AbstractVector, replacements::Expr...;mult=false::Bool,progress_update=2147483640.::Float64)
2831
p_idx1 = findfirst(model.params.==parameter1); p_idx2 = findfirst(model.params.==parameter2);
2932
mult && (range1*=pOrg[p_idx1]; range2*=pOrg[p_idx2];)
@@ -41,6 +44,7 @@ function bifurcation_diagram_2d(model::DiffEqBase.AbstractReactionNetwork, pOrg:
4144
return bif_diagram_2d(parameter1,parameter2,range1,range2,fps,stabilities,colors,deepcopy(model.syms))
4245
end
4346

47+
#Two dimensional bifurcation diagram structure, contains all the information in a two dimensional bifurcation diagram.
4448
struct bif_diagram_2d
4549
param1::Symbol
4650
param2::Symbol
@@ -52,12 +56,14 @@ struct bif_diagram_2d
5256
reactant_syms::Array{Symbol}
5357
end
5458

59+
#Function for determening stability of a reaction network. Only used internally by bifurcation diagram functions. Not to be used by the user.
5560
function stability_internal(jacobian::Matrix{Expr},var_vals::Dict,par_vals::Dict)
5661
jac = map(val->recursive_replace!(recursive_replace!(val,var_vals),par_vals),deepcopy(jacobian))
5762
eigenvalues = eigvals(eval.(jac))
5863
return (maximum(real(eigenvalues))<1e-6,any(imag(eigenvalues).>1e-6))
5964
end
6065

66+
#Determines the color of a point in the bifurcation diagram for the given stability information.
6167
function bifurcation_color(stability::Tuple{Bool,Bool})
6268
stability[1]&&stability[2]&&(return :green)
6369
stability[1]&&(return :blue)

0 commit comments

Comments
 (0)