Catalyst.jl
Catalyst.jl copied to clipboard
non-SI units not working
SI units works, i.e.
@test_nowarn @reaction_network begin
@ivs t [unit=u"s"]
@species begin
X1(t), [unit=u"mol/m^3"]
Z1(t), [unit=u"mol/m^3"]
X2(t), [unit=u"mol/m^3"]
Z2(t), [unit=u"mol/m^3"]
X3(t), [unit=u"mol/m^3"]
Y3(t), [unit=u"mol/m^3"]
Z3(t), [unit=u"mol/m^3"]
end
@parameters begin
k1, [unit=u"(m^6)/(s*mol^2)"]
v2, [unit=u"(m^6)/(s*mol^2)"]
K2, [unit=u"mol/m^3"]
v3, [unit=u"(m^3)/(s*mol)"]
K3, [unit=u"mol/m^3"]
n3
end
k1*X1, 2X1 --> Z1
mm(X2, v2, K2), 3X2 --> Z2
hill(X3, v3, K3, n3), X3 + Y3--> Z3
end
passes, but non-SI units still have issues right now:
@test_nowarn @reaction_network begin
@ivs t [unit=u"s"]
@species begin
X1(t), [unit=u"μM"]
Z1(t), [unit=u"μM"]
X2(t), [unit=u"μM"]
Z2(t), [unit=u"μM"]
X3(t), [unit=u"μM"]
Y3(t), [unit=u"μM"]
Z3(t), [unit=u"μM"]
end
@parameters begin
k1, [unit=u"1/(s*(μM)^2)"]
v2, [unit=u"1/(s*(μM)^2)"]
K2, [unit=u"μM"]
v3, [unit=u"1/(s*μM)"]
K3, [unit=u"μM"]
n3
end
k1*X1, 2X1 --> Z1
mm(X2, v2, K2), 3X2 --> Z2
hill(X3, v3, K3, n3), X3 + Y3--> Z3
end
gives
┌ Warning: Reaction rate laws are expected to have units of 0.0009999999999999998 m⁻³ s⁻¹ mol however, k1*X1(t), 2*X1 --> Z1 has units of 9.999999999999995e-7 m⁻³ s⁻¹ mol.
└ @ Catalyst ~/.julia/dev/Catalyst/src/reactionsystem.jl:1492
┌ Warning: Reaction rate laws are expected to have units of 0.0009999999999999998 m⁻³ s⁻¹ mol however, Catalyst.mm(X2(t), v2, K2), 3*X2 --> Z2 has units of 9.999999999999992e-10 m⁻³ s⁻¹ mol.
└ @ Catalyst ~/.julia/dev/Catalyst/src/reactionsystem.jl:1492
┌ Warning: Reaction rate laws are expected to have units of 0.0009999999999999998 m⁻³ s⁻¹ mol however, Catalyst.hill(X3(t), v3, K3, n3), X3 + Y3 --> Z3 has units of 9.999999999999995e-7 m⁻³ s⁻¹ mol.
└ @ Catalyst ~/.julia/dev/Catalyst/src/reactionsystem.jl:1492
Test Failed at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-R17H3W25T9.0/build/default-honeycrisp-R17H3W25T9-0/julialang/julia-release-1-dot-10/usr/share/julia/stdlib/v1.10/Test/src/Test.jl:903
Expression: isempty(stderr_content)
Evaluated: isempty("┌ Warning: Reaction rate laws are expected to have units of 0.0009999999999999998 m⁻³ s⁻¹ mol however, k1*X1(t), 2*X1 --> Z1 has units of 9.999999999999995e-7 m⁻³ s⁻¹ mol.\n└ @ Catalyst ~/.julia/dev/Catalyst/src/reactionsystem.jl:1492\n┌ Warning: Reaction rate laws are expected to have units of 0.0009999999999999998 m⁻³ s⁻¹ mol however, Catalyst.mm(X2(t), v2, K2), 3*X2 --> Z2 has units of 9.999999999999992e-10 m⁻³ s⁻¹ mol.\n└ @ Catalyst ~/.julia/dev/Catalyst/src/reactionsystem.jl:1492\n┌ Warning: Reaction rate laws are expected to have units of 0.0009999999999999998 m⁻³ s⁻¹ mol however, Catalyst.hill(X3(t), v3, K3, n3), X3 + Y3 --> Z3 has units of 9.999999999999995e-7 m⁻³ s⁻¹ mol.\n└ @ Catalyst ~/.julia/dev/Catalyst/src/reactionsystem.jl:1492\n")
ERROR: There was an error during testing
So it seems there are still issues with unit conversion to SI going on.