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

Make bat_marginalize return namedtuple #133

Merged
merged 4 commits into from
Jun 9, 2020
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
16 changes: 11 additions & 5 deletions src/plotting/MarginalDist.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ function bat_marginalize(
normalize ? hist = StatsBase.normalize(hist) : nothing

uvbd = EmpiricalDistributions.UvBinnedDist(hist)
marg = MarginalDist((idx,), uvbd, varshape(maybe_shaped_samples))

return MarginalDist((idx,), uvbd, varshape(maybe_shaped_samples))
return (result = marg, )
end


Expand Down Expand Up @@ -59,8 +60,9 @@ function bat_marginalize(
normalize ? hist = StatsBase.normalize(hist) : nothing

mvbd = EmpiricalDistributions.MvBinnedDist(hist)
marg = MarginalDist(idxs, mvbd, varshape(maybe_shaped_samples))

return MarginalDist(idxs, mvbd, varshape(maybe_shaped_samples))
return (result = marg, )
end


Expand All @@ -80,8 +82,9 @@ function bat_marginalize(
normalize ? hist = StatsBase.normalize(hist) : nothing

uvbd = EmpiricalDistributions.UvBinnedDist(hist)
marg = MarginalDist((idx,), uvbd, varshape(prior))

return MarginalDist((idx,), uvbd, varshape(prior))
return (result = marg, )
end


Expand All @@ -103,8 +106,9 @@ function bat_marginalize(
normalize ? hist = StatsBase.normalize(hist) : nothing

mvbd = EmpiricalDistributions.MvBinnedDist(hist)
marg = MarginalDist(idxs, mvbd, varshape(prior))

return MarginalDist(idxs, mvbd, varshape(prior))
return (result = marg, )
end


Expand Down Expand Up @@ -132,5 +136,7 @@ function bat_marginalize(
EmpiricalDistributions.MvBinnedDist(hist)
end

return MarginalDist(parsel, bd, original.origvalshape)
marg = MarginalDist(parsel, bd, original.origvalshape)

return (result = marg, )
end
2 changes: 1 addition & 1 deletion src/plotting/recipes_MarginalDist_1D.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ end
)
indx = asindex(origmarg, parsel)

marg = bat_marginalize(origmarg, (indx, ))
marg = bat_marginalize(origmarg, (indx, )).result
hist = marg.dist.h
normalize ? hist=StatsBase.normalize(hist) : nothing

Expand Down
4 changes: 2 additions & 2 deletions src/plotting/recipes_prior.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
nsamples = nsamples,
closed = closed,
normalize = normalize
)
).result

xlabel = if isa(parsel, Symbol) || isa(parsel, Expr)
"$parsel"
Expand Down Expand Up @@ -96,7 +96,7 @@ end
nbins = bins,
closed = closed,
normalize = normalize
)
).result


xlabel, ylabel = if isa(parsel, Symbol) || isa(parsel, Expr)
Expand Down
2 changes: 1 addition & 1 deletion src/plotting/recipes_samples_1D.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
closed = closed,
filter = filter,
normalize = normalize
)
).result

orientation = get(plotattributes, :orientation, :vertical)
(orientation != :vertical) ? swap=true : swap = false
Expand Down
2 changes: 1 addition & 1 deletion src/plotting/recipes_samples_2D.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
nbins = bins,
closed = closed,
filter = filter
)
).result

if seriestype == :scatter
base_markersize = get(plotattributes, :markersize, 1.5)
Expand Down