From 668bffae6b1744bf31cd44e9f75a88778ace515c Mon Sep 17 00:00:00 2001 From: Herman Sletmoen Date: Sun, 20 Oct 2024 20:44:09 +0200 Subject: [PATCH] Show separate Observed: category instead of mashing it in Equations: --- src/systems/abstractsystem.jl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/systems/abstractsystem.jl b/src/systems/abstractsystem.jl index 1a3c725166..ddaeb172f3 100644 --- a/src/systems/abstractsystem.jl +++ b/src/systems/abstractsystem.jl @@ -1927,12 +1927,10 @@ function Base.show(io::IO, mime::MIME"text/plain", sys::AbstractSystem; hint = t if eqs isa AbstractArray && eltype(eqs) <: Equation neqs = count(eq -> !(eq.lhs isa Connection), eqs) next = n_expanded_connection_equations(sys) - nobs = has_observed(sys) ? length(observed(sys)) : 0 - ntot = neqs + next + nobs + ntot = neqs + next ntot > 0 && printstyled(io, "\nEquations ($ntot):"; bold) neqs > 0 && print(io, "\n $neqs standard", hint ? ": see equations(sys)" : "") next > 0 && print(io, "\n $next connecting", hint ? ": see equations(expand_connections(sys))" : "") - nobs > 0 && print(io, "\n $nobs observed", hint ? ": see observed(sys)" : "") #Base.print_matrix(io, eqs) # usually too long and not useful to print all equations end @@ -1969,6 +1967,11 @@ function Base.show(io::IO, mime::MIME"text/plain", sys::AbstractSystem; hint = t limited && printstyled(io, "\n ⋮") # too many variables to print end + # Print observed + nobs = has_observed(sys) ? length(observed(sys)) : 0 + nobs > 0 && printstyled(io, "\nObserved ($nobs):"; bold) + nobs > 0 && hint && print(io, " see observed(sys)") + return nothing end