Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Commit 3421a83

Browse files
fix the plot recipe
1 parent fbe9d3d commit 3421a83

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/bifurcation.jl

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
mutable struct BifurcationCurve{DType,SPType}
2-
d::DType
2+
points::DType
33
stab::Vector{String}
44
special_points::SPType
55
changes::Vector{Int}
66
end
77

88
@recipe function f(bif::BifurcationCurve,coords)
9-
x = bif.d[coords[1]]
10-
y = bif.d[coords[2]]
9+
x = bif.points[coords[1]]
10+
y = bif.points[coords[2]]
1111
g = bif.stab
1212
style_order = unique(bif.stab)
13+
1314
linestyle --> reshape([style == "S" ? :solid : :dash for style in style_order],1,length(style_order))
1415
color --> reshape([style == "S" ? :blue : :red for style in style_order],1,length(style_order))
1516
legend --> false
1617
xlabel --> coords[1]
1718
ylabel --> coords[2]
19+
1820
for k in keys(bif.special_points)
1921
@series begin
2022
seriestype --> :scatter
@@ -108,11 +110,11 @@ function bifurcation_curve(PC,bif_type,freepars;max_num_points=450,
108110

109111
# Get the curve
110112
pts = PyDict(PC[:curves][name][:_curveToPointset]())
111-
d = OrderedDict{Symbol,Vector{Float64}}()
113+
points = OrderedDict{Symbol,Vector{Float64}}()
112114
for k in keys(pts)
113-
d[Symbol(k)] = pts[k]
115+
points[Symbol(k)] = pts[k]
114116
end
115-
len = length(d[first(keys(d))])
117+
len = length(points[first(keys(points))])
116118

117119
# Get the stability
118120
# S => Stable
@@ -156,7 +158,7 @@ function bifurcation_curve(PC,bif_type,freepars;max_num_points=450,
156158

157159
changes = find_changes(stab)
158160

159-
BifurcationCurve(d,stab,special_points,changes)
161+
BifurcationCurve(points,stab,special_points,changes)
160162
end
161163

162164
function find_changes(stab)

test/pf_calcium.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using ParameterizedFunctions, PyDSTool
1+
using ParameterizedFunctions, PyDSTool, Base.Test
22

33
f = @ode_def_bare Calcium begin
44
dv = ( i + gl * (vl - v) - gca * 0.5 * (1 + tanh( (v-v1)/v2 )) * (v-vca) )/c

0 commit comments

Comments
 (0)