Sindbad.Visualization Module
VisualizationVisualization utilities for SINDBAD experiments. This module focuses on plotting model outputs, diagnostics, and experiment metadata via Plots.jl.
Purpose
Provide ready-to-use plotting helpers that understand SINDBAD's
info, outputs, and metric structures.Speed up exploratory analysis by wrapping common visual layouts (time series, site comparisons, diagnostic summaries).
Dependencies
Internal (within Sindbad)
namedTupleToFlareJSONandgetAllVariables(utilsVisualization.jl) have no external plotting dependency and are always available.
Optional (via SindbadPlotsExt)
plotPerformanceHistograms,plotTimeSeries, andplotIOModelStructuredispatch on aVisualizationTypesbackend value read frominfo.helpers.run.visualization_backend(set fromexe_rules.visualization_backendin the experiment config, defaulting to"Types"). The defaultVisualizationTypesbackend logs an info message and returnsnothing. Settingvisualization_backend = "Plots"in the config selects theVisualizationPlotsbackend, whose real plotting methods are only added oncePlots.jlis loaded, at which point Julia's package extension mechanism loadsSindbadPlotsExt(see rootProject.toml[weakdeps]+[extensions]).using Sindbadalone is sufficient oncePlotsis also loaded in the session — end users typically should notusing SindbadPlotsExtdirectly.plotTimeSeriesWithObsandplotTimeSeriesDebugare deprecated-but-supported aliases ofplotTimeSeries, kept for backward compatibility with their original signatures.
Notes
Additional plot recipes are being added progressively; current focus is on covering the default experiment workflow.
The API is reexported via
Sindbad.Visualization, so users simply loadSindbadto access plotting helpers (oncePlotsis loaded for the plotting functions).
Usage:
using Sindbad, Plots
plotPerformanceHistograms(opt_results)
plotIOModelStructure(info)Functions
namedTupleToFlareJSON
Sindbad.Visualization.namedTupleToFlareJSON Function
namedTupleToFlareJSON(info::NamedTuple)Convert a nested NamedTuple into a flare.json format suitable for d3.js visualization.
Arguments
info::NamedTuple: The input NamedTuple to convert
Returns
A dictionary in flare.json format with the following structure:
json{ "name": "root", "children": [ { "name": "field1", "children": [...] }, { "name": "field2", "value": 42 } ] }
Notes
The function recursively traverses the NamedTuple structure
Fields with no children are treated as leaf nodes with a value of 1
The structure is flattened to show the full path to each field
Examples
julia> using Sindbad
julia> # Convert experiment info to flare.json format
julia> # flare_json = namedTupleToFlareJSON(info)Code
function namedTupleToFlareJSON(info::NamedTuple)
function _convert_to_flare(nt::NamedTuple, name="sindbad_info")
children = []
for field in propertynames(nt)
value = getfield(nt, field)
if value isa NamedTuple
push!(children, _convert_to_flare(value, string(field)))
else
# println("field: $field, value: $value")
push!(children, Dict("name" => string(field), "value" => 1))
end
end
return Dict("name" => name, "children" => children)
end
return _convert_to_flare(info)
endplotIOModelStructure
Missing docstring.
Missing docstring for plotIOModelStructure. Check Documenter's build log for details.
Code
function plotIOModelStructure(info, which_function, which_field)
backend = info.helpers.run.visualization_backend
return plotIOModelStructure(info, which_function, which_field, _resolvedBackend(plotIOModelStructure, backend, info, which_function, which_field))
end
function plotIOModelStructure(info, which_function, which_field, ::VisualizationTypes)
print_info(plotIOModelStructure, @__FILE__, @__LINE__, _visualizationFallbackMessage(plotIOModelStructure, info.helpers.run.visualization_backend), n_f=4)
return nothing
endplotPerformanceHistograms
Missing docstring.
Missing docstring for plotPerformanceHistograms. Check Documenter's build log for details.
Code
function plotPerformanceHistograms(out_opti)
backend = out_opti.info.helpers.run.visualization_backend
return plotPerformanceHistograms(out_opti, _resolvedBackend(plotPerformanceHistograms, backend, out_opti))
end
function plotPerformanceHistograms(out_opti, ::VisualizationTypes)
print_info(plotPerformanceHistograms, @__FILE__, @__LINE__, _visualizationFallbackMessage(plotPerformanceHistograms, out_opti.info.helpers.run.visualization_backend), n_f=4)
return nothing
endplotTimeSeries
Missing docstring.
Missing docstring for plotTimeSeries. Check Documenter's build log for details.
Code
function plotTimeSeries(out_opti)
backend = out_opti.info.helpers.run.visualization_backend
return plotTimeSeries(out_opti, _resolvedBackend(plotTimeSeries, backend, out_opti))
end
function plotTimeSeries(out, cost_options)
backend = out.info.helpers.run.visualization_backend
return plotTimeSeries(out, cost_options, _resolvedBackend(plotTimeSeries, backend, out, cost_options))
end
function plotTimeSeries(info, opt_dat, def_dat)
backend = info.helpers.run.visualization_backend
return plotTimeSeries(info, opt_dat, def_dat, _resolvedBackend(plotTimeSeries, backend, info, opt_dat, def_dat))
end
function plotTimeSeriesWithObs(out, obs_array, cost_options)
backend = out.info.helpers.run.visualization_backend
return plotTimeSeries(out.info, obs_array, cost_options, out.output, _resolvedBackend(plotTimeSeries, backend, out.info, obs_array, cost_options, out.output))
end
function plotTimeSeries(out_opti, ::VisualizationTypes)
print_info(plotTimeSeries, @__FILE__, @__LINE__, _visualizationFallbackMessage(plotTimeSeries, out_opti.info.helpers.run.visualization_backend), n_f=4)
return nothing
end
function plotTimeSeries(out, cost_options, ::VisualizationTypes)
print_info(plotTimeSeries, @__FILE__, @__LINE__, _visualizationFallbackMessage(plotTimeSeries, out.info.helpers.run.visualization_backend), n_f=4)
return nothing
end
function plotTimeSeries(info, opt_dat, def_dat, ::VisualizationTypes)
print_info(plotTimeSeries, @__FILE__, @__LINE__, _visualizationFallbackMessage(plotTimeSeries, info.helpers.run.visualization_backend), n_f=4)
return nothing
end
function plotTimeSeries(info, obs_array, cost_options, def_dat, ::VisualizationTypes)
print_info(plotTimeSeries, @__FILE__, @__LINE__, _visualizationFallbackMessage(plotTimeSeries, info.helpers.run.visualization_backend), n_f=4)
return nothing
endplotTimeSeriesDebug
Missing docstring.
Missing docstring for plotTimeSeriesDebug. Check Documenter's build log for details.
plotTimeSeriesWithObs
Missing docstring.
Missing docstring for plotTimeSeriesWithObs. Check Documenter's build log for details.
Code
function plotTimeSeriesWithObs(out, obs_array, cost_options)
backend = out.info.helpers.run.visualization_backend
return plotTimeSeries(out.info, obs_array, cost_options, out.output, _resolvedBackend(plotTimeSeries, backend, out.info, obs_array, cost_options, out.output))
end