/** * The built-in baseline algorithms. Their sources ship with the app and * can be reset to these originals after editing; user-added algorithms * live only in the store. */ import type { AlgorithmDef } from '../bench/types.ts'; import matchedFilterSrc from './template_matched_filter.m?raw'; import onsetKnnSrc from './onset_knn.m?raw'; import silenceGapKnnSrc from './silence_gap_knn.m?raw'; import naiveSrc from './naive_threshold.m?raw'; export const BUILTIN_ALGORITHMS: AlgorithmDef[] = [ { id: 'builtin:template_matched_filter', name: 'template_matched_filter', source: matchedFilterSrc, enabled: true, builtin: true, }, { id: 'builtin:onset_knn', name: 'onset_knn', source: onsetKnnSrc, enabled: true, builtin: true, }, { id: 'builtin:silence_gap_knn', name: 'silence_gap_knn', source: silenceGapKnnSrc, enabled: true, builtin: true, }, { id: 'builtin:naive_threshold', name: 'naive_threshold', source: naiveSrc, enabled: true, builtin: true, }, ]; export const NEW_ALGORITHM_TEMPLATE = `function [times, labels] = my_sorter(x, fs, training) % x recording, column vector at fs Hz % training struct: snips {1 x nTypes} cell of [snipLen x nSnips] matrices % (columns are snippets), names {1 x nTypes}, pre (samples % before the event onset within each snippet) % Return event times in seconds and 1-based type labels. times = zeros(0, 1); labels = zeros(0, 1); end `;