Skip to content

Commit

Permalink
Improve SteadyStateFitResult's show
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf committed Sep 24, 2019
1 parent 6e4220f commit 1f00bea
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/SteadyStateFit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ else
prettylens(x; kwargs...) = sprint(print, x; kwargs...)
end

include("utils.jl")
include("znlsolve.jl")
include("objectives.jl")
include("solvers.jl")
Expand Down
4 changes: 2 additions & 2 deletions src/solvers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ function Base.show(io::IO, ::MIME"text/plain", fit::SteadyStateFitResult)
println(io, """
SteadyStateFitResult
* Loss:
$(summary(sso.loss))
$(shortsummary(sso.loss; context=io))
* Model:
$(summary(sso.p))
$(shortsummary(sso.p; context=io))
* Parameters:
$(prettylens(sso.parameterlens; context=io))
Expand Down
14 changes: 14 additions & 0 deletions src/utils.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
function shortsummary(x; context=devnull)
context = IOContext(
context,
:compact => true,
:limit => true,
)
return first(sort(
[
sprint(summary, x; context=context),
sprint(print, x; context=context),
],
by = length,
))
end

0 comments on commit 1f00bea

Please sign in to comment.