function createCanvasAndDraw(spacetime, colorMap) {
const w = spacetime[0].length;
const h = spacetime.length;
const context = DOM.context2d(w, h, 1);
context.canvas.style.imageRendering = "pixelated";
colorMap = colorMap.map(colorHash6ToAbgr);
const imageData = new ImageDataUint32(context.getImageData(0, 0, w, h));
for (let i = 0; i < h; i++) {
for (let j = 0; j < w; j++) {
imageData.setPixel(j, i, colorMap[spacetime[i][j]]);
}
}
context.putImageData(imageData, 0, 0);
return context.canvas;
}