/ proof-of-concept / audio-spike-sorting
Sign in
proof-of-concept / audio-spike-sorting
audio-spike-sorting / src / algorithms / index.ts
60 lines · 1.7 KBCodeBlameHistory
2 * The built-in baseline algorithms. Their sources ship with the app and
3 * can be reset to these originals after editing; user-added algorithms
4 * live only in the store.
5 */
6import type { AlgorithmDef } from '../bench/types.ts';
7import matchedFilterSrc from './template_matched_filter.m?raw';
8import onsetKnnSrc from './onset_knn.m?raw';
32dec4fAdd silence_gap_knn as a built-in; stop tracking the tmp/ offline workspaceJeremy Magland 9import silenceGapKnnSrc from './silence_gap_knn.m?raw';
21abc12audio-spike-sorting: benchmark framework for audio event detection and classificationJeremy Magland 11import naiveSrc from './naive_threshold.m?raw';
13export const BUILTIN_ALGORITHMS: AlgorithmDef[] = [
14 {
15 id: 'builtin:template_matched_filter',
16 name: 'template_matched_filter',
17 source: matchedFilterSrc,
18 enabled: true,
19 builtin: true,
20 },
21 {
22 id: 'builtin:onset_knn',
23 name: 'onset_knn',
24 source: onsetKnnSrc,
25 enabled: true,
26 builtin: true,
27 },
29 id: 'builtin:silence_gap_knn',
30 name: 'silence_gap_knn',
31 source: silenceGapKnnSrc,
32 enabled: true,
33 builtin: true,
34 },
36 id: 'builtin:overlap_pursuit',
37 name: 'overlap_pursuit',
38 source: overlapPursuitSrc,
39 enabled: true,
40 builtin: true,
41 },
43 id: 'builtin:naive_threshold',
44 name: 'naive_threshold',
45 source: naiveSrc,
46 enabled: true,
47 builtin: true,
48 },
49];
51export const NEW_ALGORITHM_TEMPLATE = `function [times, labels] = my_sorter(x, fs, training)
52% x recording, column vector at fs Hz
53% training struct: snips {1 x nTypes} cell of [snipLen x nSnips] matrices
54% (columns are snippets), names {1 x nTypes}, pre (samples
55% before the event onset within each snippet)
56% Return event times in seconds and 1-based type labels.
57times = zeros(0, 1);
58labels = zeros(0, 1);
59end
60`;
↑↓ move↵openescclose