change line for smoother_arr

This commit is contained in:
Killer3048
2025-04-09 13:21:04 +07:00
parent 9a520bb940
commit 373a5293df
+2 -1
View File
@@ -45,7 +45,8 @@ def moving_average(arr, window_size):
"""Calculates the moving average using NumPy's convolution function."""
# Pad with zeros to handle initial window positions
arr_padded = np.pad(arr, (window_size - 1, 0), "constant")
smoothed_arr = (np.convolve(arr_padded, np.ones(window_size), "valid") / window_size)
smoothed_arr = (np.convolve(arr_padded, np.ones(window_size), "valid") /
window_size)
return [smoothed_arr, arr - smoothed_arr]