Skip to content

Commit

Permalink
Fix const parameter handling in bat_report
Browse files Browse the repository at this point in the history
  • Loading branch information
oschulz committed Jul 25, 2024
1 parent 7d9844f commit ac8786c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/statistics/report.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@ function marginal_table(smplv::DensitySampleVector)
end


function fixed_parameter_table(smplv::DensitySampleVector)
function _rpt_table_of_constparvals(smplv::DensitySampleVector)
vs = elshape(smplv.v)
parkeys = Symbol.(get_fixed_names(vs))
parvalues = [getproperty(vs, f).shape.value for f in parkeys]
TypedTables.Table(parameter = parkeys, value = string.(parvalues))
# Need to convert, otherwise these can become Vector{Union{}} if parkeys is empty:
parkeys = convert(Vector{Symbol}, Symbol.(get_fixed_names(vs)))::Vector{Symbol}
parvalues = convert(Vector{Any}, [getproperty(vs, f).shape.value for f in parkeys])
str_parvalues = convert(Vector{String}, string.(parvalues))::Vector{String}
TypedTables.Table(parameter = parkeys, value = str_parvalues)
end


Expand Down Expand Up @@ -92,7 +94,7 @@ function bat_report!(md::Markdown.MD, smplv::DensitySampleVector)
marg_headermap = Dict(:parameter => "Parameter", :mean => "Mean", :std => "Std. dev.", :global_mode => "Gobal mode", :marginal_mode => "Marg. mode", :credible_intervals => "Cred. interval", :marginal_histogram => "Histogram")
push!(md.content, BAT.markdown_table(Tables.columns(mod_marg_tbl), headermap = marg_headermap, align = [:l, :l, :l, :l, :l, :c, :l]))

fixed_tbl = fixed_parameter_table(smplv)
fixed_tbl = _rpt_table_of_constparvals(smplv)
if !isempty(fixed_tbl)
markdown_append!(md, """
### Fixed parameters
Expand Down

0 comments on commit ac8786c

Please sign in to comment.