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
Copy file name to clipboardExpand all lines: docs/src/model_creation/dsl_advanced.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -575,7 +575,7 @@ nothing # hide
575
575
When using interpolation, expressions like `2$spec` won't work; the multiplication symbol must be explicitly included like `2*$spec`.
576
576
577
577
## [Creating individual reaction using the `@reaction` macro](@id dsl_advanced_options_reaction_macro)
578
-
Catalyst exports a macro `@reaction`, which can be used to generate a singular [`Reaction`](@ref) object of the same type which is stored within the [`ReactionSystem`](@ref) structure (which in turn can be generated by `@reaction_network`). Generally, `@reaction` follows [identical rules to those of `@reaction_network`](@ref(@ref dsl_description_reactions)) for writing and interpreting reactions (however, bi-directional reactions are not permitted). E.g. here we create a simple dimerisation reaction:
578
+
Catalyst exports a macro `@reaction`, which can be used to generate a singular [`Reaction`](@ref) object of the same type which is stored within the [`ReactionSystem`](@ref) structure (which in turn can be generated by `@reaction_network`). Generally, `@reaction` follows [identical rules to those of `@reaction_network`](@ref dsl_description_reactions) for writing and interpreting reactions (however, bi-directional reactions are not permitted). E.g. here we create a simple dimerisation reaction:
error("@default_noise_scaling should only have a single expression as its input, this appears not to be the case: \"$(options[:default_noise_scaling])\"")
# Goes through all differentials, checking that they are correctly formatted. Adds their
769
+
# symbol to the list of declared differential symbols.
770
+
diffs_declared = Union{Symbol, Expr}[]
771
+
for dexpr in diffsexpr.args
772
+
(dexpr.head != :(=)) &&
773
+
error("Differential declaration must have form like D = Differential(t), instead \"$(dexpr)\" was given.")
774
+
(dexpr.args[1] isa Symbol) ||
775
+
error("Differential left-hand side must be a single symbol, instead \"$(dexpr.args[1])\" was given.")
776
+
in(dexpr.args[1], forbidden_symbols_error) &&
777
+
error("A forbidden symbol ($(dexpr.args[1])) was used as a differential name.")
778
+
push!(diffs_declared, dexpr.args[1])
779
+
end
780
+
781
+
return diffsexpr, diffs_declared
782
+
end
783
+
735
784
# Reads the observables options. Outputs an expression for creating the observable variables,
736
785
# a vector containing the observable equations, and a list of all observable symbols (this
737
786
# list contains both those declared separately or inferred from the `@observables` option` input`).
@@ -761,8 +810,8 @@ function read_observed_option(options, all_ivs, us_declared, all_syms; requirede
761
810
error("An observable ($obs_name) uses a name that already have been already been declared or inferred as another model property.")
762
811
(obs_name in us_declared) &&is_escaped_expr(obs_eq.args[2]) &&
763
812
error("An interpolated observable have been used, which has also been explicitly declared within the system using either @species or @variables. This is not permitted.")
764
-
((obs_name in us_declared) ||is_escaped_expr(obs_eq.args[2])) &&
765
-
!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.")
813
+
((obs_name in us_declared) ||is_escaped_expr(obs_eq.args[2])) &&!isnothing(metadata) &&
814
+
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.")
766
815
767
816
# This bits adds the observables to the @variables vector which is given as output.
768
817
# For Observables that have already been declared using @species/@variables,
@@ -815,60 +864,11 @@ function make_obs_eqs(observables_expr)
815
864
return obs_eqs
816
865
end
817
866
818
-
# Read the events (continuous or discrete) provided as options to the DSL. Returns an expression which evaluates to these.
error("@default_noise_scaling should only have a single expression as its input, this appears not to be the case: \"$(options[:default_noise_scaling])\"")
Copy file name to clipboardExpand all lines: src/expression_utils.jl
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,9 @@ end
39
39
# Note that there are only some options for which we wish to make this check.
40
40
functionget_block_option(expr)
41
41
(length(expr.args) >3) &&
42
-
error("An option input ($expr) is misformatted. Potentially, it has multiple inputs on a single lines, and these should be split across multiple lines using a `begin ... end` block.")
42
+
error("An option input ($expr) is missformatted. Potentially, it has multiple inputs on a single lines, and these should be split across multiple lines using a `begin ... end` block.")
43
+
(length(expr.args) <3) &&
44
+
error("An option input ($expr) is missformatted. It seems that it has no inputs, which is expected.")
0 commit comments