Smoothing

Noisy data is difficult to deal with, so we often need to do some smoothing. Besides calculating moving averages, we can use one of the NumPy functions to smooth data.

The hanning() function is a window function formed by a weighted cosine (see http://en.wikipedia.org/wiki/Hann_function):

Smoothing

In the preceding formula, N corresponds to the size of the window. We will cover the other window functions in later chapters.

Get NumPy : Beginner's Guide - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.