You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Takes an expression, and expands registered function expressions. E.g. `mm(X,v,K)` is replaced with v*X/(X+K). Currently supported functions: `mm`, `mmr`, `hill`, `hillr`, and `hill`.
118
118
"""
119
-
functionexpand_registered_functions!(expr)
120
-
iscall(expr) ||return expr
119
+
functionexpand_registered_functions(expr)
120
+
ifhasnode(is_catalyst_function, expr)
121
+
expr =replacenode(expr, expand_catalyst_function)
122
+
end
123
+
return expr
124
+
end
125
+
126
+
# Checks whether an expression corresponds to a catalyst function call (e.g. `mm(X,v,K)`).
127
+
functionis_catalyst_function(expr)
128
+
iscall(expr) || (returnfalse)
129
+
returnoperation(expr) in [Catalyst.mm, Catalyst.mmr, Catalyst.hill, Catalyst.hillr, Catalyst.hillar]
130
+
end
131
+
132
+
# If the input expression corresponds to a catalyst function call (e.g. `mm(X,v,K)`), returns
133
+
# it in its expanded form. If not, returns the input expression.
134
+
functionexpand_catalyst_function(expr)
135
+
is_catalyst_function(expr) || (return expr)
121
136
args =arguments(expr)
122
137
ifoperation(expr) == Catalyst.mm
123
138
return args[2] * args[1] / (args[1] + args[3])
@@ -131,23 +146,55 @@ function expand_registered_functions!(expr)
0 commit comments