Skip to content

Commit f7039d1

Browse files
committed
init
1 parent 847077b commit f7039d1

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

ext/CatalystHomotopyContinuationExtension/homotopy_continuation_extension.jl

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,27 @@ function filter_negative_f(sols; neg_thres=-1e-20)
104104
(neg_thres < sol[idx] < 0) && (sol[idx] = 0)
105105
end
106106
return filter(sol -> all(>=(0), sol), sols)
107-
end
107+
end
108+
109+
### Archived ###
110+
111+
# # Unfolds a function (like mm or hill).
112+
# function deregister(fs::Vector{T}, expr) where T
113+
# for f in fs
114+
# expr = deregister(f, expr)
115+
# end
116+
# return expr
117+
# end
118+
# # Provided by Shashi Gowda.
119+
# deregister(f, expr) = wrap(Rewriters.Postwalk(Rewriters.PassThrough(___deregister(f)))(unwrap(expr)))
120+
# function ___deregister(f)
121+
# (expr) ->
122+
# if istree(expr) && operation(expr) == f
123+
# args = arguments(expr)
124+
# invoke_with = map(args) do a
125+
# t = typeof(a)
126+
# issym(a) || istree(a) ? wrap(a) => symtype(a) : a => typeof(a)
127+
# end
128+
# invoke(f, Tuple{last.(invoke_with)...}, first.(invoke_with)...)
129+
# end
130+
# end

src/reactionsystem.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,6 +1296,11 @@ function Base.convert(::Type{<:ODESystem}, rs::ReactionSystem; name = nameof(rs)
12961296
eqs = assemble_drift(fullrs, ispcs; combinatoric_ratelaws, remove_conserved,
12971297
include_zero_odes)
12981298
eqs, sts, ps, obs, defs = addconstraints!(eqs, fullrs, ists, ispcs; remove_conserved)
1299+
1300+
# Converts expressions like mm(X,v,K) to v*X/(X+K).
1301+
expand_functions && for eq in eqs
1302+
eq.rhs = expand_registered_functions!(eq.rhs)
1303+
end
12991304

13001305
ODESystem(eqs, get_iv(fullrs), sts, ps;
13011306
observed = obs,
@@ -1404,6 +1409,11 @@ function Base.convert(::Type{<:SDESystem}, rs::ReactionSystem;
14041409
eqs, sts, ps, obs, defs = addconstraints!(eqs, flatrs, ists, ispcs; remove_conserved)
14051410
ps = (noise_scaling === nothing) ? ps : vcat(ps, toparam(noise_scaling))
14061411

1412+
# Converts expressions like mm(X,v,K) to v*X/(X+K).
1413+
expand_functions && for eq in eqs
1414+
eq.rhs = expand_registered_functions!(eq.rhs)
1415+
end
1416+
14071417
if any(isbc, get_states(flatrs))
14081418
@info "Boundary condition species detected. As constraint equations are not currently supported when converting to SDESystems, the resulting system will be undetermined. Consider using constant species instead."
14091419
end

0 commit comments

Comments
 (0)