Skip to content

Instantly share code, notes, and snippets.

@dbuscombe-usgs
Created June 8, 2014 22:27
Show Gist options
  • Save dbuscombe-usgs/e208fc963a838b408ff5 to your computer and use it in GitHub Desktop.
Save dbuscombe-usgs/e208fc963a838b408ff5 to your computer and use it in GitHub Desktop.
example to show convergence on global mean using runningstats
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