Skip to content

Commit a0bf4ef

Browse files
committed
up
1 parent 543b1bf commit a0bf4ef

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/reaction_network.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -711,8 +711,11 @@ function read_observed_options(options, species_declared)
711711
push!(observed_vars.args[1].args, obs_expr)
712712

713713
# Adds a line to the `observed_vars` expression, setting the ivs for this observable.
714-
dependants = [rs.reactant for rs in
715-
Catalyst.recursive_find_reactants!(obs_eq.args[3], 1, Vector{ReactantStruct}(undef, 0))]
714+
# Cannot extract directly using e.g. "getfield.(dependants_structs, :reactant)" because
715+
# then we get something like :([:X1, :X2]), rather than :([X1, X2]).
716+
dependants_structs = Catalyst.recursive_find_reactants!(obs_eq.args[3], 1, Vector{ReactantStruct}(undef, 0))
717+
dependants = :([])
718+
foreach(dep -> push!(dependants.args, dep.reactant), dependants_structs)
716719
ivs_get_expr = :(unique(reduce(vcat,[arguments(ModelingToolkit.unwrap(dep)) for dep in $dependants])))
717720
push!(observed_vars.args, :($obs_name = $(obs_name)($(ivs_get_expr)...)))
718721
end

0 commit comments

Comments
 (0)