Skip to content

Commit 295678d

Browse files
committed
remove SymbolicUtils and related stuff
1 parent 4b61e46 commit 295678d

File tree

10 files changed

+41
-43
lines changed

10 files changed

+41
-43
lines changed

Project.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ Requires = "ae029012-a4dd-5104-9daa-d747884805df"
2121
RuntimeGeneratedFunctions = "7e49a35a-f44a-4d26-94aa-eba1b4ca6b47"
2222
Setfield = "efcf1570-3423-57d1-acb7-fd33fddbac46"
2323
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
24-
SymbolicUtils = "d1185830-fcd6-423d-90d6-eec64667417b"
2524
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
2625
TermInterface = "8ea1fca8-c5ef-4a55-8b96-4e9afe9c9a3c"
2726
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
@@ -57,7 +56,6 @@ RuntimeGeneratedFunctions = "0.5.12"
5756
Setfield = "1"
5857
StructuralIdentifiability = "0.5.1"
5958
Symbolics = "5.27"
60-
SymbolicUtils = "2.0.2"
6159
TermInterface = "0.4.1"
6260
Unitful = "1.12.4"
6361
julia = "1.10"

src/Catalyst.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ using RuntimeGeneratedFunctions
2323
RuntimeGeneratedFunctions.init(@__MODULE__)
2424

2525
import Symbolics: BasicSymbolic
26-
import SymbolicUtils
2726
using TermInterface: iscall
2827
using ModelingToolkit: Symbolic, value, get_unknowns, get_ps, get_iv, get_systems,
2928
get_eqs, get_defaults, toparam, get_var_to_name, get_observed,

src/chemistry_functionality.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ function make_compounds(expr)
182182
end
183183
push!(compound_declarations.args, :($(Expr(:escape, :($(compound_syms))))))
184184

185-
# The output needs to be converted to Vector{Num} (from Vector{SymbolicUtils.BasicSymbolic{Real}}) to be consistent with e.g. @variables.
185+
# The output needs to be converted to Vector{Num} (from Vector{BasicSymbolic{Real}}) to be consistent with e.g. @variables.
186186
compound_declarations.args[end] = :([ModelingToolkit.wrap(cmp) for cmp in $(compound_declarations.args[end])])
187187

188188
# Returns output that.

src/reactionsystem_serialisation/serialisation_support.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ function sym_2_declaration_string(sym; multiline_format = false)
103103
dec_string = "$(sym)"
104104

105105
# If the symbol have a non-default type, appends the declaration of this.
106-
# Assumes that the type is on the form `SymbolicUtils.BasicSymbolic{X}`. Contain error checks
106+
# Assumes that the type is on the form `BasicSymbolic{X}`. Contain error checks
107107
# to ensure that this is the case.
108-
if !(sym isa SymbolicUtils.BasicSymbolic{Real})
108+
if !(sym isa BasicSymbolic{Real})
109109
sym_type = String(Symbol(typeof(Symbolics.unwrap(sym))))
110110
if (get_substring(sym_type, 1, 28) != "SymbolicUtils.BasicSymbolic{") || (get_char_end(sym_type, 0) != '}')
111111
error("Encountered symbolic of unexpected type: $sym_type.")
@@ -139,7 +139,7 @@ end
139139
# and metadata values (which hopefully almost exclusively) has simple, supported, types. Ideally,
140140
# more supported types can be added here.
141141
x_2_string(x::Num) = expression_2_string(x)
142-
x_2_string(x::SymbolicUtils.BasicSymbolic{<:Real}) = expression_2_string(x)
142+
x_2_string(x::BasicSymbolic{<:Real}) = expression_2_string(x)
143143
x_2_string(x::Bool) = string(x)
144144
x_2_string(x::String) = "\"$x\""
145145
x_2_string(x::Char) = "\'$x\'"
@@ -293,6 +293,6 @@ end
293293
function complicated_declaration(sym)
294294
isempty(get_metadata_to_declare(sym)) || (return true)
295295
ModelingToolkit.hasdefault(sym) && (return true)
296-
(sym isa SymbolicUtils.BasicSymbolic{Real}) || (return true)
296+
(sym isa BasicSymbolic{Real}) || (return true)
297297
return false
298298
end

src/reactionsystem_serialisation/serialise_fields.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ function discrete_event_string(discrete_event, strip_call_dict)
445445
# Creates the string corresponding to the conditions. The special check is if the condition is
446446
# an expression like `X > 5.0`. Here, "(...)" is added for purely aesthetic reasons.
447447
condition_string = x_2_string(discrete_event.condition)
448-
if discrete_event.condition isa SymbolicUtils.BasicSymbolic
448+
if discrete_event.condition isa BasicSymbolic
449449
@string_prepend! "(" condition_string
450450
@string_append! condition_string ")"
451451
end

src/spatial_reaction_systems/utility.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ end
203203
# If all parameters the rate depend on are uniform all edges, this becomes a length 1 vector.
204204
# Else a vector with each value corresponding to the rate at one specific edge.
205205
function compute_transport_rates(rate_law::Num,
206-
p_val_dict::Dict{SymbolicUtils.BasicSymbolic{Real}, Vector{Float64}}, num_edges::Int64)
206+
p_val_dict::Dict{BasicSymbolic{Real}, Vector{Float64}}, num_edges::Int64)
207207
# Finds parameters involved in rate and create a function evaluating the rate law.
208208
relevant_ps = Symbolics.get_variables(rate_law)
209209
rate_law_func = drop_expr(@RuntimeGeneratedFunction(build_function(rate_law, relevant_ps...)))

test/miscellaneous_tests/reactionsystem_serialisation.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
using Catalyst, Test
55
using Catalyst: get_rxs
66
using ModelingToolkit: getdefault, getdescription, get_metadata
7+
using Symbolics: getmetadata
78

89
# Creates missing getters for MTK metadata (can be removed once added to MTK).
9-
getmisc(x) = SymbolicUtils.getmetadata(Symbolics.unwrap(x), ModelingToolkit.VariableMisc, nothing)
10-
getinput(x) = SymbolicUtils.getmetadata(Symbolics.unwrap(x), ModelingToolkit.VariableInput, nothing)
10+
getmisc(x) = getmetadata(Symbolics.unwrap(x), ModelingToolkit.VariableMisc, nothing)
11+
getinput(x) = getmetadata(Symbolics.unwrap(x), ModelingToolkit.VariableInput, nothing)
1112

1213
# Sets the default `t` and `D` to use.
1314
t = default_t()

test/reactionsystem_core/parameter_type_designation.jl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Fetch packages.
44
using Catalyst, JumpProcesses, NonlinearSolve, OrdinaryDiffEq, StochasticDiffEq, Test
5-
using Symbolics: unwrap
5+
using Symbolics: BasicSymbolic, unwrap
66

77
# Sets stable rng number.
88
using StableRNGs
@@ -47,16 +47,16 @@ end
4747

4848
# Tests that parameters stored in the system have the correct type.
4949
let
50-
@test Symbolics.unwrap(rs.p1) isa SymbolicUtils.BasicSymbolic{Real}
51-
@test Symbolics.unwrap(rs.d1) isa SymbolicUtils.BasicSymbolic{Real}
52-
@test Symbolics.unwrap(rs.p2) isa SymbolicUtils.BasicSymbolic{Float64}
53-
@test Symbolics.unwrap(rs.d2) isa SymbolicUtils.BasicSymbolic{Float64}
54-
@test Symbolics.unwrap(rs.p3) isa SymbolicUtils.BasicSymbolic{Int64}
55-
@test Symbolics.unwrap(rs.d3) isa SymbolicUtils.BasicSymbolic{Int64}
56-
@test Symbolics.unwrap(rs.p4) isa SymbolicUtils.BasicSymbolic{Float32}
57-
@test Symbolics.unwrap(rs.d4) isa SymbolicUtils.BasicSymbolic{Rational{Int64}}
58-
@test Symbolics.unwrap(rs.p5) isa SymbolicUtils.BasicSymbolic{Rational{Int64}}
59-
@test Symbolics.unwrap(rs.d5) isa SymbolicUtils.BasicSymbolic{Float32}
50+
@test Symbolics.unwrap(rs.p1) isa BasicSymbolic{Real}
51+
@test Symbolics.unwrap(rs.d1) isa BasicSymbolic{Real}
52+
@test Symbolics.unwrap(rs.p2) isa BasicSymbolic{Float64}
53+
@test Symbolics.unwrap(rs.d2) isa BasicSymbolic{Float64}
54+
@test Symbolics.unwrap(rs.p3) isa BasicSymbolic{Int64}
55+
@test Symbolics.unwrap(rs.d3) isa BasicSymbolic{Int64}
56+
@test Symbolics.unwrap(rs.p4) isa BasicSymbolic{Float32}
57+
@test Symbolics.unwrap(rs.d4) isa BasicSymbolic{Rational{Int64}}
58+
@test Symbolics.unwrap(rs.p5) isa BasicSymbolic{Rational{Int64}}
59+
@test Symbolics.unwrap(rs.d5) isa BasicSymbolic{Float32}
6060
end
6161

6262
# Tests that simulations with differentially typed variables yields correct results.

test/reactionsystem_core/symbolic_stoichiometry.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Fetch packages.
44
using Catalyst, JumpProcesses, OrdinaryDiffEq, StochasticDiffEq, Statistics, Test
5-
using Symbolics: unwrap
5+
using Symbolics: BasicSymbolic, unwrap
66

77
# Sets stable rng number.
88
using StableRNGs
@@ -46,8 +46,8 @@ let
4646
@test rs1 == rs2 == rs3
4747
@test issetequal(unknowns(rs1), [X, Y])
4848
@test issetequal(parameters(rs1), [p, k, d, n1, n2, n3])
49-
@test unwrap(d) isa SymbolicUtils.BasicSymbolic{Float64}
50-
@test unwrap(n1) isa SymbolicUtils.BasicSymbolic{Int64}
49+
@test unwrap(d) isa BasicSymbolic{Float64}
50+
@test unwrap(n1) isa BasicSymbolic{Int64}
5151
end
5252

5353
# Declares a network, parameter values, and initial conditions, to be used for the next couple of tests.

test/spatial_modelling/lattice_reaction_systems.jl

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Fetch packages.
44
using Catalyst, Graphs, Test
5-
using Symbolics: unwrap
5+
using Symbolics: BasicSymbolic, unwrap
66
t = default_t()
77

88
# Pre declares a grid.
@@ -311,19 +311,19 @@ end
311311

312312
# Loops through all parameters, ensuring that they have the correct type
313313
p_types = Dict([ModelingToolkit.nameof(p) => typeof(unwrap(p)) for p in parameters(lrs)])
314-
@test p_types[:k1] == SymbolicUtils.BasicSymbolic{Real}
315-
@test p_types[:l1] == SymbolicUtils.BasicSymbolic{Real}
316-
@test p_types[:k2] == SymbolicUtils.BasicSymbolic{Float64}
317-
@test p_types[:l2] == SymbolicUtils.BasicSymbolic{Float64}
318-
@test p_types[:k3] == SymbolicUtils.BasicSymbolic{Int64}
319-
@test p_types[:l3] == SymbolicUtils.BasicSymbolic{Int64}
320-
@test p_types[:k4] == SymbolicUtils.BasicSymbolic{Float32}
321-
@test p_types[:l4] == SymbolicUtils.BasicSymbolic{Float32}
322-
@test p_types[:k5] == SymbolicUtils.BasicSymbolic{Rational{Int64}}
323-
@test p_types[:l5] == SymbolicUtils.BasicSymbolic{Rational{Int64}}
324-
@test p_types[:D1] == SymbolicUtils.BasicSymbolic{Float32}
325-
@test p_types[:D2] == SymbolicUtils.BasicSymbolic{Real}
326-
@test p_types[:D3] == SymbolicUtils.BasicSymbolic{Rational{Int64}}
314+
@test p_types[:k1] == BasicSymbolic{Real}
315+
@test p_types[:l1] == BasicSymbolic{Real}
316+
@test p_types[:k2] == BasicSymbolic{Float64}
317+
@test p_types[:l2] == BasicSymbolic{Float64}
318+
@test p_types[:k3] == BasicSymbolic{Int64}
319+
@test p_types[:l3] == BasicSymbolic{Int64}
320+
@test p_types[:k4] == BasicSymbolic{Float32}
321+
@test p_types[:l4] == BasicSymbolic{Float32}
322+
@test p_types[:k5] == BasicSymbolic{Rational{Int64}}
323+
@test p_types[:l5] == BasicSymbolic{Rational{Int64}}
324+
@test p_types[:D1] == BasicSymbolic{Float32}
325+
@test p_types[:D2] == BasicSymbolic{Real}
326+
@test p_types[:D3] == BasicSymbolic{Rational{Int64}}
327327
end
328328

329329
# Checks that programmatically declared parameters (with types) can be used in `TransportReaction`s.
@@ -338,9 +338,9 @@ end
338338
lrs = LatticeReactionSystem(rs, [tr], grid)
339339

340340
p_types = Dict([ModelingToolkit.nameof(p) => typeof(unwrap(p)) for p in parameters(lrs)])
341-
@test p_types[:p] == SymbolicUtils.BasicSymbolic{Float32}
342-
@test p_types[:d] == SymbolicUtils.BasicSymbolic{Real}
343-
@test p_types[:D] == SymbolicUtils.BasicSymbolic{Rational{Int64}}
341+
@test p_types[:p] == BasicSymbolic{Float32}
342+
@test p_types[:d] == BasicSymbolic{Real}
343+
@test p_types[:D] == BasicSymbolic{Rational{Int64}}
344344

345345
u0 = [:X => [0.25, 0.5, 2.0, 4.0]]
346346
ps = [rs.p => 2.0, rs.d => 1.0, D => 1//2]

0 commit comments

Comments
 (0)