Public
Edited
Aug 11, 2023
1 fork
Importers
2 stars
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
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
Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
height: 150,
caption: "Simplex noise time series",
marks: [
//Plot.ruleY([0]),
Plot.lineY(simplexData, { x: "date", y: "value" })
]
})
Insert cell
simplexData = simplex1d(n)
Insert cell
d3.extent(simplexData, (d) => d.value)
Insert cell
Insert cell
Insert cell
binaryStateSeries = (initialState, transition, start, end) => {
let states;
let curr;
let i;
const n = d3.timeHour.count(start, end);

states = new Array(n);
states[0] = initialState;
curr = initialState;
for (i = 1; i < n; i++) {
curr = d3.randomUniform()() <= transition[curr][0] ? 0 : 1;
states[i] = curr;
}
const hours = time.timeHour.range(start, end);
return states.map((d, i) => ({ date: hours[i], value: d }));
}
Insert cell
Insert cell
Insert cell
Insert cell
generate = (
initial,
transition,
means,
sigmas,
start,
end,
scaleFactor = 1.0
) => {
const n = d3.timeHour.count(start, end);
const seq = nStateSequence(initial, transition, n);
const obs = corrupt(seq, means, sigmas, scaleFactor);
const hours = time.timeHour.range(start, end);
return obs.map((d, i) => ({ value: d, date: hours[i] }));
}
Insert cell
generateMinutes = (
initial,
transition,
means,
sigmas,
start,
end,
scaleFactor = 1.0
) => {
const n = d3.timeMinute.count(start, end);
const seq = nStateSequence(initial, transition, n);
const obs = corrupt(seq, means, sigmas, scaleFactor);
const minutes = time.timeMinute.range(start, end);
return obs.map((d, i) => ({ value: d, date: minutes[i] }));
}
Insert cell
simplex = new SimplexNoise()
Insert cell
simplex1d = (n) => {
const hours = time.timeHour.range(start, end);

const sdata = d3.range(n).map((d, i) => simplex.noise2D(d, 1));

return sdata.map((d, i) => ({ date: hours[i], value: d }));
}
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