Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handing of const parameters in bat_report #447

Merged
merged 2 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
run: which julia
continue-on-error: true
- name: Install Julia, but only if it is not already available in the PATH
uses: julia-actions/setup-julia@v1
uses: julia-actions/setup-julia@v2
with:
version: '1'
arch: ${{ runner.arch }}
Expand Down
13 changes: 0 additions & 13 deletions .github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,7 @@ on:
lookback:
default: 3
permissions:
actions: read
checks: read
contents: write
deployments: read
issues: read
discussions: read
packages: read
pages: read
pull-requests: read
repository-projects: read
security-events: read
statuses: read
jobs:
TagBot:
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
Expand All @@ -28,6 +17,4 @@ jobs:
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
# Edit the following line to reflect the actual name of the GitHub Secret containing your private key
ssh: ${{ secrets.DOCUMENTER_KEY }}
# ssh: ${{ secrets.NAME_OF_MY_SSH_PRIVATE_KEY_SECRET }}
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ jobs:
arch: x64
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/cache@v1
with:
cache-packages: "false"
- uses: julia-actions/cache@v2
#with:
# cache-packages: "false"
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
with:
Expand All @@ -72,12 +72,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
- uses: julia-actions/setup-julia@v2
with:
version: '1'
- uses: julia-actions/cache@v1
with:
cache-packages: "false"
- uses: julia-actions/cache@v2
#with:
# cache-packages: "false"
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-docdeploy@v1
env:
Expand Down
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 @@
end


function fixed_parameter_table(smplv::DensitySampleVector)
function _rpt_table_of_constparvals(smplv::DensitySampleVector)

Check warning on line 59 in src/statistics/report.jl

View check run for this annotation

Codecov / codecov/patch

src/statistics/report.jl#L59

Added line #L59 was not covered by tests
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)

Check warning on line 65 in src/statistics/report.jl

View check run for this annotation

Codecov / codecov/patch

src/statistics/report.jl#L62-L65

Added lines #L62 - L65 were not covered by tests
end


Expand Down Expand Up @@ -92,7 +94,7 @@
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)

Check warning on line 97 in src/statistics/report.jl

View check run for this annotation

Codecov / codecov/patch

src/statistics/report.jl#L97

Added line #L97 was not covered by tests
if !isempty(fixed_tbl)
markdown_append!(md, """
### Fixed parameters
Expand Down
Loading