Skip to content

Commit 3f3f3c6

Browse files
authored
Merge pull request #928 from SciML/fix_depricated_methods
[v14 - Ready] Fix deprecated method usage and unnecessary prints while tests run
2 parents 8fbdc46 + 0f6cab6 commit 3f3f3c6

File tree

16 files changed

+106
-101
lines changed

16 files changed

+106
-101
lines changed

Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ DomainSets = "5b8099bc-c8ec-5219-889f-1d9e522a28bf"
6767
Graphviz_jll = "3c863552-8265-54e4-a6dc-903eb78fde85"
6868
HomotopyContinuation = "f213a82b-91d6-5c5d-acf7-10f1c761b327"
6969
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
70+
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
7071
NonlinearSolve = "8913a72c-1f9b-4ce2-8d82-65094dcecaec"
7172
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
7273
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
@@ -83,4 +84,4 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
8384
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
8485

8586
[targets]
86-
test = ["BifurcationKit", "DiffEqCallbacks", "DomainSets", "Graphviz_jll", "HomotopyContinuation", "NonlinearSolve", "OrdinaryDiffEq", "Plots", "Random", "SafeTestsets", "SciMLBase", "SciMLNLSolve", "StableRNGs", "Statistics", "SteadyStateDiffEq", "StochasticDiffEq", "StructuralIdentifiability", "Test", "Unitful"]
87+
test = ["BifurcationKit", "DiffEqCallbacks", "DomainSets", "Graphviz_jll", "HomotopyContinuation", "Logging", "NonlinearSolve", "OrdinaryDiffEq", "Plots", "Random", "SafeTestsets", "SciMLBase", "SciMLNLSolve", "StableRNGs", "Statistics", "SteadyStateDiffEq", "StochasticDiffEq", "StructuralIdentifiability", "Test", "Unitful"]

ext/CatalystBifurcationKitExtension/bifurcation_kit_extension.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
function BK.BifurcationProblem(rs::ReactionSystem, u0_bif, ps, bif_par, args...;
55
plot_var = nothing, record_from_solution = BK.record_sol_default, jac = true, u0 = [], kwargs...)
66
if !isautonomous(rs)
7-
error("Attempting to create a `BifurcationProblem` for a non-autonomous system (e.g. where some rate depend on $(rs.iv)). This is not possible.")
7+
error("Attempting to create a `BifurcationProblem` for a non-autonomous system (e.g. where some rate depend on $(get_iv(rs))). This is not possible.")
88
end
99

1010
# Converts symbols to symbolics.

ext/CatalystHomotopyContinuationExtension/homotopy_continuation_extension.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Notes:
3838
function Catalyst.hc_steady_states(rs::ReactionSystem, ps; filter_negative = true,
3939
neg_thres = -1e-20, u0 = [], kwargs...)
4040
if !isautonomous(rs)
41-
error("Attempting to compute steady state for a non-autonomous system (e.g. where some rate depend on $(rs.iv)). This is not possible.")
41+
error("Attempting to compute steady state for a non-autonomous system (e.g. where some rate depend on $(get_iv(rs))). This is not possible.")
4242
end
4343
ss_poly = steady_state_polynomial(rs, ps, u0)
4444
sols = HC.real_solutions(HC.solve(ss_poly; kwargs...))
@@ -67,7 +67,7 @@ function make_int_exps(expr)
6767
wrap(Rewriters.Postwalk(Rewriters.PassThrough(___make_int_exps))(unwrap(expr))).val
6868
end
6969
function ___make_int_exps(expr)
70-
!istree(expr) && return expr
70+
!iscall(expr) && return expr
7171
if (operation(expr) == ^)
7272
if isinteger(arguments(expr)[2])
7373
return arguments(expr)[1]^Int64(arguments(expr)[2])

ext/CatalystStructuralIdentifiabilityExtension.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ module CatalystStructuralIdentifiabilityExtension
22

33
# Fetch packages.
44
using Catalyst
5+
import DataStructures.OrderedDict
56
import StructuralIdentifiability as SI
67

78
# Creates and exports hc_steady_states function.

ext/CatalystStructuralIdentifiabilityExtension/structural_identifiability_extension.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ function make_measured_quantities(
189189
rs::ReactionSystem, measured_quantities::Vector{T}, known_p::Vector{S},
190190
conseqs; ignore_no_measured_warn = false) where {T, S}
191191
# Warning if the user didn't give any measured quantities.
192-
if ignore_no_measured_warn || isempty(measured_quantities)
193-
@warn "No measured quantity provided to the `measured_quantities` argument, any further identifiability analysis will likely fail. You can disable this warning by setting `ignore_no_measured_warn=true`."
192+
if !ignore_no_measured_warn && isempty(measured_quantities)
193+
@warn "No measured quantity provided to the `measured_quantities` argument, any further identifiability analysis will likely fail. You can disable this warning by setting `ignore_no_measured_warn = true`."
194194
end
195195

196196
# Appends the known parameters to the measured_quantities vector. Converts any Symbols to symbolics.
@@ -220,9 +220,9 @@ end
220220
# Sorts the output according to their input order (defaults to the `[unknowns; parameters]` order).
221221
function make_output(out, funcs_to_check, conseqs)
222222
funcs_to_check = vector_subs(funcs_to_check, conseqs)
223-
out = Dict(zip(vector_subs(keys(out), conseqs), values(out)))
223+
out = OrderedDict(zip(vector_subs(keys(out), conseqs), values(out)))
224224
sortdict = Dict(ftc => i for (i, ftc) in enumerate(funcs_to_check))
225-
return sort(out; by = x -> sortdict[x])
225+
return sort!(out; by = x -> sortdict[x])
226226
end
227227

228228
# For a vector of expressions and a conservation law, substitutes the law into every equation.

src/reactionsystem.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1479,4 +1479,4 @@ function validate(rs::ReactionSystem, info::String = "")
14791479
end
14801480

14811481
# Checks if a unit consist of exponents with base 1 (and is this unitless).
1482-
unitless_exp(u) = istree(u) && (operation(u) == ^) && (arguments(u)[1] == 1)
1482+
unitless_exp(u) = iscall(u) && (operation(u) == ^) && (arguments(u)[1] == 1)

src/reactionsystem_conversions.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ function Base.convert(::Type{<:NonlinearSystem}, rs::ReactionSystem; name = name
520520
iscomplete(rs) || error(COMPLETENESS_ERROR)
521521
spatial_convert_err(rs::ReactionSystem, NonlinearSystem)
522522
if !isautonomous(rs)
523-
error("Attempting to convert a non-autonomous `ReactionSystem` (e.g. where some rate depend on $(rs.iv)) to a `NonlinearSystem`. This is not possible. if you are intending to compute system steady states, consider creating and solving a `SteadyStateProblem.")
523+
error("Attempting to convert a non-autonomous `ReactionSystem` (e.g. where some rate depend on $(get_iv(rs))) to a `NonlinearSystem`. This is not possible. if you are intending to compute system steady states, consider creating and solving a `SteadyStateProblem.")
524524
end
525525

526526
# Generates system equations.

src/reactionsystem_serialisation/serialisation_support.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ const SKIPPED_METADATA = [ModelingToolkit.MTKVariableTypeCtx, Symbolics.Variable
240240
# Potentially strips the call for a symbolics. E.g. X(t) becomes X (but p remains p). This is used
241241
# when variables are written to files, as in code they are used without the call part.
242242
function strip_call(sym)
243-
return istree(sym) ? Sym{Real}(Symbolics.getname(sym)) : sym
243+
return iscall(sym) ? Sym{Real}(Symbolics.getname(sym)) : sym
244244
end
245245

246246
# For an vector of symbolics, creates a dictionary taking each symbolics to each call-stripped form.

src/reactionsystem_serialisation/serialise_reactionsystem.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,13 @@ function make_reaction_system_call(rs::ReactionSystem, annotate, top_level, has_
154154
has_connection_type && (@string_append! reaction_system_string ", connection_type")
155155

156156
# Potentially appends a combinatoric_ratelaws statement.
157-
if !Symbolics.unwrap(rs.combinatoric_ratelaws)
157+
if !Symbolics.unwrap(combinatoric_ratelaws(rs))
158158
@string_append! reaction_system_string ", combinatoric_ratelaws = false"
159159
end
160160

161161
# Potentially appends `ReactionSystem` metadata value(s). Weird composite types are not supported.
162-
if !isnothing(rs.metadata)
163-
@string_append! reaction_system_string ", metadata = $(x_2_string(rs.metadata))"
162+
if !isnothing(MT.get_metadata(rs))
163+
@string_append! reaction_system_string ", metadata = $(x_2_string(MT.get_metadata(rs)))"
164164
end
165165

166166
# Finalises the call. Appends potential annotation. If the system is complete, add a call for this.

src/steady_state_stability.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function steady_state_stability(u::Vector, rs::ReactionSystem, ps;
4848
tol = 10 * sqrt(eps(ss_val_type(u))), ss_jac = steady_state_jac(rs; u0 = u))
4949
# Warning checks.
5050
if !isautonomous(rs)
51-
error("Attempting to compute stability for a non-autonomous system (e.g. where some rate depend on $(rs.iv)). This is not possible.")
51+
error("Attempting to compute stability for a non-autonomous system (e.g. where some rate depend on $(get_iv(rs))). This is not possible.")
5252
end
5353

5454
# If `u` is a vector of values, we convert it to a map. Also, if there are conservation laws,

0 commit comments

Comments
 (0)