0
0
SciPydata~30 mins

Median and uniform filters in SciPy - Mini Project: Build & Apply

Choose your learning style9 modes available
Median and Uniform Filters with SciPy
📖 Scenario: You have a noisy 1D signal from a sensor. You want to clean it up to see the true pattern better.
🎯 Goal: Apply median and uniform filters to smooth the noisy signal and compare the results.
📋 What You'll Learn
Create a noisy signal as a list
Set a filter size variable
Apply median and uniform filters using scipy.ndimage
Print the filtered results
💡 Why This Matters
🌍 Real World
Sensors often produce noisy data. Filters help clean data so we can understand the true signal.
💼 Career
Data scientists use filtering techniques to preprocess data before analysis or machine learning.
Progress0 / 4 steps
1
Create a noisy signal
Create a list called signal with these exact values: [2, 80, 6, 3, 2, 75, 5, 3, 2]
SciPy
Need a hint?

Use square brackets and commas to create the list exactly as shown.

2
Set the filter size
Create a variable called filter_size and set it to 3
SciPy
Need a hint?

Just assign the number 3 to the variable filter_size.

3
Apply median and uniform filters
Import median_filter and uniform_filter from scipy.ndimage. Then create two variables: median_filtered and uniform_filtered. Use median_filter on signal with size filter_size for median_filtered. Use uniform_filter on signal with size filter_size for uniform_filtered.
SciPy
Need a hint?

Use the exact function names and variable names as shown.

4
Print the filtered results
Print median_filtered and uniform_filtered each on its own line.
SciPy
Need a hint?

Use two print statements, one for each filtered array.