Skip to content

Commit 3c23553

Browse files
committed
fix all)unitless deprication
1 parent 3238c0e commit 3c23553

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/networkapi.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,9 +1633,10 @@ function validate(rs::ReactionSystem, info::String = "")
16331633
timeunits = get_unit(get_iv(rs))
16341634

16351635
# no units for species, time or parameters then assume validated
1636-
(specunits in (MT.unitless, nothing)) && (timeunits in (MT.unitless, nothing)) &&
1637-
MT.all_dimensionless(get_ps(rs)) && return true
1638-
1636+
if (specunits in (MT.unitless, nothing)) && (timeunits in (MT.unitless, nothing))
1637+
all(u == 1.0 for u in ModelingToolkit.get_unit(get_ps(rs))) || return true
1638+
end
1639+
16391640
rateunits = specunits / timeunits
16401641
for rx in get_rxs(rs)
16411642
rxunits = get_unit(rx.rate)

src/reactionsystem.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,8 +532,10 @@ struct ReactionSystem{V <: NetworkProperties} <:
532532
end
533533

534534
if isempty(sivs) && (checks == true || (checks & MT.CheckUnits) > 0)
535-
nonrx_eqs = Equation[eq for eq in eqs if eq isa Equation]
536-
MT.all_dimensionless([unknowns; ps; iv]) || check_units(nonrx_eqs)
535+
if !all(u == 1.0 for u in ModelingToolkit.get_unit([unknowns; ps; iv]))
536+
nonrx_eqs = Equation[eq for eq in eqs if eq isa Equation]
537+
check_units(nonrx_eqs)
538+
end
537539
end
538540

539541
rs = new{typeof(nps)}(eqs, rxs, iv, sivs, unknowns, spcs, ps, var_to_name, observed,

0 commit comments

Comments
 (0)