Skip to content

Commit

Permalink
Fix caltable bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ptiede committed Oct 16, 2023
1 parent 70bc674 commit cf5cfb1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/bayes/bayes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ function DensityInterface.logdensityof(post::Posterior, x)
return logdensityof(post.lklhd, x) + pr
end

(post::Posterior)(θ) = logdensityof(post, θ)

"""
prior_sample([rng::AbstractRandom], post::Posterior, args...)
Expand Down Expand Up @@ -137,6 +139,9 @@ struct TransformedPosterior{P<:Posterior,T} <: AbstractPosterior
transform::T
end

(tpost::TransformedPosterior)(θ) = logdensityof(tpost, θ)


function prior_sample(rng, tpost::TransformedPosterior, args...)
inv = Base.Fix1(HypercubeTransform.inverse, tpost)
map(inv, prior_sample(rng, tpost.lpost, args...))
Expand Down
3 changes: 2 additions & 1 deletion src/calibration/caltable.jl
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@ end
function stations(g::JonesCache)
s1 = keys(g.seg)
if !(g.references isa AbstractVector{<:NoReference})
return sort(unique(vcat(s1, getproperty.(g.references, :site))))
s = (s1..., getproperty.(g.references, :site)...)
return sort(unique(s))
end
return sort(unique(s1))
end
Expand Down

0 comments on commit cf5cfb1

Please sign in to comment.