Skip to content
Sindbad.Visualization Module
julia
Visualization

Visualization 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)

  • namedTupleToFlareJSON and getAllVariables (utilsVisualization.jl) have no external plotting dependency and are always available.

Optional (via SindbadPlotsExt)

  • plotPerformanceHistograms, plotTimeSeries, and plotIOModelStructure dispatch on a VisualizationTypes backend value read from info.helpers.run.visualization_backend (set from exe_rules.visualization_backend in the experiment config, defaulting to "Types"). The default VisualizationTypes backend logs an info message and returns nothing. Setting visualization_backend = "Plots" in the config selects the VisualizationPlots backend, whose real plotting methods are only added once Plots.jl is loaded, at which point Julia's package extension mechanism loads SindbadPlotsExt (see root Project.toml [weakdeps] + [extensions]). using Sindbad alone is sufficient once Plots is also loaded in the session — end users typically should not using SindbadPlotsExt directly.

  • plotTimeSeriesWithObs and plotTimeSeriesDebug are deprecated-but-supported aliases of plotTimeSeries, 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 load Sindbad to access plotting helpers (once Plots is loaded for the plotting functions).

Usage:

julia
using Sindbad, Plots

plotPerformanceHistograms(opt_results)
plotIOModelStructure(info)
source

Functions

namedTupleToFlareJSON

Sindbad.Visualization.namedTupleToFlareJSON Function
julia
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
julia> using Sindbad

julia> # Convert experiment info to flare.json format
julia> # flare_json = namedTupleToFlareJSON(info)
source
Code
julia
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)
end

plotIOModelStructure

Missing docstring.

Missing docstring for plotIOModelStructure. Check Documenter's build log for details.

Code
julia
    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
    end

plotPerformanceHistograms

Missing docstring.

Missing docstring for plotPerformanceHistograms. Check Documenter's build log for details.

Code
julia
    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
    end

plotTimeSeries

Missing docstring.

Missing docstring for plotTimeSeries. Check Documenter's build log for details.

Code
julia
    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
    end

plotTimeSeriesDebug

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
julia
    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