running_mean
- plasmapy.analysis.time_series.running_moments.running_mean(signal, radius: int)[source]
Calculate the running mean of a sequence.
- Parameters:
signal (1D array_like) – Signal to be averaged.
radius (int) – The number of points on either side of each point for which the running mean is being calculated. The window size is
2 * radius + 1
.
- Returns:
Running mean of
signal
with lengthlen(signal) - 2 * radius
.- Return type:
1D array_like
- Raises:
ValueError – If
len(signal) <= 2 * radius
.
Example
>>> from plasmapy.analysis.time_series.running_moments import running_mean >>> running_mean([1, 2, 3, 4], 1) array([2., 3.])