Published
Edited
Nov 19, 2020
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
redshifted_color = {
// Map [0,1] to a spectral hue (but varying luminosity) with 0=violet, 1=red.
const cmap = d3.scaleSequential([1,0], d3.interpolateSpectral);
// Color to return when redshifted outside the visible band.
const notvisible = d3.color('black');
return function(z, zmax, attenuation=1) {
if(z < 0 || z > zmax) return notvisible;
const base = d3.lab(cmap(z / zmax));
// Set a fixed reference luminosity then apply attenuation.
base.l = attenuation * 90;
return base;
}
}
Insert cell
grid_redshifts = interp(grid_points[2], init.d, init.z, {clipped:true})
Insert cell
grid_points = {
const [dxy, dz] = [size, dcmax - mindist];
let r = 4000; // target ratio of xy : z densities.
const nxy = Math.round((r * dxy / dz * nsrc) ** (1/3));
const nz = Math.round(nsrc / nxy ** 2);
const xymax = (nxy - 1) / nxy * size / 2;
const xy = linspace(-xymax, xymax, nxy);
const rshift = 0.1 * Math.PI;
const x = xy.map(x => x - (rshift/2) * size / nxy);
const y = xy.map(y => y + rshift * size / nxy);
const z = linspace(mindist, dcmax, nz);
return prepare(meshgrid([x, x, z]).flat(2));
}
Insert cell
random_redshifts = interp(random_points[2], init.d, init.z, {clipped:true})
Insert cell
random_points = {
const r = size / 2;
const x = RNG.uniform(-r,r).array(nsrc, {dtype:Float32Array});
const y = RNG.uniform(-r,r).array(nsrc, {dtype:Float32Array});
const z = RNG.uniform(mindist, dcmax).array(nsrc, {dtype:Float32Array});
return prepare(gather(interleave(x, y, z), 3));
}
Insert cell
function prepare(points) {
return transpose(points
.filter(a => Math.max(Math.abs(a[0]), Math.abs(a[1])) <= 0.5 * fov_radian * maxcurve.Sk(a[2]))
.sort((a,b) => b[2] - a[2]));
}
Insert cell
Insert cell
// Number of sources in a rectangular volume with comoving dimensions size x size x (dcmax - clipdist)
nsrc = Math.round(density * (dcmax - mindist) * size * size)
Insert cell
// Objects closer than this distance in Mpc are clipped.
mindist = 150
Insert cell
Insert cell
// Comoving number density of sources in # / Mpc^3
// Value of 0.24 from Fig 4 of https://arxiv.org/abs/1607.03909
density = 0.24
Insert cell
Insert cell
maxdist = model.comoving_distance(0, zclip)
Insert cell
Insert cell
Insert cell
new FluidsModel(0, 0.2, 0.9, 70).comoving_distance(0, 10)
Insert cell
new FluidsModel(0, 0.2, 0, 70).comoving_distance(0, 10)
Insert cell
new FluidsModel(0, 0.2, 0.8, 70).comoving_distance(0, 9)
Insert cell
new FluidsModel(0, 0.3, 0.7, 70).comoving_distance(0, 10)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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