|
54 | 54 | # variables
|
55 | 55 | drop_dynamics(s) = isconstant(s) || isbc(s) || (!isspecies(s))
|
56 | 56 |
|
| 57 | +### Other Metadata Fields ### |
| 58 | + |
| 59 | +# Denotes that a parameter controls the scaling of noise in the CLE. |
| 60 | +struct NoiseScalingParameter end |
| 61 | +Symbolics.option_to_metadata_type(::Val{:isnoisescalingparameter}) = NoiseScalingParameter |
| 62 | + |
| 63 | +isnoisescalingparameter(s::Num) = isnoisescalingparameter(MT.value(s)) |
| 64 | +function isnoisescalingparameter(s) |
| 65 | + MT.getmetadata(s, NoiseScalingParameter, false) |
| 66 | +end |
| 67 | + |
57 | 68 | """
|
58 | 69 | $(TYPEDEF)
|
59 | 70 |
|
@@ -1489,7 +1500,7 @@ Notes:
|
1489 | 1500 | differential equations.
|
1490 | 1501 | """
|
1491 | 1502 | function Base.convert(::Type{<:SDESystem}, rs::ReactionSystem;
|
1492 |
| - noise_scaling = nothing, name = nameof(rs), |
| 1503 | + noise_scaling = get_noise_scaling(rs), name = nameof(rs), |
1493 | 1504 | combinatoric_ratelaws = get_combinatoric_ratelaws(rs),
|
1494 | 1505 | include_zero_odes = true, checks = false, remove_conserved = false,
|
1495 | 1506 | default_u0 = Dict(), default_p = Dict(), defaults = _merge(Dict(default_u0), Dict(default_p)),
|
@@ -1533,6 +1544,11 @@ function Base.convert(::Type{<:SDESystem}, rs::ReactionSystem;
|
1533 | 1544 | kwargs...)
|
1534 | 1545 | end
|
1535 | 1546 |
|
| 1547 | +# Extracts any noise scaling parameters from a reaction system. |
| 1548 | +function get_noise_scaling(rs::ReactionSystem) |
| 1549 | + return nothing |
| 1550 | +end |
| 1551 | + |
1536 | 1552 | """
|
1537 | 1553 | ```julia
|
1538 | 1554 | Base.convert(::Type{<:JumpSystem},rs::ReactionSystem; combinatoric_ratelaws=true)
|
@@ -1616,7 +1632,7 @@ end
|
1616 | 1632 | # SDEProblem from AbstractReactionNetwork
|
1617 | 1633 | function DiffEqBase.SDEProblem(rs::ReactionSystem, u0, tspan,
|
1618 | 1634 | p = DiffEqBase.NullParameters(), args...;
|
1619 |
| - noise_scaling = nothing, name = nameof(rs), |
| 1635 | + noise_scaling = get_noise_scaling(rs), name = nameof(rs), |
1620 | 1636 | combinatoric_ratelaws = get_combinatoric_ratelaws(rs),
|
1621 | 1637 | include_zero_odes = true, checks = false,
|
1622 | 1638 | check_length = false,
|
|
0 commit comments