Skip to content

Commit

Permalink
Added assertion, uncommented println for issue #21
Browse files Browse the repository at this point in the history
  • Loading branch information
trappmartin committed Oct 6, 2018
1 parent 7240f38 commit a8d472e
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/chains.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,13 @@ function Base.getindex(c::Chains, window, names, chains)
end

function Base.setindex!(c::AbstractChains, value, iters, names, chains)
setindex!(c.value, value, iters2inds(c, iters), names2inds(c, names), chains)
nids = names2inds(c, names)
if nothing in nids
@error "Could not find $names in Chain."
end
setindex!(c.value, value, iters2inds(c, iters), nids, chains)
end

# this is currently broken
#macro mapiters(iters, c)
# quote
# ($(esc(iters)) - first($(esc(c)))) / step($(esc(c))) + 1.0
# end
#end

# this is a work around
mapiters(iters, c) = (collect(iters) .- first(c)) / step(c) .+ 1.

Expand Down Expand Up @@ -272,7 +269,7 @@ end

function header(c::AbstractChains)
string(
"Log model evidence = $(c.logevidence)\n",
# "Log model evidence = $(c.logevidence)\n", #FIXME: Uncomment.
"Iterations = $(first(c)):$(last(c))\n",
"Thinning interval = $(step(c))\n",
"Chains = $(join(map(string, c.chains), ","))\n",
Expand Down

0 comments on commit a8d472e

Please sign in to comment.