Published
Edited
Dec 22, 2021
1 fork
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
allS = {
const results = []
for (const carb of alignedVsCarbData) {
const S = op(carb.carbIndex, true)
//const modAvgVec = math.norm(avgVec)
try {
const eigs = math.eigs(S)
const s = eigs.values.toArray()
const item = {
carbIndex: carb.carbIndex,
S,
eigs,
s,
carb
}
results.push(item)
} catch {
const item = {
carbIndex: carb.carbIndex,
S: NaN,
eigs: NaN,
s: NaN,
carb: NaN
}
results.push(item)
}
}
return results
}

Insert cell
Insert cell
op = (carbIndex, innerOnly = false) => {
const rubs = allDataWithVectors.filter(rub => rub.reg === carbIndex)
const carb = carbVolumes.find(carbData => carbData.carbIndex === carbIndex)
const rubsToCalc = innerOnly ? rubs.filter(rub => carb.tagsInside.includes(rub.tag)) : rubs
let s = math.zeros(3,3)
for (const rub of rubsToCalc) {
s = math.add(s, Si(rub))
}
return math.divide(s, rubsToCalc.length)
}
Insert cell
Insert cell
Insert cell
import { carbVolumes, alignedVsCarbData } from '1f2c4a85bc897fd8'
Insert cell
Insert cell
import { vl } from "@vega/vega-lite-api-v5"
Insert cell
md `## Scratch`
Insert cell
{
const v1 = math.matrix([math.matrix([1,0,0])])
const v2 = math.transpose(v1)
const dot = math.multiply(v2, v1)
return {
v1, v2, dot
}
}
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