flybrain/packages/brain/tests/fixtures/toy-dataset.ts
acamilo 660c3cf00d
Some checks failed
ci / node 22 (test + typecheck) (push) Has been cancelled
ci / rust stable (cargo test --workspace --release) (push) Has been cancelled
ci / infra/tests/lint.sh (push) Has been cancelled
ci / playwright apps/stage (allowed to fail) (push) Has been cancelled
flybrain v0.4.0: public tree (history retained privately)
2026-09-21 15:09:46 +00:00

27 lines
946 B
TypeScript

import type { BrainDataset } from '../../src/dataset/format';
/** Four-neuron toy connectome: 0 is a Kenyon cell, 1 and 2 are MBONs, 3 is a motor/command neuron. */
export function toyDataset(): BrainDataset {
return {
meta: {
schemaVersion: 1, dataset: 'test', neurons: 4, edges: 5,
roles: { kenyon: [0], mbon: [1, 2], motor: [3], command_0: [3] },
visual: { population: 'test', count: 0 },
},
indptr: Uint32Array.of(0, 3, 4, 5, 5),
targets: Uint32Array.of(1, 2, 3, 3, 1),
weights: Int16Array.of(10, -5, 20, 10, 5),
visualIndices: new Uint32Array(),
visualHemisphere: new Uint8Array(),
visualXY: new Float32Array(),
};
}
/** Deterministic xorshift32 for test sequences. */
export function xorshift(seed = 1): () => number {
let state = seed | 0 || 1;
return () => {
state ^= state << 13; state ^= state >>> 17; state ^= state << 5;
return (state >>> 0) / 0x1_0000_0000;
};
}