Skip to content

Commit

Permalink
Don't use Parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
YingboMa committed Apr 2, 2021
1 parent 8623c56 commit a8214ac
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/Catalyst.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module Catalyst
using DocStringExtensions
using Reexport, ModelingToolkit
using ModelingToolkit: Symbolic, value, istree, get_states, get_ps, get_iv, get_systems, get_eqs
const DEFAULT_IV = (@parameters t)[1]
@reexport using ModelingToolkit
import MacroTools
import Base: (==), merge!, merge
Expand Down
5 changes: 2 additions & 3 deletions src/networkapi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,12 @@ end
######################## functions to extend a network ####################

"""
make_empty_network(; iv=Sym{ModelingToolkit.Parameter{Real}}(:t),
name=gensym(:ReactionSystem))
make_empty_network(; iv=DEFAULT_IV, name=gensym(:ReactionSystem))
Construct an empty [`ReactionSystem`](@ref). `iv` is the independent variable,
usually time, and `name` is the name to give the `ReactionSystem`.
"""
function make_empty_network(; iv=Sym{ModelingToolkit.Parameter{Real}}(:t), name=gensym(:ReactionSystem))
function make_empty_network(; iv=DEFAULT_IV, name=gensym(:ReactionSystem))
ReactionSystem(Reaction[], iv, [], [], Equation[], name, ReactionSystem[])
end

Expand Down
8 changes: 4 additions & 4 deletions test/api.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Catalyst, DiffEqBase, ModelingToolkit, Test

using ModelingToolkit: value, Parameter
using ModelingToolkit: value

@parameters t k1 k2
@variables S I R
Expand Down Expand Up @@ -62,9 +62,9 @@ addspecies!(rs, Variable(:S))
@test numspecies(rs) == 3
addspecies!(rs, Variable(:S), disablechecks=true)
@test numspecies(rs) == 4
addparam!(rs, Sym{Parameter{Real}}(:k1))
addparam!(rs, k1)
@test numparams(rs) == 2
addparam!(rs, Variable{Parameter{Real}}(:k1), disablechecks=true)
addparam!(rs, k1, disablechecks=true)
@test numparams(rs) == 3


Expand All @@ -78,4 +78,4 @@ smat = [1 2 0;
pmat = [0 2 0;
1 0 2]
@test all(smat .== substoichmat(rnmat))
@test all(pmat .== prodstoichmat(rnmat))
@test all(pmat .== prodstoichmat(rnmat))

0 comments on commit a8214ac

Please sign in to comment.