Created
June 8, 2014 22:27
-
-
Save dbuscombe-usgs/e208fc963a838b408ff5 to your computer and use it in GitHub Desktop.
example to show convergence on global mean using runningstats
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pylab as plt | |
# generate some data | |
x = np.random.rand(1000,1) | |
# get the class | |
import RunningStats | |
# get an instance of the class | |
rs = RunningStats.RunningStats() | |
# convergence on global mean | |
convav = [] | |
for k in x: | |
rs.Push(k[0]) | |
convav.append(rs.Mean()) | |
plt.plot(x); plt.plot(convav,'r'); plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment