Skip to content

Commit

Permalink
stuff for initial preliminary release
Browse files Browse the repository at this point in the history
  • Loading branch information
orlox committed Dec 29, 2022
1 parent 3427ced commit 0d318f3
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 95 deletions.
33 changes: 31 additions & 2 deletions StarStats/src/ChainAnalysis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export create_corner_plot, create_2D_density, create_1D_density
function create_corner_plot(chain_values,names,label_names, chain_weights, fractions, fraction_1D, figure; show_CIs = false)
ga = figure[1, 1] = GridLayout()

num_col = length(chain_values)-1
num_col = length(names)-1
for i in 1:num_col
for j in i+1:num_col+1
axis = Axis(ga[j,i],xtickalign=1,xtickcolor = :white,ytickalign=1,ytickcolor = :white,
Expand All @@ -35,6 +35,7 @@ function create_corner_plot(chain_values,names,label_names, chain_weights, fract
if show_CIs
axis.title = "$(xmode)^$(xmax-xmode)_$(xmode-xmin)"
end
print(label_names[i]*"="*"$(xmode)^$(xmax-xmode)_$(xmode-xmin)\n")
end
rowgap!(ga,10)
colgap!(ga,10)
Expand Down Expand Up @@ -96,4 +97,32 @@ function create_1D_density(values, chain_weights,fraction_1D,axis)

return (xmin, xmode, xmax)

end
end

function concatenate_chains(star_chains)
concatenated_chains = Dict()
for name in Base.names(star_chains)
concatenated_chains[name] = star_chains[:,name,:][:]
end
return concatenated_chains
end

function compute_chain_weights(cchains)
dtdx=zeros(length(cchains[:x]))
for i in 1:length(dtdx)
dtdx[i]= interpolate_grid_quantity(grid,[cchains[:rotation][i], cchains[:logM][i], cchains[:overshoot][i]],:dtdx,cchains[:x][i])
end
return dtdx .* cchains[:logM].^-1.35
end

function get_star_corner_plot(star_chains)
names = [:logM, :rotation, :overshoot]
cchains = concatenate_chains(star_chains)
chain_weights = compute_chain_weights(cchains)
fractions =[0.68,0.95, 0.997]
fraction_1D = 0.68
figure= Figure()
label_names = [L"\log(M/M_{\odot})", L"\omega/\omega_{crit}", L"\alpha_\mathrm{ov}" ]

create_corner_plot(chain_values,names,label_names, chain_weights, fractions, fraction_1D, figure, show_CIs = false)
end
174 changes: 81 additions & 93 deletions test_notebook/clean_JuliaTests.ipynb

Large diffs are not rendered by default.

0 comments on commit 0d318f3

Please sign in to comment.