/ proof-of-concept / steelsim31
Sign in
proof-of-concept / steelsim31
steelsim31 / scripts / show-samples.ts
11 lines · 1020 BBlameHistoryRaw
1// Prints the sampled parameters of a range of clips without rendering them.
2// node --experimental-strip-types scripts/show-samples.ts [--seed S] [--start I] [--count N]
3import { drawSample } from "./generate.ts";
4const argv = process.argv.slice(2);
5const arg = (n: string, d: string) => { const k = argv.indexOf(`--${n}`); return k >= 0 ? argv[k + 1] : d; };
6const seed = parseInt(arg("seed", "1")), start = parseInt(arg("start", "0")), count = parseInt(arg("count", "8"));
7for (let i = start; i < start + count; i++) {
8 const s = drawSample(seed, i);
9 const p = s.params;
10 console.log(s.id, `E ${(p.E / 1e9).toFixed(0)} rho ${p.rho.toFixed(0)} h ${(p.h * 1e3).toFixed(2)} L ${(p.Lx * 100).toFixed(0)}x${(p.Ly * 100).toFixed(0)} v ${p.strikeVelocity.toFixed(2)} grid ${s.nx}x${s.ny} scale ${(s.shapeScale * 1e3).toFixed(2)}mm p2p ${(s.peakToPeak * 1e3).toFixed(1)} slope ${s.maxSlope.toFixed(3)} sig0 ${p.sigma0.toFixed(2)} sig1 ${p.sigma1.toExponential(1)} mass ${(p.rho * p.h * p.Lx * p.Ly).toFixed(2)} kg`);
↑↓ move↵openescclose