Skip to content

Commit 14eb223

Browse files
committed
final few fixes
1 parent e4e4cf5 commit 14eb223

File tree

5 files changed

+23
-19
lines changed

5 files changed

+23
-19
lines changed

src/systems/abstractsystem.jl

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,16 +156,24 @@ end
156156

157157
renamespace(namespace,name) = Symbol(namespace,:₊,name)
158158

159+
function renamespace(namespace, x::Sym)
160+
Sym{symtype(x)}(renamespace(namespace,x.name))
161+
end
162+
163+
function renamespace(namespace, x::Term)
164+
renamespace(namespace, x.op)(x.args...)
165+
end
166+
159167
function namespace_variables(sys::AbstractSystem)
160-
[Sym{symtype(x.op)}(renamespace(sys.name,x.op.name))(x.args...) for x in states(sys)]
168+
[renamespace(sys.name,x) for x in states(sys)]
161169
end
162170

163171
function namespace_parameters(sys::AbstractSystem)
164-
[rename(x,renamespace(sys.name,x.name)) for x in parameters(sys)]
172+
[renamespace(sys.name,x) for x in parameters(sys)]
165173
end
166174

167175
function namespace_pins(sys::AbstractSystem)
168-
[rename(x,renamespace(sys.name,x.name)) for x in pins(sys)]
176+
[renamespace(sys.name,x) for x in pins(sys)]
169177
end
170178

171179
namespace_equations(sys::AbstractSystem) = namespace_equation.(equations(sys),sys.name,sys.iv.name)

src/systems/jumps/jumpsystem.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ function assemble_maj(maj::MassActionJump, statetoid, subber, invttype)
151151
rval = subber(maj.scaled_rates)
152152
rs = numericrstoich(maj.reactant_stoch, statetoid)
153153
ns = numericnstoich(maj.net_stoch, statetoid)
154-
@show rval
155154
maj = MassActionJump(convert(invttype, value(rval)), rs, ns, scale_rates = false)
156155
maj
157156
end

src/systems/reaction/reactionsystem.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ function get_variables!(deps::Set, rx::Reaction, variables)
526526
for s in rx.substrates
527527
push!(deps, s)
528528
end
529-
@show deps
529+
deps
530530
end
531531

532532
# determine which species a reaction modifies

src/systems/reduction.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,12 @@ function alias_elimination(sys::ODESystem)
6666

6767

6868
all_vars = map(eqs) do eq
69-
@show eq.rhs
70-
@show filterexpr(isvar, eq.rhs)
7169
filterexpr(isvar, eq.rhs)
7270
end |> Iterators.flatten |> collect |> unique
7371

7472
alg_idxs = findall(x->!(x.lhs isa Term) && iszero(x.lhs), eqs)
75-
@show all_vars, newstates
7673

7774
eliminate = setdiff(all_vars, newstates)
78-
@show eliminate
7975

8076
outputs = solve_for(eqs[alg_idxs], eliminate)
8177

test/latexify.jl

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ eqs = [D(x) ~ σ*(y-x)*D(x-y)/D(z),
2727
0 ~ σ*x*-z)/10-y,
2828
D(z) ~ x*y^(2//3) - β*z]
2929

30-
@test latexify(eqs).s == raw"""\begin{align}
31-
\frac{dx(t)}{dt} =& \frac{\sigma \left( y\left( t \right) - x\left( t \right) \right) \frac{d\left(x\left( t \right) - y\left( t \right)\right)}{dt}}{\frac{dz(t)}{dt}} \\
32-
0 =& \frac{\sigma x\left( t \right) \left( \rho - z\left( t \right) \right)}{10} - y\left( t \right) \\
33-
\frac{dz(t)}{dt} =& x\left( t \right) \left( y\left( t \right) \right)^{\frac{2}{3}} - \beta z\left( t \right)
30+
@test latexify(eqs) == raw"""\begin{align}
31+
\frac{dx(t)}{dt} =& /\left( *\left( *\left( \sigma, -\left( y\left( t \right), x\left( t \right) \right) \right), \frac{d\left(-\left( x\left( t \right), y\left( t \right) \right)\right)}{dt} \right), \frac{dz(t)}{dt} \right) \\
32+
0 =& -\left( /\left( *\left( *\left( \sigma, x\left( t \right) \right), -\left( \rho, z\left( t \right) \right) \right), 10 \right), y\left( t \right) \right) \\
33+
\frac{dz(t)}{dt} =& -\left( *\left( x\left( t \right), ^\left( y\left( t \right), \frac{2}{3} \right) \right), *\left( \beta, z\left( t \right) \right) \right)
3434
\end{align}
3535
"""
3636
@parameters t p[1:3]
@@ -43,9 +43,9 @@ eqs = [D(u[1]) ~ p[3]*(u[2]-u[1]),
4343

4444
@test latexify(eqs) ==
4545
raw"\begin{align}
46-
\frac{du_1(t)}{dt} =& p_3 \left( \mathrm{u_2}\left( t \right) - \mathrm{u_1}\left( t \right) \right) \\
47-
0 =& \frac{p_2 p_3 \mathrm{u_1}\left( t \right) \left( p_1 - \mathrm{u_1}\left( t \right) \right)}{10} - \mathrm{u_2}\left( t \right) \\
48-
\frac{du_3(t)}{dt} =& \mathrm{u_1}\left( t \right) \left( \mathrm{u_2}\left( t \right) \right)^{\frac{2}{3}} - p_3 \mathrm{u_3}\left( t \right)
46+
\frac{du_1(t)}{dt} =& *\left( p_3, -\left( \mathrm{u_2}\left( t \right), \mathrm{u_1}\left( t \right) \right) \right) \\
47+
0 =& -\left( /\left( *\left( *\left( *\left( p_2, p_3 \right), \mathrm{u_1}\left( t \right) \right), -\left( p_1, \mathrm{u_1}\left( t \right) \right) \right), 10 \right), \mathrm{u_2}\left( t \right) \right) \\
48+
\frac{du_3(t)}{dt} =& -\left( *\left( \mathrm{u_1}\left( t \right), ^\left( \mathrm{u_2}\left( t \right), \frac{2}{3} \right) \right), *\left( p_3, \mathrm{u_3}\left( t \right) \right) \right)
4949
\end{align}
5050
"
5151

@@ -57,8 +57,9 @@ sys = ODESystem(eqs)
5757

5858
@test latexify(eqs) ==
5959
raw"\begin{align}
60-
\frac{du_1(t)}{dt} =& p_3 \left( \mathrm{u_2}\left( t \right) - \mathrm{u_1}\left( t \right) \right) \\
61-
\frac{du_2(t)}{dt} =& \frac{p_2 p_3 \mathrm{u_1}\left( t \right) \left( p_1 - \mathrm{u_1}\left( t \right) \right)}{10} - \mathrm{u_2}\left( t \right) \\
62-
\frac{du_3(t)}{dt} =& \mathrm{u_1}\left( t \right) \left( \mathrm{u_2}\left( t \right) \right)^{\frac{2}{3}} - p_3 \mathrm{u_3}\left( t \right)
60+
\frac{du_1(t)}{dt} =& *\left( p_3, -\left( \mathrm{u_2}\left( t \right), \mathrm{u_1}\left( t \right) \right) \right) \\
61+
\frac{du_2(t)}{dt} =& -\left( /\left( *\left( *\left( *\left( p_2, p_3 \right), \mathrm{u_1}\left( t \right) \right), -\left( p_1, \mathrm{u_1}\left( t \right) \right) \right), 10 \right), \mathrm{u_2}\left( t \right) \right) \\
62+
\frac{du_3(t)}{dt} =& -\left( *\left( \mathrm{u_1}\left( t \right), ^\left( \mathrm{u_2}\left( t \right), \frac{2}{3} \right) \right), *\left( p_3, \mathrm{u_3}\left( t \right) \right) \right)
6363
\end{align}
6464
"
65+

0 commit comments

Comments
 (0)