Published
Edited
Jul 27, 2020
Importers
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
getExpExpPopSize = function(state,height){
const N0 = state["exponential.popSize"];
const r = state["exponential.growthRate"];
const r1 = state["exponential.ancestralGrowthRate"];
const changeTime = state["transition.time"];
if(height>state["treeModel.rootHeight"]){
return null
}
if(height<changeTime){
return N0*Math.exp(-r*height)
}
const N1 = N0 * Math.exp(-r * changeTime);
return N1 * Math.exp(-r1* (height - changeTime));
}
Insert cell
getExpExpPopulationSizes=(burnin)=>(height)=>{
const Ne=burnin.map(d=>getExpExpPopSize(d,height)).filter(d=>d).sort(d3.ascending)
const Upper = d3.quantile(Ne,0.975);
const Lower = d3.quantile(Ne,0.025);
const Median = d3.median(Ne);
const Mean = d3.mean(Ne);
return {height,Upper,Lower,Median,Mean, Ne}
}
Insert cell
processExpExpData = function(burnin){
const heights= d3.range(50).map(d=>(d/50)*d3.mean(burnin,d=>d["treeModel.rootHeight"]))
const popSizes= heights.map(getExpExpPopulationSizes(burnin))
const origin=burnin[0]["treeModel.rootHeight"]+burnin[0]["age(root)"];
popSizes.forEach(d=>d.t=origin-d.height)
return popSizes;
}
Insert cell
processExpLog = pipe(parseLog,processExpExpData)
Insert cell
Insert cell
function parseGridPoint(text){
return parseInt(text.split("skygrid.logPopSize")[1])-1
}
Insert cell
Insert cell
Insert cell
d3.quantile([-1,-3,-5,-6],0.975)
Insert cell
processSkyGridLog=pipe(parseLog,processSkyGrid)
Insert cell
d3= require("d3")
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more