Skip to content

Commit f9ea656

Browse files
committed
add docs on dump_state
1 parent b36a3e3 commit f9ea656

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

docs/src/API.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ vpidxs
9393
epidxs
9494
```
9595

96+
### Solution Inspection
97+
```@docs
98+
dump_state
99+
```
100+
96101
## Metadata API
97102
### Component Metadata API
98103
```@docs

src/metadata.jl

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -296,12 +296,12 @@ function _get_initial_observed(cf)
296296
end
297297

298298
"""
299-
dump_initial_state(cf::ComponentModel; sigdigits=5, p=true, obs=true)
299+
dump_initial_state([IO=stdout], cf::ComponentModel; sigdigits=5, p=true, obs=true)
300300
301-
Prints the initial state of the component model `cf` to the console. Optionally
301+
Prints the initial state of the component model `cf` to `IO` (defaults to stdout). Optionally
302302
contains parameters and observed.
303303
304-
See also: [`get_initial_state`](@ref).
304+
See also: [`get_initial_state`](@ref) and [`dump_state`](@ref).
305305
"""
306306
dump_initial_state(cf::ComponentModel; kwargs...) = dump_initial_state(stdout, cf; kwargs...)
307307
function dump_initial_state(io, cf::ComponentModel; sigdigits=5, p=true, obs=true)
@@ -408,7 +408,20 @@ function _printlines(io, aligned, range; newline=true)
408408
end
409409
end
410410

411-
dump_state(sol, idx, t; kwargs...) = dump_state(stdout, sol, idx, t; kwargs...)
411+
"""
412+
dump_state([IO=stdout], sol, t, idx; sigdigits=5)
413+
414+
Takes a Network solution `sol` and prints the state at `t` as well as the initial
415+
state of the specified component model to `IO` (defaults to `stdout`).
416+
417+
`idx` musst a valid component index, i.e. `VIndex` or `EIndex` without symbol specification.
418+
419+
dump_state(sol, 1.0, VIndex(4))
420+
dump_state(sol, 1.0, EIndex(2))
421+
422+
See also: [`dump_initial_state`](@ref).
423+
"""
424+
dump_state(sol, t, idx; kwargs...) = dump_state(stdout, sol, t, idx; kwargs...)
412425
function dump_state(io, sol, t, idx; sigdigits=3)
413426
cf = extract_nw(sol)[idx]
414427
_sym = sort(sym(cf))

0 commit comments

Comments
 (0)