Try It: Filter Selection Advisor
Try Change Noise type and Preserve sharp edges?, then press Play combinations.
Observe Watch Recommended and Decision logic after you press Play combinations.
Explain Describe how Play combinations changes the recommendation for different noise types.
Play combinations
Reset
Technical boundaries. The recommendation uses Noise type, edge preservation, and the real-time constraint. The decision logic does not filter streaming data or measure noise removal.
viewof sel_noiseType = Inputs. select (
["gaussian" , "spike_impulse" , "mixed_gaussian_spike" , "slow_drift" ],
{value : "gaussian" , label : "Noise type" }
)
viewof sel_edgesImportant = Inputs. toggle ({
label : "Preserve sharp edges?" ,
value : false
})
viewof sel_realTime = Inputs. toggle ({
label : "Real-time (streaming) data?" ,
value : false
})
{
let recommendation, reason, color;
if (sel_noiseType === "spike_impulse" || (sel_noiseType === "mixed_gaussian_spike" && sel_edgesImportant)) {
recommendation = "Median Filter" ;
reason = "Best for spike removal and edge preservation. Completely ignores outlier values." ;
color = "#3498DB" ;
} else if (sel_realTime && sel_noiseType === "gaussian" ) {
recommendation = "Exponential Smoothing" ;
reason = "Zero latency, recursive formula. Ideal for streaming data with Gaussian noise." ;
color = "#9B59B6" ;
} else if (sel_noiseType === "mixed_gaussian_spike" && ! sel_edgesImportant) {
recommendation = "Combined: Median + Exponential" ;
reason = "Two-stage pipeline: median removes spikes first, then exponential smooths remaining noise." ;
color = "#E67E22" ;
} else if (sel_noiseType === "slow_drift" ) {
recommendation = "High-pass + Moving Average" ;
reason = "Remove drift with high-pass, then smooth residual noise with moving average." ;
color = "#16A085" ;
} else {
recommendation = "Moving Average" ;
reason = "Simple and effective for steady-state Gaussian noise. Good general-purpose choice." ;
color = "#2C3E50" ;
}
const scenarios = [
{noise : "gaussian" , edge : false , rt : false , filter : "Moving Average" },
{noise : "gaussian" , edge : false , rt : true , filter : "Exponential Smoothing" },
{noise : "spike_impulse" , edge : true , rt : false , filter : "Median Filter" },
{noise : "mixed_gaussian_spike" , edge : false , rt : false , filter : "Median + Exponential" },
{noise : "slow_drift" , edge : false , rt : false , filter : "High-pass + Moving Avg" },
];
return html `<div style="background: var(--bs-light, #f8f9fa); padding: 1rem; border-radius: 8px; color: var(--bs-body-color);">
<div style="border-left: 4px solid ${ color} ; padding: 0.75rem 1rem; background: var(--bs-body-bg, white); border-radius: 0 4px 4px 0; margin-bottom: 0.75rem;">
<h4 style="margin: 0 0 0.3rem 0; color: ${ color} ;">Recommended: ${ recommendation} </h4>
<p style="margin: 0; font-size: 0.95em;"> ${ reason} </p>
</div>
<p style="margin: 0; font-size: 0.85em; color: #7F8C8D;">
<strong>Decision logic:</strong> Noise type = ${ sel_noiseType. replace (/_/g , " " )}${ sel_edgesImportant ? " + edge preservation required" : "" }${ sel_realTime ? " + real-time constraint" : "" } . Try different combinations to see how the recommendation changes.
</p>
</div>` ;
}
Back to the chapter