MCPcopy Create free account
hub / github.com/DFin/Neural-Network-Visualisation / applyConnectionThreshold

Function applyConnectionThreshold

assets/main.js:514–530  ·  view source on GitHub ↗
(rawValue, { emit = true } = {})

Source from the content-addressed store, hash-verified

512 connectionThresholdValue.textContent = formatThreshold(value);
513 };
514 const applyConnectionThreshold = (rawValue, { emit = true } = {}) => {
515 const max = updateThresholdSliderBounds();
516 let parsed = Number.parseFloat(rawValue);
517 if (!Number.isFinite(parsed)) {
518 parsed = neuralScene.options.connectionWeightThreshold ?? 0;
519 }
520 const clamped = clamp(parsed, min, max);
521 syncThresholdUi(clamped);
522 if (!emit) return;
523 const changed = neuralScene.setConnectionWeightThreshold(clamped);
524 if (changed) {
525 VISUALIZER_CONFIG.connectionWeightThreshold = clamped;
526 if (typeof onConnectionsSettingsChange === "function") {
527 onConnectionsSettingsChange(clamped);
528 }
529 }
530 };
531 const initialThreshold = Number.isFinite(neuralScene.options.connectionWeightThreshold)
532 ? Math.max(min, neuralScene.options.connectionWeightThreshold)
533 : Math.max(min, VISUALIZER_CONFIG.connectionWeightThreshold);

Callers 1

Calls 5

clampFunction · 0.85
syncThresholdUiFunction · 0.85

Tested by

no test coverage detected