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
"Unrecognized variables $(join(species, ", ")) detected in reaction expression: \"$(string(reaction.rxexpr))\". Since the flag @require_declaration is declared, all species must be explicitly declared with the @species macro."))
517
520
end
521
+
(!isempty(species) && requiredec) &&
522
+
throw(UndeclaredSymbolicError("Unrecognized variables $(join(species, ", ")) detected in reaction expression: \"$(string(reaction.rxexpr))\". Since the flag @require_declaration is declared, all species must be explicitly declared with the @species macro."))
518
523
end
519
-
foreach(s ->push!(excluded_syms, s), species)
524
+
union!(excluded_syms, species)
520
525
521
526
# Loops through all rates and stoichiometries, extracting used symbols as parameters.
"Unrecognized parameter $(join(parameters, ", ")) detected in rate expression: $(reaction.rate) for the following reaction expression: \"$(string(reaction.rxexpr))\". Since the flag @require_declaration is declared, all parameters must be explicitly declared with the @parameters macro."))
530
+
(!isempty(parameters) && requiredec) &&
531
+
throw(UndeclaredSymbolicError("Unrecognized parameter $(join(parameters, ", ")) detected in rate expression: $(reaction.rate) for the following reaction expression: \"$(string(reaction.rxexpr))\". Since the flag @require_declaration is declared, all parameters must be explicitly declared with the @parameters macro."))
527
532
for reactant in Iterators.flatten((reaction.substrates, reaction.products))
"Unrecognized parameters $(join(parameters, ", ")) detected in the stoichiometry for reactant $(reactant.reactant) in the following reaction expression: \"$(string(reaction.rxexpr))\". Since the flag @require_declaration is declared, all parameters must be explicitly declared with the @parameters macro."))
534
+
(!isempty(parameters) && requiredec) &&
535
+
throw(UndeclaredSymbolicError("Unrecognized parameters $(join(parameters, ", ")) detected in the stoichiometry for reactant $(reactant.reactant) in the following reaction expression: \"$(string(reaction.rxexpr))\". Since the flag @require_declaration is declared, all parameters must be explicitly declared with the @parameters macro."))
531
536
end
532
537
end
533
538
@@ -556,12 +561,12 @@ end
556
561
# `@species ...` (or `@variables ..`) expression which would declare these.
557
562
# If `key = :variables`, does this for variables (and not species).
if (requiredec &&!in(obs_name, species_n_vars_declared))
825
-
throw(UndeclaredSymbolicError(
826
-
"An undeclared variable ($obs_name) was declared as an observable in the following observable equation: \"$obs_eq\". Since the flag @require_declaration is set, all variables must be declared with the @species, @parameters, or @variables macros."))
throw(UndeclaredSymbolicError("An undeclared variable ($obs_name) was declared as an observable in the following observable equation: \"$obs_eq\". Since the flag @require_declaration is set, all variables must be declared with the @species, @parameters, or @variables macros."))
829
+
isempty(ivs) ||
829
830
error("An observable ($obs_name) was given independent variable(s). These should not be given, as they are inferred automatically.")
830
-
end
831
-
if!isnothing(defaults)
831
+
isnothing(defaults) ||
832
832
error("An observable ($obs_name) was given a default value. This is forbidden.")
833
-
end
834
-
ifin(obs_name, forbidden_symbols_error)
833
+
in(obs_name, forbidden_symbols_error) &&
835
834
error("A forbidden symbol ($(obs_eq.args[2])) was used as an observable name.")
836
-
end
837
-
if (obs_name in species_n_vars_declared) &&is_escaped_expr(obs_eq.args[2])
835
+
(obs_name in species_n_vars_declared) &&is_escaped_expr(obs_eq.args[2]) &&
838
836
error("An interpolated observable have been used, which has also been ereqxplicitly declared within the system using either @species or @variables. This is not permitted.")
839
-
end
840
-
if ((obs_name in species_n_vars_declared) ||is_escaped_expr(obs_eq.args[2])) &&
841
-
!isnothing(metadata)
842
-
error("Metadata was provided to observable $obs_name in the `@observables` macro. However, the observable was also declared separately (using either @species or @variables). When this is done, metadata should instead be provided within the original @species or @variable declaration.")
843
-
end
837
+
((obs_name in species_n_vars_declared) ||is_escaped_expr(obs_eq.args[2])) &&
838
+
!isnothing(metadata) &&error("Metadata was provided to observable $obs_name in the `@observables` macro. However, the observable was also declared separately (using either @species or @variables). When this is done, metadata should instead be provided within the original @species or @variable declaration.")
844
839
845
840
# This bits adds the observables to the @variables vector which is given as output.
846
841
# For Observables that have already been declared using @species/@variables,
0 commit comments